MCQ_SET_1_question_4a3b81b5-604b-4197-a794-4f174053c353_82860_
MCQ_SET_1_question_4a3b81b5-604b-4197-a794-4f174053c353_82860_
5. What is the output of this program, Command line execution is done as – java
Output “This is a command Line”?
1. class Output {
2. public static void main(String args[]) {
3. System.out.print("args");
4. }
5. }
a) Compilation Error
b) java Output This is a command Line
c) This is a command Line
d) None of the above
6. What is the output of this program, Command line execution is done as – java
Output command Line 10 A b 4 N?
1. class Output {
2. public static void main(String args[]) {
3. System.out.print(args[6]);
4. }
5. }
a) java
b) 10
c) b
d) N
9.The Following steps are required to perform 1) Implement the Listener interface
and overrides its methods 2) Register the component with the Listener
a) Exception Handling
b) String Handling
c) Event Handling
d) None of the above
11. If a class inheriting an abstract class does not define all of its function then it will
be known as?
a) abstract
b) A simple class
c) Static class
d) None of the mentioned
14. Which of these methods deletes all the elements from invoking collection?
a) clear()
b) reset()
c) delete()
d) refresh()
15. Which of these packages contains all the classes and methods required for even
handling in Java?
a) java.applet
b) java.awt
c) java.event
d) java.awt.event
16. What is the value returned by function compareTo() if the invoking string is less
than the string compared?
a) zero
b) value less than zero
c) value greater than zero
d) None of the mentioned
a) abcd
b) ABCD
c) dccd
d) dcba
19. Which of these keywords is used to refer to member of base class from a sub
class?
a) upper
b) super
c) this
d) None of the mentioned
23. Which of these access specifiers must be used for main() method?
a) private
b) public
c) protected
d) None of the mentioned
25. Which of these is necessary condition for automatic type conversion in Java?
a) The destination type is smaller than source type.
b) The destination type is larger than source type.
c) The destination type can be larger or smaller than source type.
d) None of the mentioned
26. If an expression contains double, int, float, long, then whole expression will
promoted into which of these data types?
a) long
b) int
c) double
d) float
30. Which of these jump statements can skip processing remainder of code in its
body for a particular iteration?
a) break
b) return
c) exit
d) continue
int i=10;
while(i==10)
{
System.out.printf("Welcome to java");
i--;
}
How many times the loop will iterate and print “Welcome to Java”. Enter numeric
value only in the box below.
a) 1,2 & 4
b) 1,2 & 3
c) 1, 2 & 4
d) none of the above
34. Which of these methods can be used to convert all characters in a String into a
character array?
a) charAt()
b) getChars()
c) toCharArray()
d) b and c
class Student{
int id;
String name;
a. Parameterized constructor
b. Default Constructor
c. Overloading Constructor
d. None of the above
a) static
b) Boolean
c) void
d) private