JAVA MCQ Ans19.5
JAVA MCQ Ans19.5
3. Which component is used to compile, debug and execute the Java programs?
c) JDK
byte b = 50;
b = b * 50;
d) * operator has converted b * 50 into int, which can not be converted to byte without
casting
19.If an expression contains double, int, float, long, then the whole expression will be
promoted into which of these data types?
c) double
UNIT – II
1. What is the process of defining two or more methods within the same class that
have the same name but different parameters declaration?
a) method overloading
2. Which of these can be overloaded?
c) All of the mentioned (Methods and Constructors can both be overloaded)
3. Which of these is correct about passing an argument by call-by-value process?
a) Copy of argument is made into the formal parameter of the subroutine
4. What is the process of defining a method in terms of itself, that is a method that
calls itself?
d) Recursion
5. Arrays in Java are implemented as?
b) object
6. Which of these keywords is used to prevent content of a variable from being
modified?
a) final
7. Which of these cannot be declared static?
b) object
8. Which of the following statements are incorrect?
d) when object of class is declared, each object contains its own copy of static
variables
9. Which of the following statements are incorrect?
b) final variable must be initialized at the time of declaration
UNIT- III
Thread t = Thread.currentThread();
t.setName("New Thread");
System.out.println(t.getName());
c) New Thread
19.If we try to add Enum constants to a TreeSet, what sorting order will it use?
a) Sorted in the order of declaration of Enums
20.Which method returns the elements of Enum class?
b) getEnumConstants()
UNIT –IV
2. Which of these operators can be used to concatenate two or more String objects?
Answer: a) +
3. Which of this method of class String is used to obtain a length of String object?
Answer: d) length()
4. Which of these method of class String is used to extract a single character from a
String object?
Answer: c) charAt()
5. Which of these constructors is used to create an empty String object?
Answer: a) String()
6. Which of these is an incorrect statement?
Answer: d) None of the mentioned
10.Which of these methods deletes all the elements from invoking collection?
Answer: a) clear()
11.What is Collection in Java?
Answer: a) A group of objects
12.Which of these stream contains the classes which can work on character stream?
Answer: c) Character Stream
13.Which of these class is used to read characters in a file?
Answer: a) FileReader
14.Which of these method of FileReader class is used to read characters from a file?
Answer: a) read()
15.Which of these class can be used to implement the input stream that uses a
character array as the source?
Answer: c) CharArrayReader
16.Which of these classes can return more than one character to be returned to
input stream?
Answer: a) BufferedReader
UNIT – V