Vous êtes sur la page 1sur 4

1. What is class?

a. Name of the memory location.


b. blue print of the object.
c. types of method.
d. None of the above.

2. Which is the correct statement to create an object?


a. Simple s;
b. Simple s = Simple();
c. Simple s[] = new Simple();
d. Simple s = new Simple();

3. What is the expansion for OOPs?


a. Object Ordered Programming
b. Oriented object Programming
c. Object Oriented Programming
d. None of the above.

4. In the following statements which is not principle of OOPs?


a. Pointer
b. Class
c. Inheritance
d. Data encapsulation

5. When we pass the values for "command line arguments"?


a. Complie time.
b. Excution time.
c. After excution.
d. In coding side.

6. String is a _________.
a. Class
b. Keyword
c. Method
d. variable

7. Which method is used to print a message and flush to new line?


a. PrintLn()
b. Println()
c. println()
d. printLn()

8. which is the illegal variable?


a. int _studName
b. int stud_name
c. int studName
d. int -studName

9. How many primitive types are available for integer?


a. 4
b. 3
c. 5
d. None of the above.

10. Which is the multiline comment in following statements?


a. //
b. /* */
c. /*
d. // //
11. Why we are using Arithmetic operators?
a. All the below
b. check the condition
c. adding the values
d. Mathametical calculation

12. != is a _______ operator.


a. Not equal
b. equal
c. greater than or equal
d. less than or equal

13. Which logical operator returns true when all the conditions are true?
a. !
b. ||
c. &&
d. &=

14. X -= Y is equals to __________


a. X--
b. X = X - Y
c. X =- Y
d. Y = X - Y

15. Which opertor is called as ternary opertor?


a. Conditional Opertor
b. Arithmetic Operator
c. Logical Operator
d. Bitwise Operator

16. which is useful to test various conditions?


a. if else
b. Nested if
c. else if ladder
d. switch

17. switch is working based on __________.


a. expression
b. condition
c. case
d. all of above

18. In the following statements which is correct?


a. for(int i=10;i<10;i++)
b. for(i=10;i>=0;--i)
c. for(int i=0,j=0;i<=10;i++,++j)
d. all of above

19. Which statement used to terminate a block?


a. continue
b. break
c. exit
d. final

20. What is the output of the following code?

int [] numbers = {10, 20, 30, 40, 50};


for(int x : numbers ){
if( x == 30 ){
continue;
}
System.out.print( x );
}

a. 10 20 30 40 50
b. 10 30 40 50
c. 10 20 40 50
d. Error occured

21. Array maintains it's values based on __________ .


a. index
b. position
c. key
d. array name

22. Which method retrive the size of a string?


a. size()
b. sizeOf()
c. length()
d. count()

23. What is the access specifiers of this method?


void sum(){}

a. private
b. protected
c. public
d. default

24. What is method overloading?


a. two or more methods with same name but different type signature in same class.
b. two or more methods with same name but different type signature in different
class.
c. two or more methods by same name and parameters in same class.
d. two or more methods by same name and parameters in different class.

25. Where we can't use the 'static' keyword?


a. method
b. variable
c. class
d. None of the above

26. Constructor name is same as ________ name.


a. variable
b. class
c. method
d. interface

27. 'this' keyword refer the __________.


a. Current object.
b. Super class object.
c. global variable
d. local variable

28. Which keyword is used to inherit a class?


a. implements
b. final
c. extend
d. extends

29. Methods in interface by default they are ___________.


a. abstract
b. final
c. static
d. all of above

30. We cannot create the object for which class?


a. final class
b. normal class
c. abstract class
d. static class

Vous aimerez peut-être aussi