CS201 – Introduction To Programming Mcqs Pdf with Answers Part 02

Print/Downlaod pdf

51        Heap is constantly changing in size.

► True

► False


52        While calling function, the arguments are assigned to the parameters from _____________.

left to right

► right to left

► no specific order is followed

► none of the given options.\


53        Classes defined inside other classes are called ________ classes

► looped

► nested

► overloaded

► none of the given options.


54        If we define an identifier with the statement #define PI 3.1415926 then during the execution of the program the value of PI __________.

► can not be replaced

► None of the given options

► Remain constant

► can be changed by some operation


55        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.


56        Every class contains _______________.

► Constructor

► Destructor

► Both a constructor and a destructor

► None of the given options


57        A template function must have

► One or more than one arguments

► Only one argument

► Zero arguments

► None of the given


58        Structured Query Language is used for ______________

► Databases Management

► Networks

► Writing Operating System

► none of the given options


59        When a call to a user-defined function finishes, the variable defined inside the function is still in existence.

► True

► False


 60       The precedence of an operator can be changed through operator overloading.

► True

► False


61        A Matrix can be composed of ints, floats or doubles as their elements. Best way is to handle this , _______________

► Write a separate class to handle each

► Use templates

► Use strings to store all types

► None of the given options


62        “delete” operator is used to return memory to free store, which is allocated by the “new” operator.

True

► False


63        Pointer is a variable which store,

► Data

► Memory Address

► Data Type

► Values


64        All preprocessor directives are started with the symbol______.

► *

► +

► @

► #


65        Within the statement obj1=obj2; obj1 will call the assignment operator function and obj2 will be passed as an argument to function.

True

► False


66        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


67        The second parameter of operator functions for << and >> are objects of the class for which we are overloading these operators.

► True (page 453)

► False


68        To include code from the library in the program, such as iostream, a directive would be called up using this command.

► #include “iostream.h”

► include <iostream.h>

► include <iostream.h>

#include <iostream.h> (sure)


69        The number 544.53 must be stored in _____ data type.

► int

► short

► float (Sure)

► char


70        A template function can have different type of arguments.

True

► False


71        For which values of the integer _value will the following code becomes an infinite loop?

int number=1; while (true) { cout << number; if (number == 3) break; number += integer_value; }

► any number other than 1 or 2

► only 0

► only 1

► only 2


 72       Template class cannot have static variables.

► True

False


73        Which of the following is used with bit manipulation?

► Signed integer

► Unsigned integer

► Signed double

► Un-signed double


74        Structure is a collection of ______________ under a single name.

► Only Functions

► Only Variables

► Both Functions and Variables

► None of the given options


75        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];


76        Unary operator implemented as member function takes ____ arguments whereas non-member function takes _____ arguments.

► One, zero

► Zero, one

► One, two

► Two, one


77        The first parameter of overloaded stream insertion operator is _________ where second parameter is _______

► input stream, object of class

► object of class, output stream

► output stream, object of class

► object of class, input stream


78        We can also do conditional compilation with preprocessor directives.

True

► False


79        If a symbolic constant has been defined, it will be an error to define it again.

True

► False


80        While calling function, the arguments are assigned to the parameters from _____________.

left to right.

► right to left

► no specific order is followed

► none of the given options.


81        Classes defined inside other classes are called ________ classes

► looped

► nested

► overloaded

► none of the given options.


82        If we define an identifier with the statement #define PI 3.1415926 then during the execution of the program the value of PI __________.

► cannot be replaced

► None of the given options

► Remain constant.

► can be changed by some operation


83        Assignment operator is ————————-associative.

right

► left

► binary

► unary


84        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


85        The return type of the operator function for << operator is __________.

class for which we overload operator

► reference of ostream class (ostream&)

► reference of istream class (istream&)

► void


86        The code is written to __________ the program.

► implement

► design

► analysis

► none of the given options.


87        Memory allocated at run time is a system resource and it is the responsibility of _____ to de-allocate the memory.

► System

Programmer

► User of program

► None of given options


88        Templates are not type safe.

► True

False


89        doc is _____________ by type. .

► Sequential File

► Random Access File

► Data File

► Record File


90        Which of the following is NOT a preprocessor directive?

► #error

► #define

► #line

► #ndefine


91        The return type of operator function must always be void.

► True

► False (Page 79)


92        What does (*this) represents?

► The current function of the class

► The current pointer of the class

► The current object of the class

► A value of the data member


93        The statement cin.get (); is used to,

► Read a string from keyboard

► Read a character from keyboard

► Read a string from file

► Read a character from file


 94       When we do dynamic memory allocation in the constructor of a class, then it is necessary to provide a destructor.

► True

► False


95        Overloaded new operator function takes parameter of type size_t and returns

► void (nothing)

► void pointer

► object pointer

► int pointer


96        The second parameter of operator functions for << and >> are objects of the class for which we are overloading these operators.

► True

► False


97        C++ is a case-sensitive language

True

► False


98        To include code from the library in the program, such as iostream, a directive would be called up using this command.

► #include “iostream.h”

► include <iostream.h>

► include <iostream.h>

► #include <iostream.h> (Sure)


99        A template function must have only generic data types.

► True

► False


100      Template class can not have static variables.

► True

► False