Instruction
- Total number of questions : 30.
- Time alloted : 30 minutes.
- Each question carry 1 mark.
- No Negative marks
- DO NOT refresh the page.
- All the best :-).
1. |
What is the range of short data type in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Short occupies 16 bits in memory. Its range is from -32768 to 32767. |
2. |
What is the numerical range of a char data type in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Char occupies 16-bit in memory, so it supports 2^16 i:e from 0 to 65535. |
3. |
Which of these is long data type literal? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Data type long literals are appended by an upper or lowercase L. 0x99fffL is hexadecimal long literal. |
4. |
Which of these is necessary condition for automatic type conversion in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
5. |
Which of these operators is used to allocate memory to array variable in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Operator new allocates block of memory specified by the size of array, and gives the reference of memory allocated to the array variable. |
6. |
Which of the following can be operands of arithmetic operators? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The operand of arithmetic operators can be any of numeric or character type, But not boolean. |
7. |
Which of these is not a bitwise operator? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: <= is a relational operator. |
8. |
What is the output of relational operators? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
9. |
Which of these have highest precedence? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Order of precedence is (highest to lowest) a -> b -> c -> d. |
10. |
Which of these selection statements test only for equality? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: switch statements checks for equality between the controlling variable and its constant cases. |
11. |
What is the stored in the object obj in following lines of code? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Memory is allocated to an object using new operator. box obj; just declares a reference to object, no memory is allocated to it hence it points to NULL. |
12. |
What is the return type of a method that does not returns any value? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Return type of an method must be made void if it is not returning any value. |
13. |
What is the return type of Constructors? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Constructors does not have any return type, not even void. |
14. |
What is process of defining two or more methods within same class that have same name but different parameters declaration? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Two or more methods can have same name as long as their parameters declaration is different, the methods are said to be overloaded and process is called method overloading. Method overloading is a way by which Java implements polymorphism. |
15. |
Which of these access specifiers must be used for main() method? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: main() method must be specified public as it called by Java run time system, outside of the program. If no access specifier is used then by default member is public within its own package & cannot be accessed by Java run time system. |
16. |
Arrays in Java are implemented as? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
17. |
String in Java is a? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
18. |
Which of these keyword must be used to inherit a class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None. |
19. |
Which of these keyword can be used in subclass to call the constructor of superclass? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
20. |
Which of these class is superclass of every class in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Object class is superclass of every class in Java. |
21. |
Which of these class is superclass of String and StringBuffer class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
22. |
Which of these method of class String is used to extract more than one character at a time a String object? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None |
23. |
Which of these method of class String is used to extract a substring from a String object? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
24. |
Which of these class is used to create an object whose character sequence is mutable? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: StringBuffer represents growable and writeable character sequence. |
25. |
Which of these method of class StringBuffer is used to extract a substring from a String object? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
26. |
Which of these method of class String is used to compare two String objects for their equality? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
27. |
Which of these keywords is used to define packages in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None. |
28. |
Which of these keywords is used to define interfaces in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
29. |
Which of these classes is not included in java.lang? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Array class is a member of java.util. |
30. |
Which of these is a wrapper for data type int? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |