Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
50 views

cs201 Solved Quiz No 1

This document contains 15 multiple choice questions about C++ concepts like operator overloading, references, pointers, and friend functions. Some key points covered are: - Operator overloading requires careful consideration of operator semantics. - Reference variables are used like ordinary variables without dereference operators. - A pointer stores the address of a variable while a reference is an alias for a variable. - Friend functions negate the encapsulation concept of classes.

Uploaded by

Hunzala Ahmad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

cs201 Solved Quiz No 1

This document contains 15 multiple choice questions about C++ concepts like operator overloading, references, pointers, and friend functions. Some key points covered are: - Operator overloading requires careful consideration of operator semantics. - Reference variables are used like ordinary variables without dereference operators. - A pointer stores the address of a variable while a reference is an alias for a variable. - Friend functions negate the encapsulation concept of classes.

Uploaded by

Hunzala Ahmad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

http://vusolvedpaper.wordpress.

com/midterm-solved-quiz/

ttp://vueducation.com/forum/index.php
CS201 online solved Quiz no2 2013

Question # 1:-
Care must be taken about the correct ______________ of operator
while overloading. (Choose the most appropriate).
1. Semantic
2. Complexity
3. Both Semantic and Complexity
4. None of the given options

Question # 2:-
In functions, that returns reference use ______________.
1. global or local variables
2. global or static variables
3. ordinary variables
Question # 3:-
In overloading the assignment (=) operator, which object(s) will call
the operator function?
1. Left object of the assignment operator
2. Right object of the assignment operator
3. Both objects will call the operator function
4. No object will call the operator function
Question # 4:-
Friend functions are _____________.
1. Unidirectional (not confirm)
2. bidirectional
3. like inline functions
4. private
Question # 5:-
We cannot increment ________________.
1. pointers
2. arrays
3. references
4. Vaiables
http://vusolvedpaper.wordpress.com/midterm-solved-quiz/

ttp://vueducation.com/forum/index.php
Question # 6:-
A pointer is _____________.

1. the address of a variable


2. an indication of the variable to be accessed next.
3. the data type of an address variable

Question # 7:-
Overloaded assignment operator must be

1. Member function of class


2. Non-member function of class (not confirm)
3. Friend function of class
4. Global function

Question # 8:-
The concept of friend function negates the concept of
_________________.
1. inheritance
2. polymorphism
3. persistence
4. encapsulation

Question # 9:-
If class A is a friend of class B, and class B is a friend of class C. If
class A wants class C to be a friend, __________________

1. it has to declare, class C as a friend


2. it has to declare, class B as a friend
3. it has to declare , class A as a friend
4. it has to declare, class B and class A as friend classes

Question # 10:-
The difference between pointers and references is that
_________________.
http://vusolvedpaper.wordpress.com/midterm-solved-quiz/

1. we cannot do arithmetic with pointers


2. we can do arithmetic with pointers
3. we cannot reassign pointers
4. we can assign references

ttp://vueducation.com/forum/index.php

Question # 11:-
A reference cannot be _____________.

1. 1
2. zero
3. NULL
1. 4 integer

Question # 12:-
An address is a ____________________ , while a pointer is a
________________.
ttp://vueducation.com/forum/index.php
1. constant , variable
2. variable , constant
3. global , variable
4. non static variable , constant

Question # 13:-
The reference data types are used as __________________ variables
without any _______________ operator

1. ordinary , deference
2. global , dot
3. static , deference
4. local , &
ttp://vueducation.com/forum/index.php
Question # 14:-
The syntax of declaration of a function that returns the reference to
an integer is ___________.
http://vusolvedpaper.wordpress.com/midterm-solved-quiz/

1. int & myfunc() ;


2. int myfunc();
3. int myfunc() &;
4. integer & myfunc();
ttp://vueducation.com/forum/index.php
Question # 15:-
References cannot be uninitialized. Because it is impossible to
_________________

1. reinitialize a pointer
2. reinitialize a reference
3. initialize a NULL pointer
cast a pointer
ttp://

.com/forum/index.php

You might also like