Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Quiz CS201 (110210)

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 15

1

Object code is machine code but it is not ___________ and_________


Select correct option:
relocatable , executable
faster , efficient
compiled ,debugged
tested , compiled

2
The first parameter of operator function for << operator_______________.
Select correct option:
Must be passed by value
Must be passed by reference
Can be passed by value or reference
Must be object of class
malloc function returns__________to the _________________ from the available memory.

3
Select correct option:
NULL pointer, end of the chunk of memory allocated from the stack
void pointer , starting of the chunk of memory allocated from the heap
integer pointer, middle of the chunk of memory allocated from the heap
void pointer, starting of the chunk of memory allocated from the array

4
When an operator function is define as member function for a Unary operator then the number of
argument it take is/are,
Select correct option:
Zero
One
Two
N arguments

5
Overloaded assignment operator must be
Select correct option:
Member function of class
Non-member function of class
Friend function of class
Global function

6
Functions declared with the_______________ specifier in a class member list are called friend
functions of that class.
Select correct option:
protected
private
public
friend

7
The friend function of a class can have access_______________.
Select correct option:
to the public data members only
to the private data members
to the protected data members
to the main program

8
Once we have defined a symbolic constant value using #define, that value _________during
program execution
Select correct option:
can be changed
cannot be changed
varies
becomes zero

9
When a variable is defined as static in a class then___________.
Select correct option:
Separate copy of this variable is created for each object
Only one copy is created for all objects of this class
A copy of this variable is created for only static objects.
None of the given options

10
Stream operators are heavily overloaded means , they allow to handle int and character data type
only.
Select correct option:
True
False

Question # 1 of 10 ( Start time: 01:43:10 PM ) Total Marks: 1


In order to get the right most digit of a number, we divide this number
by 10 and take its
Select correct option:

Remainder
Quotient
Divisor
None of the given options

Question # 2 of 10 ( Start time: 01:43:39 PM ) Total Marks: 1


C++ provides member functions, which control the formatting to be
performed during stream I/O operations.
Select correct option:

True
False

Question # 3 of 10 ( Start time: 01:43:59 PM ) Total Marks: 1


*this is a pointer that always points to
Select correct option:
Current function of the class
Current pointer of the class
Current object of the class
A Value of data member

Question # 4 of 10 ( Start time: 01:44:23 PM ) Total Marks: 1


The concept of friend function negates the concept of
_________________.
Select correct option:

inheritance
polymorphism
persistence
encapsulation

Question # 5 of 10 ( Start time: 01:44:43 PM ) Total Marks: 1


According to c++ norms; the first character of a variable name must
be an alphabet or
Select correct option:

Underscore
Special character
Digit
None of the given options

Question # 6 of 10 ( Start time: 01:44:59 PM ) Total Marks: 1


If we do not write our own assignment operator then which of the
following problem may occur?
Select correct option:

Memory leak
Dangling pointer
NULL pointer
Unreferenced memory

Question # 7 of 10 ( Start time: 01:45:22 PM ) Total Marks: 1


____________will return the number of bytes reserved for a variable or
data type.
Select correct option:

sizeof operator
free operator
void pointer
new operator

Question # 8 of 10 ( Start time: 01:45:37 PM ) Total Marks: 1


_______________are conventional names of the command line
parameters of the ‘main()’ function.
Select correct option:

‘argb’ and ‘argv’


‘argc’ and ‘argv’
‘argc’ and ‘argu’
None of the given

Question # 9 of 10 ( Start time: 01:45:52 PM ) Total Marks: 1


The _______________ data type always represents an empty set of
values in C++
Select correct option:

nil
void
zero
null

Question # 10 of 10 ( Start time: 01:46:04 PM ) Total Marks: 1


If an array has 50 elements, what is allowable range of subscripts?
Select correct option:

0 – 49
1 – 49
0 – 50
1 – 50
BC090200600 : Sami Ul Haq 72
Time Left
sec(s)

Quiz Start Time: 08:02 PM


