Prelim Lab Quiz 2
Prelim Lab Quiz 2
Programming
1. Home
2. My courses
3. UGRD-CS6203C-2123T
4. Week 4: Inheritance and Polymorphism
5. Prelim Lab Quiz 2
Flag question
Question text
Which one is true about a constructor ?
a.
A constructor is used to create objects.
b.
A constructor must have the same name as the class it is declared within.
c.
All of the above
d.
A constructor may be declared private
Feedback
Your answer is correct.
Question 2
Correct
Mark 2.00 out of 2.00
Flag question
Question text
In Object Oriented Programming the mechanism of deriving a new class from an old one is
called -
a.
Method overloading
b.
Inheritance
c.
Operator overloading
d.
Method overriding
Feedback
Your answer is correct.
Question 3
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
If two methods have same name but different parameter list then it is called what -
a.
Operator overloading
b.
Method overloading
c.
Method overriding
d.
None of these
Feedback
Your answer is incorrect.
Question 4
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which among the following best describes multiple inheritance?
a.
Only one class being parent of other child classes
b.
More than one class being parent of other child classes
c.
Only one class being parent of single child
d.
More than one class being parent of single child
Feedback
Your answer is correct.
Question 5
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What keyword is used in Java to define a constant?
a.
private
b.
abstract
c.
static
d.
final
Feedback
Your answer is correct.
Question 6
Correct
Mark 2.00 out of 2.00
Flag question
Question text
In a class definition, the special method provided to be called to create an instance of that
class is known as a/an -
a.
Constructor
b.
Interpreter
c.
Destructor
d.
Object
Feedback
Your answer is correct.
Question 7
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What method is used to find the nth no. of character of given string s1. ?
a.
s1.index
b.
s1.length()
c.
s1.charAt
d.
s1.substring
Feedback
Your answer is correct.
Question 8
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Consider the following statement(s) about Java:
I. All white-space characters (blanks) are ignored by the compiler.
II. Java keywords can be used as variable names.
III. An identifier does not begin with a digit and does not contain any spaces.
IV. The execution of Java applications begins at method main.
Which of them is correct?
a.
(III) and (IV) above
b.
Both (I) and (II) above
c.
Both (I) and (III) above
d.
Both (II) and (IV) above
Feedback
Your answer is correct.
Question 9
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Re-implementing an inherited method in a sub class to perform a different task from the
parent class is called -
a.
Binding
b.
Coupling
c.
Hiding
d.
extending
Feedback
Your answer is correct.
Question 10
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which one is a template for creating different objects ?
a.
A Class
b.
Method
c.
Interface
d.
An Array
Feedback
Your answer is correct.