CS304 Midterm Online Quiz

0%

CS304-Midterm

1 / 50

Which operator can not be overloaded?

2 / 50

What a derived class can add?

3 / 50

Suppose that the Test class does not have an overloaded assignment operator. What happens when an assignment a=b; is given for two Test objects a and b?

4 / 50

An overloaded operator always requires one less argument than its number of operands

5 / 50

The ________ relationship indicates that an object contains other objects

6 / 50

The >= operator can be overloaded

7 / 50

When a variable is define as static in a class then all object of this class,

8 / 50

Which operator can not be overloaded?

9 / 50

We can get only one unique value which can be used by all the objects of that class by the use of,

10 / 50

Suppose there is an object of type Person, which of the following can be considered as one of its attributes

11 / 50

A static member function cannot be declared

12 / 50

Identify which of the following overloaded operator function’s declaration is appropriate for the given call? Rational_number_1 + 2.325 Where Rational_number_1 is an object of user defined class Rational_number

13 / 50

template <> class Vector { } This is an example of partial specialization

14 / 50

A C++ class is similar to --------------------

15 / 50

Which one of the following terms best represents the statement given below, ” Hiding details of an object from the other parts of a program”

16 / 50

The >= operator can be overloaded

17 / 50

Identify which of the following overloaded operator function’s declaration is appropriate for the given call? Rational_number_1 + 2.325 Where Rational_number_1 is an object of user defined class Rational_number

18 / 50

Identify which of the following overloaded operator function’s declaration is appropriate for the given call? Rational_number_1 + 2.325 Where Rational_number_1 is an object of user defined class Rational_number

19 / 50

 _______ remain in memory even when all objects of a class have been destroyed

20 / 50

If you define a vector v with the default constructor, and define another vector w with a one-argument constructor to a size of 11, and insert 3 elements into each of these vectors with push_back(), then the size() member function will return ______ for v and _____ for w

21 / 50

Assume a class C with objects obj1, obj2, and obj3. For the statement obj3 = obj1 - obj2 to work correctly, if the overloaded - operator must

22 / 50

Suppose you have been given the following design, "A person has a name, age, address and sex. You are designing a class to represent a type of person called a patient. This kind of person may be given a diagnosis, have a spouse and may be alive". Given that the person class has already been created, what of the following would be appropriate to include when you design the patient class?

23 / 50

In order to define a class template, the first line of definition must be:

24 / 50

The process of hiding unwanted details from users is called __________

25 / 50

What problem(s) may occur when we copy objects without using deep copy constructor?

26 / 50

The statement objA=objB; will cause a compiler error if the objects are of different classes

27 / 50

The members of a class that can be accessed without creating the object of the class is called

28 / 50

Your chief Software designer has shown you a sketch of the new Computer parts system she is about to create. At the top of the hierarchy is a Class called Computer and under this are two child classes. One is called LinuxPC and one is called WindowsPC. The main difference between the two is that one runs the Linux operating System and the other runs the Windows System (of course another difference is that one needs constant re-booting and the other runs reliably). Under the WindowsPC are two Sub classes one called Server and one Called Workstation. How might you appraise your designers work?

29 / 50

 Which construct is the source for the creation of an object?

30 / 50

An employee working in an organization has 1.Name 2.Past experience 3.Age 4.Relatives 5.Hobbies in spare times Keeping in view the principle of abstraction, which of the above information the company needs to save as employee’s record?

31 / 50

Inheritance is a way to - Please choose one

32 / 50

Static variables act like a global variable in the context or scope of the class

33 / 50

In order to free the memory occupied by the object, we use -------------

34 / 50

a’A static member function can be called, even when a class is not __________

35 / 50

A non-virtual member function is defined in a base class and overridden in a derived class; if that function is called through a base-class pointer to a derived class object, the derived-class version is used

36 / 50

__________ satisfy the condition of polymorphism

37 / 50

For classes with common behavior, you can save effort by placing the common behavior in a __________

38 / 50

Static variable can be initialized more than once

39 / 50

We can use "this" pointer in the constructor in the body and even in the initialization list of any class if we are careful,

40 / 50

this pointers are not accessible for static member functions

41 / 50

Suppose that the Test class does not have an overloaded assignment operator. What happens when an assignment a=b; is given for two Test objects a and b?

42 / 50

_______ remain in memory even when all objects of a class have been destroyed

43 / 50

To convert from a user-defined class to a basic type, you would most likely use

44 / 50

The life of sub object is not dependant on the life of master class in ___________

45 / 50

C++ compiler does not allow to dynamically allocate memory for objects

46 / 50

Which one of the following features of OOP is used to derive a class from another?

47 / 50

Constant objects cannot change their state,

48 / 50

The >= operator can be overloaded.

49 / 50

If there is a pointer p to objects of a base class, and it contains the address of an object of a derived class, and both classes contain a nonvirtual member function, ding(), then the statement p->ding(); will cause the version of ding() in the _____ class to be executed

50 / 50

Which of the following operators always takes no argument if overloaded? 

Your score is

The average score is 0%

0%

Qunoot e Nazilah
Dua e Hajat
4 Qul
6 Kalma
Dua-e-Akasha
Darood Akbar
Surah Fatiha
Dua-e-Ganj Ul Arsh
Dua-e-Jamilah
Ayat-ul-Kursi