PDA

View Full Version : CS304 Quiz, June 2010



viki
06-30-2010, 06:42 AM
Question # 1 of 10 ( Start time: 09:26:23 PM ) Total Marks: 1
Consider the code below, class class1{ public: void func1(); }; class class2 : protected class1 { }; Function func1 of class1 is ______ in class2,
Select correct option:



public
protected
private
none of the given options



Question # 2 of 10 ( Start time: 09:27:52 PM ) Total Marks: 1
In case of dynamic memory allocation in a class we should use,
Select correct option:


User defined default constructor
User defined copy constructor
Both of these
None of these



Question # 3 of 10 ( Start time: 09:29:20 PM ) Total Marks: 1
Consider the code below, class class1{ protected: int i; }; class class2 : public class1 { }; Then int member i of class1 is ______ in class2,
Select correct option:


public
protected
private
none of the given options



Question # 4 of 10 ( Start time: 09:30:13 PM ) Total Marks: 1
In private inheritance derived class pointer can be assigned to base class pointer in,
Select correct option:


Main function
In derived class member and friend functions
In base class member and friend functions
None of the given options



Question # 5 of 10 ( Start time: 09:31:42 PM ) Total Marks: 1
Child class can call constructor of its,
Select correct option:


Direct base class
Indirect base class
Both direct and indirect base classes
None of these



Question # 6 of 10 ( Start time: 09:31:59 PM ) Total Marks: 1
Consider the following two lines of code written for a class Student, 1. Student sobj1,sobj2; 2. sobj2 = sobj1; In line No.2 what constructor of Student class will be called,
Select correct option:


Default constructor of Student class.
Copy constructor of student class
Both default and copy constructer of Student class
No constructor will be called.



Question # 7 of 10 ( Start time: 09:33:17 PM ) Total Marks: 1
Consider the code below, class class1{ public: int i; }; class class2 : public class1 { }; Then int member i of class1 is ______ in class2,
Select correct option:

public
protected
private
none of the given options

Question # 8 of 10 ( Start time: 09:33:54 PM ) Total Marks: 1
We can call base class constructor from derived class constructor,
Select correct option:



From derived class constructor body
From the initializer list of derived class constructor
From any member function of derived class
We can not call the base class constructor



Question # 9 of 10 ( Start time: 09:35:20 PM ) Total Marks: 1
Adding a derived class to a base class requires fundamental changes to the base class.
Select correct option:

True
False


Question # 10 of 10 ( Start time: 09:36:44 PM ) Total Marks: 1
Public Inheritance represents,
Select correct option:


“IS A” relationship
“Has A” relationship
“IS Special Kind of” relationship
None of these options



Quiz Start Time: 10:18 AM

Question # 1 of 10 ( Start time: 10:18:05 AM ) Total Marks: 1
Virtual functions allow you to
Select correct option:


create an array of type pointer-to-base class that can hold pointers to derived classes.
create functions that can never be accessed.
group objects of different classes so they can all be accessed by the same function code.
use the same function call to execute member functions of objects from different classes.



Question # 2 of 10 ( Start time: 10:19:28 AM ) Total Marks: 1
Which one of the following operators is used to access members of value data types,
Select correct option:

->
.
&
None of the given options



Question # 3 of 10 ( Start time: 10:20:54 AM ) Total Marks: 1
Consider the code below, class c1{ }; class c2 : public c1 { }; class c3 : public c2 { }; Then c2 is,
Select correct option:


Direct base class of c3
Direct child class of c3
Direct base class of c1
None of these





Question # 4 of 10 ( Start time: 10:22:09 AM ) Total Marks: 1
Which one of the following operators is used to access members of reference data types,
Select correct option:


->
.
&
None of the given options


Question # 5 of 10 ( Start time: 10:23:19 AM ) Total Marks: 1
In specialization we can,
Select correct option:


Replace child class with its base class
Replace base class with its child class
Replace both child and base classes interchangeably
None of the given options


Question # 6 of 10 ( Start time: 10:24:06 AM ) Total Marks: 1
Consider the code below, class class1{ public: void func1(); }; class class2 : private class1 { }; Function func1 of class1 is ______ in class2,
Select correct option:


public
protected
private
none of the given options


Question # 7 of 10 ( Start time: 10:25:15 AM ) Total Marks: 1
Function overloading is done with respect of,
Select correct option:


A single class
A derived class
A base class
Both derived and base classes (p-203)


Question # 8 of 10 ( Start time: 10:25:44 AM ) Total Marks: 1
Child class can call constructor of its,
Select correct option:

Direct base class
Indirect base class
Both direct and indirect base classes
None of these


Question # 9 of 10 ( Start time: 10:26:22 AM ) Total Marks: 1
Consider the code below, class class1{ private: void func1(); }; class class2 : public class1 { }; Function func1 of class1 is ______ in class2,
Select correct option:


public
protected
private
none of the given options

Question # 10 of 10 ( Start time: 10:27:26 AM ) Total Marks: 1
Sender of the message does not need to know the exact class of receiver in________.
Select correct option:


Abstraction
Polymorphism
Inheritance
none of the given (p-225)