Programming questions and answers
,Question 1
Correct
Mark 1.00 out of 1.00
0 qaid=103336081 0
Flag question
Question text
3
Consider the following class definitions:
class a {
};
class b:
protected a {
};
What happens when we try to compile this class?
Select one:
a. Will not compile because class body of b is not defined.
b. Will not compile because class a is not public inherited.
c. Will compile successfully.
d. Will not compile because class body of a is not defined.
Feedback
The correct answer is: Will compile successfully.
Question 2
Correct
Mark 1.00 out of 1.00
0 qaid=103336064 0
Flag question
Question text
3
, Which one of the following options is correct about the statement given
below?
The compiler checks the type of reference in the object and not the type of
object.
Select one:
A. Abstraction
B. Inheritance
C. Encapsulation
D. Polymorphism
Feedback
Your answer is correct.
The correct answer is: Polymorphism
Question 3
Correct
Mark 1.00 out of 1.00
0 qaid=103336080 0
Flag question
Question text
3
What is the output of given code fragment?
int f=1, i=2;while(++i<5)
f*=i;
cout<<f;
Select one:
a. 24
b. 12
c. 3
d. 6
Feedback
The correct answer is: 12
,Question 1
Correct
Mark 1.00 out of 1.00
0 qaid=103336081 0
Flag question
Question text
3
Consider the following class definitions:
class a {
};
class b:
protected a {
};
What happens when we try to compile this class?
Select one:
a. Will not compile because class body of b is not defined.
b. Will not compile because class a is not public inherited.
c. Will compile successfully.
d. Will not compile because class body of a is not defined.
Feedback
The correct answer is: Will compile successfully.
Question 2
Correct
Mark 1.00 out of 1.00
0 qaid=103336064 0
Flag question
Question text
3
, Which one of the following options is correct about the statement given
below?
The compiler checks the type of reference in the object and not the type of
object.
Select one:
A. Abstraction
B. Inheritance
C. Encapsulation
D. Polymorphism
Feedback
Your answer is correct.
The correct answer is: Polymorphism
Question 3
Correct
Mark 1.00 out of 1.00
0 qaid=103336080 0
Flag question
Question text
3
What is the output of given code fragment?
int f=1, i=2;while(++i<5)
f*=i;
cout<<f;
Select one:
a. 24
b. 12
c. 3
d. 6
Feedback
The correct answer is: 12