18
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

Quiz CS201 (110210)

  • Upload
    sny2ksa

  • View
    355

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Quiz CS201 (110210)

1Object code is machine code but it is not ___________ and_________Select correct option:       relocatable , executable       faster , efficient       compiled ,debugged       tested , compiled

2The 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 classmalloc function returns__________to the _________________ from the available memory.

3Select 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

4When 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

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

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

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

Page 2: Quiz CS201 (110210)

       to the protected data members       to the main program

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

9When 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

10Stream 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:

Page 3: Quiz CS201 (110210)

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

Page 4: Quiz CS201 (110210)

_______________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

Quiz Start Time: 08:02 PM

Time Left 72 sec(s)

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

 

Page 5: Quiz CS201 (110210)

BC090200600 : Sami Ul Haq

Quiz Start Time: 08:02 PM

Time Left 44 sec(s)

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

  BC090200600 : Sami Ul Haq

Quiz Start Time: 08:02 PM

Time Left 45 sec(s)

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

  BC090200600 : Sami Ul Haq

Quiz Start Time: 08:02 PM

Time Left 55 sec(s)

Question # 5 of 10 ( Start time: 08:06:27 PM ) Total Marks: 1

Page 6: Quiz CS201 (110210)

The template functions do NOT promote the code reuse

Select correct option:

True

False

  BC090200600 : Sami Ul Haq

Quiz Start Time: 08:02 PM

Time Left 46 sec(s)

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:

1 2 3 4

1 2 3 4 5

Compile time error

Infinite loop

  BC090200600 : Sami Ul Haq

Quiz Start Time: 08:02 PM

Time Left 80 sec(s)

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

Page 7: Quiz CS201 (110210)

  BC090200600 : Sami Ul Haq

Quiz Start Time: 08:02 PM

Time Left 82 sec(s)

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

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

83 sec(s

)

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

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

38 sec(s

)

Page 8: Quiz CS201 (110210)

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

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

29 sec(s

)

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

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

28 sec(s

)

Question # 5 of 10 ( Start time: 08:33:58 PM )

Total Marks: 1

Page 9: Quiz CS201 (110210)

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

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

69 sec(s

)

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

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

62 sec(s

)

Question # 7 of 10 ( Start time: 08:35:32 PM )

Total Marks: 1

Macros are categorized into _________ type(s).

Select correct option:

one

Page 10: Quiz CS201 (110210)

four

two

none of the given options

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

74 sec(s

)

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

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

46 sec(s

)

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

Page 11: Quiz CS201 (110210)

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.

  MC080202141 : MUNEER HUSSAIN

Quiz Start Time: 08:31 PM

Time Left

78 sec(s

)

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

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

80 sec(s

)

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

Page 12: Quiz CS201 (110210)

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

83 sec(s

)

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.

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

74 sec(s

)

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

  MC080202140 : WAQAR NAEEM

Time Left

45 sec(s

)

Page 13: Quiz CS201 (110210)

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

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

75 sec(s

)

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

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

70 sec(s

)

Question # 6 of 10 ( Start time: 08:47:34 PM )

Total Marks: 1

Page 14: Quiz CS201 (110210)

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

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

58 sec(s

)

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

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

72 sec(s

)

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

Page 15: Quiz CS201 (110210)

function , cannot be overloaded

function, can be overloaded

object, can not be initialized

  MC080202140 : WAQAR NAEEM

Quiz Start Time: 08:43 PM

Time Left

16 sec(s

)

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