Question # 2 of 10 ( Start time: 08:03:48 PM ) Total Marks: 1
free function is available in _______________ header file.
Select correct option:

conio.h

iostream.h

string.h

stdlib.h
Click here to Save Answ er & Move to Next Question
BC090200600 : Sami Ul Haq 44
Time Left
sec(s)

Quiz Start Time: 08:02 PM


Question # 3 of 10 ( Start time: 08:04:20 PM ) Total Marks: 1
Overloaded new operator function takes parameter of type size_t and returns
Select correct option:

void (nothing)

void pointer

object pointer

int pointer
Click here to Save Answ er & Move to Next Question

BC090200600 : Sami Ul Haq 45


Time Left
sec(s)

Quiz Start Time: 08:02 PM


Question # 4 of 10 ( Start time: 08:05:16 PM ) Total Marks: 1
When an operator function is define as member function for a Unary operator then the
number of argument it take is/are,
Select correct option:

Zero

One

Two

N arguments
Click here to Save Answ er & Move to Next Question

BC090200600 : Sami Ul Haq 55


Time Left
sec(s)

Quiz Start Time: 08:02 PM


Question # 5 of 10 ( Start time: 08:06:27 PM ) Total Marks: 1
The template functions do NOT promote the code reuse
Select correct option:

True

False
Click here to Save Answ er & Move to Next Question

BC090200600 : Sami Ul Haq 46


Time Left
sec(s)

Quiz Start Time: 08:02 PM


Question # 6 of 10 ( Start time: 08:07:45 PM ) Total Marks: 1
What will be the output of the following while loop? int counter = 0 ; while(counter <
15) cout << counter << “ ”; counter++;
Select correct option:

1234

12345

Compile time error

Infinite loop
Click here to Save Answ er & Move to Next Question

BC090200600 : Sami Ul Haq 80


Time Left
sec(s)

Quiz Start Time: 08:02 PM


Question # 8 of 10 ( Start time: 08:10:01 PM ) Total Marks: 1
A template function must have
Select correct option:

Only one argument

Zero arguments

One or more than one arguments

None of the given options


Click here to Save Answ er & Move to Next Question

BC090200600 : Sami Ul Haq 82


Time Left
sec(s)

Quiz Start Time: 08:02 PM


Question # 9 of 10 ( Start time: 08:11:31 PM ) Total Marks: 1
Copy constructor becomes necessary while dealing with _______allocation in the class.
Select correct option:

Dynamic memory

Static memory

Both Dynamic and Static memory

None of the given options


Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 83


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 1 of 10 ( Start time: 08:31:10 PM
Total Marks: 1
)
Unix operating system was written in ________ language
Select correct option:

C++

Java

FORTRAN

C
Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 38


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 3 of 10 ( Start time: 08:31:39 PM
Total Marks: 1
)
What is the sequence of event(s) when deallocating memory of an
object using delete operator?
Select correct option:

Only block of memory is deallocated for object

Only destructor is called for object

Memory is deallocated first before calling destructor

Destructor is called first before deallocating memory


Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 29


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 4 of 10 ( Start time: 08:32:50 PM
Total Marks: 1
)
Which of the following is true about streams? A. It is a sequence of
bytes B. It is an ordered sequence C. All bytes can go through the
stream simultaneously D. Bytes that enters first into the stream will go
out at last
Select correct option:

A only

C only

A and B

A and D
Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 28


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 5 of 10 ( Start time: 08:33:58 PM
Total Marks: 1
)
A class is a user defined data type it takes __________________________.
Select correct option:

4 bytes in memory

2 bytes in memory

no space in memory unless we create an object from it.

No space in memory unless we create constructors


Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 69


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 6 of 10 ( Start time: 08:35:04 PM
Total Marks: 1
)
Once the _______________ are created, they exist for the life time of the
program
Select correct option:

local variables

non static variables

static variables

automatic variables
Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 62


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 7 of 10 ( Start time: 08:35:32 PM
Total Marks: 1
)
Macros are categorized into _________ type(s).
Select correct option:

one
four

two

none of the given options


Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 74


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 8 of 10 ( Start time: 08:36:52 PM
Total Marks: 1
)
With the use of dynamic allocation of memory, the system resources
can be ________________.
Select correct option:

wasted

used efficiently

used carelessly

all of the above


Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 46


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 9 of 10 ( Start time: 08:38:12 PM
Total Marks: 1
)
A friend function of a class is a function defined
________________________.
Select correct option:

inside that class and that has no access to the members of the
class
outside that class and that has the right to access public
members of the class only
outside that class and that has the right to access all members
of the class.
outside that class and that has the right to access all members
of the class.
Click here to Save Answ er & Move to Next Question

MC080202141 : MUNEER HUSSAIN 78


Time
sec(s
Left
)

Quiz Start Time: 08:31 PM


Question # 10 of 10 ( Start time: 08:39:42 PM
Total Marks: 1
)
The ____________ is called automatically when an object destroys
Select correct option:

destructor

constructor

main program

default constructor
Click here to Save Answ er & Move to Next Question

MC080202140 : WAQAR NAEEM 80


Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 1 of 10 ( Start time: 08:43:32 PM
Total Marks: 1
)
The ws manipulator can be used with ______ stream(s).
Select correct option:

Output

Input

Input/Output

None of the given options


Click here to Save Answ er & Move to Next Question

MC080202140 : WAQAR NAEEM 83


Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 2 of 10 ( Start time: 08:44:24 PM
Total Marks: 1
)
Class is a user defined___________.
Select correct option:

data type

memory reference

value

none of the given options.


Click here to Save Answ er & Move to Next Question

MC080202140 : WAQAR NAEEM 74


Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 3 of 10 ( Start time: 08:44:37 PM
Total Marks: 1
)
We use _________ to open a file or stream for insertion.
Select correct option:

in

out

app

ate
Click here to Save Answ er & Move to Next Question
MC080202140 : WAQAR NAEEM 45
Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 4 of 10 ( Start time: 08:45:00 PM
Total Marks: 1
)
If B is designated as friend of A, B can access A’s non-public members
Select correct option:

B cannot access private member of A

B cannot access protected member of A

A can access non-public members of B

A cannot access B
Click here to Save Answ er & Move to Next Question

MC080202140 : WAQAR NAEEM 75


Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 5 of 10 ( Start time: 08:46:11 PM
Total Marks: 1
)
The second parameter of operator function for >> operator must
always be passed
Select correct option:

By reference

Function takes no argument

By value

None of the given options


Click here to Save Answ er & Move to Next Question
MC080202140 : WAQAR NAEEM 70
Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 6 of 10 ( Start time: 08:47:34 PM
Total Marks: 1
)
If we do not indent the code properly it will __________________
Select correct option:

Be a syntax error

Be a logical error

Not be an error at all

None of the given options


Click here to Save Answ er & Move to Next Question

MC080202140 : WAQAR NAEEM 58


Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 8 of 10 ( Start time: 08:49:05 PM
Total Marks: 1
)
In the member initializer list, the data members are initialized,
Select correct option:

From left to right

From right to left

In the order in which they are defined within class

None of the given options


Click here to Save Answ er & Move to Next Question

MC080202140 : WAQAR NAEEM 72


Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 9 of 10 ( Start time: 08:50:22 PM
Total Marks: 1
)
Constructor is itself a __________ of C++ and ___________.
Select correct option:

class , can be overloaded

function , cannot be overloaded

function, can be overloaded

object, can not be initialized


Click here to Save Answ er & Move to Next Question

MC080202140 : WAQAR NAEEM 16


Time
sec(s
Left
)

Quiz Start Time: 08:43 PM


Question # 10 of 10 ( Start time: 08:50:48 PM
Total Marks: 1
)
What will be the output of following statement? cout << setfill(‘0’) <<
setw(7) << 128 ;
Select correct option:

0128128?

0000128?

1280000

0012800
Click here to Save Answ er & Move to Next Question

You might also like