Java Object

  • By
  • March 1, 2022
  • JAVA

Java And Android –

1. In Which of these selection statements only tests for equality? 

a) If

b) Switch

c) both (a) and (b)

d) None of the mentioned

2- What is the output of this program?

Class comma operator

{

Public static void main (String args [])

{

int sum = 0;

for (int i = 0, j =0; I < 5 & j < 5; ++i, j = I + 1)

sum +=I;

System.out.printIn (sum);

{

}

  1. a) 5
  2. b) 6
  3. c) 14
  4. d) Compilation error

3.Write of the following is not OOPS concept in Java?

  1. a) Inheritance
  2. b) Encapsulation
  3. c) Polymorphism
  4. d) Compilation

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

4. In Java, which of the following is a sort of polymorphism? 

  1. a) Compile time polymorphism
  2. b) Execution time polymorphism
  3. c) Multiple polymorphism
  4. d) Multilevel polymorphism

5. When Overloading does not occur? 

  1. a) More than one method with same name but different method signature and different number of type of parameters.
  2. b) More than one method with same name, same signature but different number of parameters but different type.
  3. c) More than one method with same name, same signature, same number if parameters but  different type.
  4. d) More than one method with same name, same number of parameters and type but different signature.

Learn more at Java Course In Pune.

6.Which Java concept is a technique for converting a real-world item into a class? 

  1. a) Polymorphism
  2. b) Encapsulation
  3. c) Abstraction
  4. d) Inheritance

7. Is method overriding the result of a mix of inheritance and polymorphism? 

  1. a) True
  2. b) False

8.Which statement is true about java? 

  1. a) Platform independent programming language
  2. b) Platform dependent programming language
  3. c) Code dependent programming language
  4. d) Sequence dependent programming language

9.Which of these classes is the superclass of all Java classes?

  1. a) String class
  2. b) Object class
  3. c) Abstract class
  4. d) Array List class

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

Android Questions 

1.A type of service provided by android that shows messages and alerts to user is ?

a). Content Providers

b). View System

c). Notification Manager

d). Activity Manager

2.One of application component that manages application background service is called ?

a). Activities

b). Broadcast Receivers

c). Services

d). Content Providers

Understand it on Java Training In Pune.

3.   In android studio, called back that is called activity interaction with user is started is ?

a). on Start

b). on Stop

c). on Resume

d). on Destroy

4.Code that provided easy way to use all android features is called  ?

a). API

b). DEX

c).DVM

d). JDK

5.One of recent android version is ?

a). Marshmallows

b). Oreo

c). Pie

d). QUALCOMM

6. Required Java environment for development is called ?

a). JDK

b). DEX

c). DVM

d). API

7.By default in android studio during app development, file that holds informs about app’s fundamental features and components is?

a). Android Manifest.xml

b). Res/values

c). Build.gradle

d). Res/layout

8.Method handles requests from the Content Provider class?

a). On create

b). on Select

c). on Click

d). ContenResolver

9. A Type of class that will be responsible to design main screen activity on first time launch of application is called?

a). Activity class

b). Parent class

c). Child class

d). inherited class

10.Can we declare same name of data type in local variable?

a). Yes

b). No

c). Sometimes

d). Never

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

11. In Java ‘this’ keyword is related to?

a). Instance of Parent class

b). Instance of Child Class

c). Instance of Current class

12. What is the size of double and float in java?

a). 64 and 64

b). 32 and 32

c). 64 and 32

d). 32 and 64

Read more at Java Classes In Pune.

13. Find the output ?

int Integer = 26;

char String  = ‘o’;

System.out.print(Integer);

System.out.print(String);

 

a). Throws Exception

b). Compile error

c). 26

d). 26o

14. The object is created with the new keyword at?

a). Compile time

b). Run time

c). Depends

15. public interface outer?

{

void show();

 

}

public class Test {

public static void main(String[] args) {

outer o1=new outer() {

@Override

public void show() {

System.out.println(“execution of Anonymous inner class.”);

}

};

o1.show();

}

 

a). compile Time error

b). Run time error

c). none of this

d). execution of Anonymous inner class.

 

  1. solve the following programm.

 

public class Sample2 {

public static void main(String[] args) {

String str1= “first”;

String s1=”first”;

String str2=”secound”;

String str3=”first”;

if(str1==s1)

{

System.out.println(” equals”);

}else

{

System.out.println(” equal”);

}

System.out.println(“eqlusIgnore : “+s1.equalsIgnoreCase(str1));

}

 

}

16. solve the code ?

public class Sample1 {

public static void main(String[] args) {

String s1=”welcome”;

System.out.println(s1.concat(” newString”));

}

}

17. solve the code?

public class Sample1 {

StringBuffer b1=new StringBuffer(“SSS”);

b1.append(”  newstring”);//mutable

System.out.println(“Append:”+b1);

}

}

18. solve the code

public class Sample1 {

 

String s1=”welcome”;

System.out.println(“CharAt:-“+s1.charAt(3))

 

}

}

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

19. solve the code

public class Sample1 {

 

String s1=”welcome”;

System.out.println(“CharAt:-“+s1.charAt(3))

System.out.println(b1.reverse().charAt(2));

}

}

Author:-

Pooja Ghodekar

Call the Trainer and Book your free demo Class  Call now!!!
| SevenMentor Pvt Ltd.

© Copyright 2021 | Sevenmentor Pvt Ltd.

Submit Comment

Your email address will not be published.

*
*