OOPS
OOPS
3. If a subclass contains a method with the same name and arguments as in the base
class, this property is called as
A) overloading
B) overriding
C) polymorphism
D) error
12. What method has been used for typing conversion in C++?
A) (data type) expression
B) data type (expression)
C) (expression) data type
D) expression (data type)
OOPS-Java Programming
3. Which of the following Math class features do not use any parameters or
arguments?
(A) PI
(B) E
(C) final
(D) Both A and B
6. Assume that rand is an object of the Random class. Which of the following
statements generates a random integer in the [400..1600] range?
(A) int number = rand.nextInt(1600) + 400;
(B) int number = rand.nextInt(1200) + 400;
(C) int number = rand.nextInt(1600);
(D) int number = rand.nextInt(1201) + 400;
12. An object is
(A) one instance of a class.
(B) another word for a class.
(C) a class with static methods.
(D) a method that accesses class attributes.
16. A class, which can use all the features of an established class, is
(A) a static class.
(B) a superclass.
(C) a subclass.
(D) overloaded.
17. An established class, whose members can all be used by a newly declared class, is
(A) a static class.
(B) a superclass.
(C) a subclass.
(D) overloaded.
18. Which identifier shows up both in the superclass and the subclass?
(A) The superclass identifier
(B) The subclass identifier
(C) The class identifier containing the main method
(D) The constructor identifier
20. How is information passed from the subclass constructor to the superclass
constructor?
(A) The superclass constructor is automatically called before the subclass
constructor.
(B) Use the super keyword followed by a parameter list for the superclass.
(C) Use the super keyword followed by the superclass identifier.
(D) Use the new operator inside the subclass constructor to instantiate the
superclass.
25. What is the output of the following code if the input string is "CS 180"?
Scanner scanner = new Scanner();
String str;
str = scanner.next();
System.out.print(str);
(a) CS180
(b) CS
(c) CS 180
(d) The above code fragment does not compile.
(A) 0 0 0 0
(B) 0 0 0
(C) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(D) Compile Error
(A) 0 0 0 0
(B) 0 0 0
(C) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(D) Error message