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. |
An expression involving byte, int, and literal numbers is promoted to which of these? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: An expression involving bytes, ints, shorts, literal numbers, the entire expression is promoted to int before any calculation is done. |
2. |
Which of these occupy first 0 to 127 in Unicode character set used for characters in Java? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: First 0 to 127 character set in Unicode are same as those of ISO-LAIN-1 and ASCII. |
3. |
Literal can be of which of these data types? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None |
4. |
If an expression contains double, int, float, long, then whole expression will promoted into which of these data types? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: If any operand is double the result of expression is double. |
5. |
Which of these is an incorrect Statement? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Array can be initialized using both new and comma separated expressions surrounded by curly braces example : int arr[5] = new int[5]; and int arr[] = { 0, 1, 2, 3, 4}; |
6. |
Decrement operator, −−, decreases value of variable by what number? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
7. |
Which right shift operator preserves the sign of the value? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
8. |
Which of these operators can skip evaluating right hand operand? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Operator short circuit and, &&, and short circuit or, ||, skip evaluating right hand operand when output can be determined by left operand alone. |
9. |
What is the order of precedence (highest to lowest) of following operators? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
10. |
Which of these jump statements can skip processing remainder of code in its body for a particular iteration? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None. |
11. |
Which of these operators is used to allocate memory for an object? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: Operator new dynamically allocates memory for an object and returns a reference to it. This reference is address in memory of the object allocated by new. |
12. |
Which method can be defined only once in a program? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: main() method can be defined only once in a program. Program execution begins from the main() method by java’s run time system. |
13. |
Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Java handles deallocation of memory automatically, we do not need to explicitly delete an element. Garbage collection only occurs during execution of the program. When no references to the object exist, that object is assumed to be no longer needed, and the memory occupied by the object can be reclaimed. |
14. |
What is the process of defining a method in terms of itself, that is a method that calls itself? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None. |
15. |
What is the process by which we can control what parts of a program can access the members of a class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None. |
16. |
Which of the following statements are incorrect? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: All objects of class share same static variable, when object of a class are declared, all the objects share same copy of static members, no copy of static variables are made. |
17. |
Which of these method of String class can be used to test to strings for equality? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None. |
18. |
Which of these is correct way of inheriting class A by class B? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None. |
19. |
Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: None. |
20. |
Which of these keywords can be used to prevent inheritance of a class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Declaring a class final implicitly declares all of its methods final, and makes the class inheritable. |
21. |
Which of these method of class String is used to extract a single character from a String object? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None. |
22. |
What will be output of the following code? public class Boxer1 { Integer i; int x; public Boxer1(int y) { x = i+y; System.out.println(x); } public static void main(String[] args) { new Boxer1 (new Integer(4)); } } |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Because we are performing operation on reference variable which is null. |
23. |
What is the value returned by function compareTo() if the invoking string is greater than the string compared? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: if (s1 == s2) then 0, if(s1 > s2) > 0, if (s1 < s2) then < 0. |
24. |
What is the string contained in s after following lines of code? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: deleteCharAt() method deletes the character at the specified index location and returns the resulting StringBuffer object. |
25. |
Which of these method of class StringBuffer is used to get the length of sequence of characters? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: length()- returns the length of String the StringBuffer would create whereas capacity() returns total number of characters that can be supported before it is grown. |
26. |
What is the value returned by unction compareTo() if the invoking string is less than the string compared? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: compareTo() function returns zero when both the strings are equal, it returns a value less than zero if the invoking string is less than the other string being compared and value greater than zero when invoking string is greater than the string compared to. |
27. |
Which of these access specifiers can be used for a class so that it’s members can be accessed by a different class in the different package? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
28. |
Which of these keywords is used by a class to use an interface defined previously? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: interface is inherited by a class using implements. |
29. |
Which of these is wrapper for simple data type float? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None. |
30. |
Which of these is wrapper for simple data type char? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |