Skip to main content

cs 201 most important 27 solved MCQ

CS201 3rd QUIZ
From   Lecture #  28 to 32
http://vubest.blogspot.com


Question No: 1      ( Marks: 1 ) - Please choose one
 Overloaded member operator function is always called by _______
       Class
       Object
       Compiler 
       Primitive data type
Question No: 2      ( Marks: 1 ) - Please choose one
 Loader loads the executable code from hard disk to main memory.
       ► True
       False
Question No: 3      ( Marks: 1 ) - Please choose one
Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int?
       new int(10) ;
       new int[10] ;
       int new(10) ;
       ► int new[10];
Question No: 4      ( Marks: 1 ) - Please choose one
 The prototype of friend functions must be written ____ the class and its definition must be written ____
       ► inside, inside the class
       inside, outside the class
       outside, inside the class
       outside, outside the class
http://vubest.blogspot.com

Question No: 5      ( Marks: 1 ) - Please choose one
 Like member functions, ______ can also access the private data members of a class.
       ► Non-member functions
       Friend functions
       Any function outside class
       None of the given options
Question No: 6      ( Marks: 1 ) - Please choose one
 To perform manipulation with input/output, we have to include _____ header file.
       ► iostream.h
       stdlib.h
       iomanip.h
       fstream.h

Question No: 7      ( Marks: 1 ) - Please choose one
The endl and flush are _______
       Functions
       Operators
       ► Manipulators
       Objects
Question No: 8      ( Marks: 1 ) - Please choose one
  If we want to use stream insertion and extraction operators with _______ then we have to overload these operators.
       ► int, float, double
       objects of class
       int, float, object
       int, char, float
Question No: 9      ( Marks: 1 ) - Please choose one
 The static data members of a class can be accessed by ________
       only class
       only objects
       ► both class and objects
       none of given options

Question No: 10      ( Marks: 1 ) - Please choose one
 Classes defined inside other classes are called ________ classes
       ► looped
       nested
       overloaded
       none of the given options.

http://vubest.blogspot.com
Question No: 11      ( Marks: 1 ) - Please choose one
 Which value is returned by the destructor of a class?
       A pointer to the class.
       An object of the class.
       ► A status code determining whether the class was destructed correctly
       Destructors do not return a value.

Question No: 12      ( Marks: 1 ) - Please choose one
Consider the following code segment
class M {
   friend int operator!(const M &);
...
}; 

!s                                 // code of line implies that     operator!(s)
...
Let assume if s is an object of the class then function is implemented as ___________
       ► Member function
       Non-member function
       Binary operator function
       None of the given options
Question No: 13      ( Marks: 1 ) - Please choose one
 If text is a pointer of class String then what is meant by the following statement?
text = new String [5];
       Creates an array of 5 string objects statically
       Creates an array of 5 string objects dynamically
       Creates an array of pointers to string
       Creates a string Object
Question No: 14      ( Marks: 1 ) - Please choose one
 Static variable which is defined in a function is initialized __________.
       Only once during its life time
       ► Every time the function call
       Compile time of the program
       None of the above
Question No: 15      ( Marks: 1 ) - Please choose one
 In functions that return reference, use __________variables.
       Local
       Global
       Global or static
       None of the given option
Question No: 16      ( Marks: 1 ) - Please choose one
 What is the functionality of the following syntax to delete an array of 5 objects named arr allocated using new operator?
delete arr ;
       Deletes all the objects of array
       Deletes one object of array 
       Do not delete any object
       Results into syntax error





Question No: 17      ( Marks: 1 ) - Please choose one
 What is the sequence of event(s) when allocating memory using new operator?
       Only block of memory is allocated for objects
       Only constructor is called for objects
       Memory is allocated first before calling constructor
       Constructor is called first before allocating memory
Question No: 18      ( Marks: 1 ) - Please choose one
 What is the sequence of event(s) when deallocating memory using delete operator?

       Only block of memory is deallocated for objects
       Only destructor is called for objects
       Memory is deallocated first before calling destructor
       Destructor is called first before deallocating memory
Question No: 19      ( Marks: 1 ) - Please choose one
 new and delete operators cannot be overloaded as member functions.
       True
       False

http://vubest.blogspot.com

Question No: 20      ( Marks: 1 ) - Please choose one
 The operator function of <<  and >> operators are always the member function of a class.
       True
       False
Question No: 21      ( Marks: 1 ) - Please choose one
 Which of the following option is true about new operator to dynamically allocate memory to an object?

       The new operator determines the size of an object
       Allocates memory to object and returns pointer of valid type
       Creates an object and calls the constructor to initialize the object
       All of the given options

Question No: 22      ( Marks: 1 ) - Please choose one
 new and delete are _____ whereas malloc and free are _____.

       Functions, operators
       Classes, operators
       Operators, functions
       Operators, classes
Question No: 23      ( Marks: 1 ) - Please choose one
 Which of the following statement is best regarding declaration of friend function?

       Friend function must be declared after public keyword.
       Friend function must be declared after private keyword.
       Friend function must be declared at the top within class definition.
       It can be declared anywhere in class as these are not affected by the public and private keywords.
Question No: 24      ( Marks: 1 ) - Please choose one
 The operator function will be implemented as _____, if obj1 drive the - operator whereas obj2 is passed as arguments to - operator in the statement given below.
obj3   =   obj1 -   obj2;

       Member function
       Non-member function
       Friend function
       None of the given options



Question No: 25      ( Marks: 1 ) - Please choose one
 Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?
       Class-name operator +() ;
       Class-name operator +(int) ;
       Class-name operator ++() ;
       Class-name operator ++(int) ;
Question No: 26      ( Marks: 1 ) - Please choose one
 Class is a user defined___________.

       data type
       memory referee
       value
       none of the given options.
Question No: 27      ( Marks: 1 ) - Please choose one
 The static data members of a class are initialized _______
       at file scope
       within class definition
       within member function
       within main function
http://vubest.blogspot.com

Comments

Post a Comment

Popular posts from this blog

Drupal Answers Weekly Newsletter - Wednesday, December 31, 2014

Top new questions this week: Can I delete old hook_update_N functions? Suppose you have a custom module, and you have hook_update_N() implementations in your .install file. If you have old update functions, and all updates have run in all sites that the module is ... node-update hook-update-n   asked by AyeshK ...

[New post] 8th Class Result 2014 PEC Hafizabad Board

Muhammad Waqas posted: "PEC Hafizabad Board 8th Class Result 2014 expected date is 28th March, 2014 by PEC. Punjab Examination Commission (PEC) will announce 8th class result for Hafizabad Board soon and all the students of Hafizabad Board who are extremely waiting for the resul" New post on Jobs in Pakistan 8th Class Result 2014 PEC Hafizabad Board by Muhammad Waqas ...

[New post] 1st Year (11th Class) Result 2014 BISE Rawalpindi Board

Xaib Aslam posted: "BISERWP board Inter part 1 result expected on 10th October 2014 according our source. students of Rawalpindi board desperately waiting for 11th class result. 1st they upload the 12th class result and after some time they ready for showing the 1st year fin" New post on Jobs in Pakistan 1st Year (11th Class) Result 2014 BISE Rawalpindi Board by Xaib Aslam ...