Cs201-Finalterm-Mcqs-Solved-With-References-By-Moaaz Final
Cs201-Finalterm-Mcqs-Solved-With-References-By-Moaaz Final
Q.No:1 All A template function must have at least generic data type
Zero One Two Three
Q.No:2 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 with in class definition.
► It can be declared anywhere in classes these are not affected by the public and private keywords.
Q.No:3 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);
Q.No:4 Class is a user defined .
data type Memory referee Value None of the given options.
Q.No:5 How many bytes will the pointer intPtr of type into move in the following statement? intPtr +=3 ;
3bytes 6bytes 12 bytes 24bytes
Q. No: 6 Which of the following is the correct C++syntax to allocate space dynamically for an array of10 int?
New int(10); New int [10]; Int new(10); int new[10];
Q.No: 7 A Pointer is a special variable that contain
Data values Memory Address Both data and values None of the given option
Q. No: 8 Reference Value Type Data The code is written to the program.
Implement design analysis none of the given options
Q.No: 9 Operator overloading can be performed through .
Classes Function Operators Reference
Q. No: 10 When a value is referred by a normal variable the nit is known as,
Direct Reference Indirect Reference. Partial Reference Proper Reference
Q.No: 11 which of the following function issued to increase the size of already allocated memory chunk?
malloc calloc realloc free
Q. No: 12 Which of the following is NOT a preprocess or directive?
#error #define #line #n define
Q. No: 13 The stream objects cin and cout are included in which header file?
iostream.h fstream.h istream.h ostream.h
Q.No: 14 Overloaded delete operator function takes the same parameter as an argument returned by new
operator function.
True False
Q.No: 15 When an array of object is created dynamically then there is no way to provide parameterized
constructors for array of objects.
True False
Q.No: 16 C is widely known as development language of operating system.
Linux Windows Unix MacOS
Q. No: 17 Computer can understand only machine language code.
True False
Q.No: 18 We cannot define a function as a friend of a Template class.
True False
1
Q.No: 19 What will be the value of ‘a’and‘b’ after executing the following statements?
A=3; b=a++;
3, 4 4, 4 3, 3 4, 3
Q. No: 20 Consider the following code segment. What will be the output of following code?
Int add Value (int *a){
Int b=(*a)+2; return b ;}main({ intx=6;
cout<<x<<“,”;
cout<<add Value(&x)<<“,”;
cout <<x ;}
6,6,8 6,8,6 6,8,8 6,6,6
Q. No: 21 Is used to trace the logic of the program and correct the logical errors.
Compiler Editor Linker Debugger
Q.No: 22 New and delete are where as malloc and free are .
Functions, operators Classes, operators Operators, functions Operators, classes
Q.No: 23 Like member functions, can also access the private at a member sofa class.
Non-member Friend functions Any function outside class None of the given options
functions
Q. No: 24 Which situation would require the use of a non-member overloaded operator?
► The overloaded operator is an Assignment operator.
►The left most operand is an object of a class.
► The left operand is built-in data type.
► The operator returns a reference.
Q.No: 25 The stream insertion and stream extraction operators are already overloaded for .
► User-defined data types
►Built-indatatypeshttp://www.sstutor.com/cpp/stream1.htm
► User-defined and built-in data types
► None of the given options
Q.No:26 If we define an identifier with the statement # define PI3.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
Q.No: 27 Assignment operator is ----------------- associative.
Right left binary unary
Q.No: 28 when ever dynamic memory allocation is made in C/C++, it is freed .
Explicitly Implicitly Both explicitly and implicitly None of the given options
Q.No: 29 the appropriate data type to store the number of rows and columns of the matrix is .
float int (Not sure) char None of the given options.
Q.No:30 which of the following function do NOT initialize the chunk of memory to all zero?
Calloc ( )function Both malloc () and calloc () None of the above malloc () function
Q.No:31 The function free () returns back the allocated memory got thorough calloc an malloc to .
stack heap stack and heap None of the given options
Q. No: 32 width() is member function of______
Cin object Cout object Both cin and cout object None of the given option
Q.No: 33 Templates are not type safe.
True False
Q.No:34 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
2
Q.No:35 In if structure the block of statements is executed only,
► When the condition is false
► When it contain arithmetic operators
► When it contain logical operators
►When the condition is true
Q.No:36 Header file: fstream.h includes the definition of the stream classes .
ifstream,fstream,cout ifstream, fstream, ofstream fstream,cin,cout None of the above
Q.No:37 To access the data members of structure is used.
dot operator (.) * Operator □operator None of given.
Q.No:38 eof (),bad(),good(),clear() all are manipulators.
True False
Q.No:39 which kind of functions can access private member variables of a class?
► Friend functions of the class
► Private member functions of the class
► Public member functions of the class
► Friend, private and public functions
Q.No:40 The return type of operator function must always be void.
True False
Q.No:41 Friend function of a class is .
Member function Non-member function Private function Public function
Q.No:42 Function implementation of friend function must be defined outside the class.
True False
Q.No:43 The normal source of cin object is,
File Disk Key board RAM
Q.No:44 Which of the following is correct way to initialize a variable x of int type with value10?
int x ;x=10; intx = 10; int x,x= 10; x=10;
Q.No:45 Consider the following code segment. What will be the output of the following program?
int func(int) ; int num=10 ;
int main(){int num ;num = 5 ; cout<<num;
cout<<func(num);}
intfunc(intx){ return num ;}
5, 5 10, 5 5, 10 10, 10
Q.No:46 with template function; the compiler automatically detects the passed data and generates a new
copy of function using passed data.
True False
Q.No:47 what will be the correct syntax to declare two-dimensional array of float data type?
floatarr {2}{2}; floatarr [2][2] ; floatarr [2,2]; float[2][2]arr;
Q.No:48 The first parameter of operator function for<<operator,
► Must be passed by value
►Must be passed by reference
► Can be passed by value or reference
► Must be object of class
Q.No:49 Heap is constantly changing in size.
True False
Q.No:50 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.
3
Q.No:51 Classes defined inside other classes are called classes
looped nested overloade None of the given options.
d
Q.No:52 If we define an identifier with the statement #define PI3.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
Q.No: 53 Which value is returned by the destructor of a class?
A pointer to the class. An object of the class.► A status code determining Destructors do not
whether the class was destructed return a value
correctly
Q.No:54 Every class contains .
Constructor Destructor Both a constructor and a destructor None of the given options
Q.No:55 A template function must have
One or more than one arguments ► Only one argument► Zero arguments None of the given options
Q.No:56 Structured Query Language is used for
Data bases Management► Networks ► Writing Operating System ► None of the given options
Q.No:57 when a call to a user-defined function finishes, the variable defined inside the function is still in
existence.
True False
Q.No:58 The precedence of an operator can be changed through operator overloading.
True False
Q.No:59 A Matrix can be composed of ints, floats or doubles as their elements.Bestway is to handle this,
Write a separate class to handle each Use templates ► Use strings to store all types None
Q.No:60 “delete" operator is used to return memory to free store, which is allocated by the "new "operator.
True False
Q.No:61 Pointer is a variable which store,
Data Memory Address Data Type Values
Q.No:62 All preprocess or directives are started with the symbol .
* + @ #
Q.No:63 Within the statement obj1=obj2;obj1 will call the assignment operator function and obj2
will be passed as an argument to function.
True False
Q.No:64 What is the sequence of event(s) when deal locating memory using delete operator?
► Only block of memory is deal located for objects
► Only destructor is called for objects
► Memory is deal located first before calling destructor
►Destructor is called first before deal locating memory
Q.No:65 The second parameter of operator functions for<< and>>are objects of the class for which we are
Over loading these operators.
True False
Q.No:66 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>
Q.No:67 The number 544.53 must be stored in data type.
int short float char
Q.No:68 A template function can have different type of arguments.
True False
4
QuestionNo:9 (Marks:1)- Please choose one
Forwhichvaluesof theinteger_valuewillthefollowingcodebecomes aninfinite loop?
intnumber=1;
while (true) {
cout<< number;
if (number == 3) break;
number+=integer_value;}
► anynumberotherthan 1 or2
►only 0
► only1
► only2
5
► True
► False
QuestionNo:11 (Marks:1)- Please choose one
Whichofthefollowingisused withbit manipulation?
► Signedinteger
►Un-signedinteger(Page245)
► Signeddouble
► Un-signeddouble
► Only Functions
►OnlyVariables(Page229)
► BothFunctionsand Variables
► Noneofthe givenoptions
► newint(10);
►newint[10];
► intnew(10);
► int new[10];
► One,zero
►Zero,one
► One,two
► Two,one
► inputstream,objectofclass
► objectofclass,output stream
►outputstream,objectofclass
► objectofclass,input stream
►True(Page272)
► False
6
QuestionNo:17 (Marks:1)- Please choose one
Ifasymbolicconstanthasbeendefined,itwillbeanerrortodefineitagain.
►True(Page273)
► False
►lefttoright.(Page295)
► righttoleft
► nospecificorderisfollowed
► noneofthegiven options.
► looped
►nested(Page492)
► overloaded
► noneofthe givenoptions.
► cannotbe replaced
► Noneofthe givenoptions
►Remainconstant.(Page271)
► canbe changedbysomeoperation
► right
► left
► binary
► unary
► Createsanarrayof5stringobjectsstatically
►createsanarrayof5stringobjects dynamically
► Createsanarrayofpointerstostring
► CreatesastringObject
► classforwhichweoverloadoperator
► referenceofostreamclass(ostream&)
► referenceofistreamclass(istream&)
► void
► True
►False(Page518)
► #error
► #define
► #line
►#ndefine(Page 2727)
► True
►False(Page79)
8
QuestionNo:4 (Marks:1)- Please choose one
Whatdoes(*this)represents?
► Thecurrentfunction oftheclass
► Thecurrentpointeroftheclass
►Thecurrentobjectof theclass(Page390)
► Avalueofthedatamember
► Readastringfrom keyboard
►Readacharacterfromkeyboard(Page 426)
► Readastringfrom file
► Readacharacterfromfile
►True(Page479)
► False
► void (nothing)
►voidpointer(Page415)
► objectpointer
► int pointer
►True(Page453)
► False
►True(Page68)
► False
► #include “iostream.h”
► include<iostream.h>
9
► include<iostream.h>
►#include<iostream.h>(Sure)
► True
►False(Page501)
► True
► False
►*ptr=arr;
► ptr=arr;
► *ptr=arr[5] ;
► ptr=arr[5];
► ptr[3]
► (ptr+3)
► *(ptr+3)
►Both1and3
► True
►False(Page251)
If there is a symbol (& sign) used with the variable name followed by data type then it refers to and
if & is being used with variable name then it refers to .
► Addressofvariable,reference variable
► Referencevariable,valueof variable
►Referencevariable,addressofvariable(Page367)
► Addressofvariable,valueofvariable
► functionprototype
► function definition
►bothfunctionprototypeorfunctiondefinition(Page294)
► noneofthe givenoptions.
► looped
►nested(Page492)
► overloaded
► noneofthe givenoptions.
► Dataencapsulation
► Providingaconvenientwayofmodelingreal-world objects
► Simplifyingcodereuse
►Allofthegiven options
► Constructor
► Destructor
►Bothaconstructorandadestructor(Lecture27)
► Noneofthe givenoptions
CompileTime
►Run Time
► LinkTime
► Noneofthe givenoptions
► Destructorof enclosingclasswillbecalledfirst
►Destructorofinnerobjectwillbecalledfirst
11
► Constructorand Destructorwillbecalledsimultaneously
► Noneofthe givenoptions
►True(Page492)
► False
►Class,Objects(Page342)
► Structures,Pointers
► BothClassandstructures
► Noneofabove
►True(Page334)
► False
►Botharraysmustbeof thesamesizeanddatatype(Page105)
► Botharraysmaybeofdifferent size
► Botharraysmaybeofdifferentdatatype
► Botharraysmaybeofdifferent sizeand type
►True
► False
QuestionNo:3 (Marks:1)- Please choose one
eof(),bad(),good(),clear() allaremanipulators.
►True(Page433)
► False
► void (nothing)
►voidpointer(Page415)
► objectpointer
► int pointer
12
QuestionNo:5 (Marks:1)- Please choose one
Whennewoperatorisoverloadedatgloballevelthencorrespondingbuilt-innewoperatorwillnotbe visible to
whole of the program.
►True(Page413)
► False
► parentheses()
►braces{}(Page37)
► brackets[]
► arrows<>
► float
► int
►void(Page79)
► double
► JAVA
►B
►C(Page12)
► FORTRAN
► Non-memberfunctions
► Friendfunctions(Page 346)
► Anyfunctionoutsideclass
► Noneofthe givenoptions
► Friendfunctionmustbedeclaredafterpublic keyword.
► Friendfunctionmustbedeclaredafterprivate keyword.
► Friendfunctionmustbedeclaredatthetopwithinclassdefinition.
►Itcanbedeclaredanywhereinclassasthesearenotaffectedbythepublicandprivatekeywords.
13
(Page 346)
► Non-memberfunctionofclass
► Memberfunctionofclass(Page372)
► Friendfunctionofclass
► Noneofthe givenoptions
► Functions
► Operators
►Manipulators(Page434)
► Objects
►True(Page273)15
► False
► noneofthe givenoptions.
►cast(Page281)
► cost
► const
► True
►False(Page323)
►defaultParameters (5);
► defaultParameters(5,‘8’);
► defaultParameters(6,‘#’);
► defaultParameters(0,0,‘*’,0);
14
QuestionNo:17 (Marks:1)- Please choose one
WhenanoperatorfunctionisdefinedasmemberfunctionforabinaryPlus(+)operatorthenthenumberof argument it take
is/are.
► Zero
► One
►Two(Page371)
► Narguments
► True
►False(Page320)
►Constructorofenclosingclasswillbecalledfirst(Page464)
► Constructorofinnerobjectwillbecalledfirst
► Constructorand Destructorwillbecalledsimultaneously
► Noneofthe givenoptions
15
QuestionNo:20 (Marks:1)- Please choose one
Theappropriatedatatypeto storethenumberofrows andcolums ofthematrixis .
► float
►int(Notsure)
► char
► noneofthe givenoptions.
►datatype(page 317)
► memoryreferee
► value
► noneofthe givenoptions.
► Decremented
► Incremented
► Multiplied
►BothIecrementedandDecremented(Page366)
► strings.hand iostream.h
► ctype.hand conio.c
► conio.candconio.h
►stdlib.handstddef.h(Page281)
► Writeaseparateclass tohandleeach
►Usetemplates(Page527)
► Usestringstostorealltypes
► Noneofthe givenoptions
16
►Thenumberof digitsafterthedecimalpoint(Page440)
► Thenumberofdigits beforethedecimal point
► Thenumberofdigitsinanumber
► Noneofthe givenoptions
QuestionNo:1(Marks:1)-Pleasechooseone
In C/C++ifwe define anarrayofsize eight (8) i.e. int Arr [8];thenthelastelement ofthisarraywill bestored at,
► Arr[0]
► Arr[8]
► Arr[7]
► Arr[-1]
QuestionNo:2(Marks:1)-Pleasechooseone
Whenanarrayispassedtoa functionthen defaultwayofpassingthisarray is,
► Bydata
► Byreference(Page154)
► Byvalue
► Bydatatype
QuestionNo:3(Marks:1)-Pleasechooseone
Arrayisa data structure whichstore
► Memoryaddresses
► Variables
► DataType(Page100)
► Data
QuestionNo:4(Marks:1)-Pleasechooseone
Wecanalsocreateanarrayofuserdefinedatatype.
► True(Page408)
► False
17
QuestionNo:5(Marks:1)-Pleasechooseone
Whenwedefineanarrayofobjects then,
► Destructorwillcallonceforwholearray
► Destructorwillcallforeachobjectofthearray
► Destructorwillnevercall
► Dependsonthe sizeofarray
QuestionNo:6(Marks:1)-Pleasechooseone
Whatisthesequenceofevent(s)whenallocatingmemoryusingnewoperator?
► Onlyblockofmemoryisallocatedforobjects
► Onlyconstructoriscalledfor objects
► Memoryisallocatedfirstbeforecallingconstructor(Page414)
► Constructoriscalledfirstbeforeallocatingmemory
QuestionNo:7(Marks:1)-Pleasechooseone
We candeleteanarrayofobjectswithoutspecifying[]bracketsifa classisnotdoingdynamicmemory allocation internally.
► True
► False
QuestionNo:8(Marks:1)-Pleasechooseone
Thesecondparameterofoperatorfunctionsfor<<and>>areobjectsoftheclass For which
we are overloading these operators.
► True(Page453)
► False
QuestionNo:9(Marks:1)-Pleasechooseone
Whichofthefollowingiscorrectwaytoinitializeavariablexofinttypewith value 10?
► int x; x =10 ;
► intx = 10 ; (sure)
► int x, x =10;
► x =10 ;
QuestionNo:10(Marks:1)-Pleasechoose one
Default mechanism of function calling in case of array is andincaseof
variable is .
► Callbyvalue,callbyreference
► Callbyreferene,callbyreference
► Callbyreference,callbyvalue(Page119)
► Callbyvalue,callby value
QuestionNo:11(Marks:1)-Pleasechoose one
WhatdoesSTLstand for?
► Sourcetemplatelibrary
18
► Standardtemplatelibrary(Page519)
► Streamtemplatelibrary
► Standardtemporarylibrary
QuestionNo:12(Marks:1)-Pleasechoose one
Skill(s) thatis/are neededbyprogrammer’s .
► Payingattentiontodetail
► Thinkaboutthereusability
► Thinkaboutuserinterface
► Allof thegivenoptions(Page4&5)
QuestionNo:13(Marks:1)-Pleasechoose one
Forwhicharray,thesizeofthearrayshouldbeonemorethanthenumberof elements in an
array?
► int
► double
► float
► char(Page 113)
QuestionNo:14(Marks:1)-Pleasechoose one
new and delete are whereasmalloc and free are .
► Functions,operators
► Classes,operators
► Operators,functions(Page342-285)
► Operators,classes
QuestionNo:15(Marks:1)-Pleasechoose one
Friend functions are ofaclass.
► Memberfunctions
► Publicmember functions
► Privatememberfunctions
► Non-memberfunctions(Page346)
QuestionNo:16(Marks:1)-Pleasechoose one
The prototype of friend functions must be written theclassandits
definition must be written
► inside,insidetheclass
► inside,outsidetheclass(Page346)
► outside,insidetheclass
► outside,outsidetheclass
QuestionNo:17(Marks:1)-Pleasechoose one
Ifoverloadedplusoperatorisimplementedasnon-memberfunctionthenwhich of the
following statement will be true for the statement given below?
obj3=obj1+obj2;
► obj2willbepassedasanargumentto+operatorwhereasobj2will
19
drivethe +operator
► obj1willdrivethe+operatorwhereasobj2willbepassedasanargument to +
operator
► Bothobjects(obj1,obj2)willbepassedasargumentstothe+operator(not sure)
► Anyoftheobjects(obj1,obj2)candrivethe + operator
QuestionNo:18(Marks:1)-Pleasechoose one
Whichoneofthefollowingisthedeclarationofoverloadedpre-incrementoperatorimplementedasmember function?
► Class-nameoperator+();
► Class-nameoperator+(int);
► Class-nameoperator++(); (page389)
► Class-nameoperator++(int);
QuestionNo:19(Marks:1)-Pleasechoose one
For cin, the source isnormallya and destinationcan be .
► File,nativedatatype
► Disk,user-definetype
► Keyboard,variable(Page424)
Forcin,thesourceisnormallykeyboardandthedestinationcanbeanordinary variable
► File,user-definetype
QuestionNo:20(Marks:1)-Pleasechoose one
Wecanalsodoconditionalcompilationwithpreprocessordirectives.
► True(Page272)
► False
QuestionNo:21(Marks:1)-Pleasechoose one
Theprograms,inwhichweallocatestaticmemory,runessentiallyon
► Heap
► SystemCache
► Noneofthegivenoptions
► Stack(Page280)
Theprograms,inwhichweallocatestaticmemory,runessentiallyon stack.
QuestionNo:22(Marks:1)-Pleasechoose one
The defaultvalueofaparametercanbeprovidedinside the
► functionprototype
► functiondefinition(Page249)
► bothfunctionprototypeorfunction definition
► noneofthegivenoptions.
Thedefaultvalueofaparameterisprovidedinsidethefunctionprototypeorfunction definition.
QuestionNo:23(Marks:1)-Pleasechoose one
20
Whilecallingfunction,theargumentsareassignedtotheparametersfrom .
► lefttoright.(page 295)
► righttoleft
► nospecificorderisfollowed
► noneofthegivenoptions.
QuestionNo:24(Marks:1)-Pleasechoose one
WhenanoperatorfunctionisdefinedasmemberfunctionforabinaryPlus(+)operatorthenthenumberof argument it take
is/are.
► Zero
► One
► Two(Page 371)
► Narguments
QuestionNo:25(Marks:1)-Pleasechoose one
Withuser-defineddatatypevariables(Objects),selfassignmentcanproduce
.
► Syntaxerror
► Logicalerror
► Linkerror
► Nonof thegivenoptions(notsure)
QuestionNo:26(Marks:1)-Pleasechoose one
Assignmentoperatorisusedtoinitializeanewlydeclaredobjectfromexisting object.
► True(Page 479)
► False
QuestionNo:27(Marks:1)-Pleasechoose one
Whenanobjectofa classisdefinedinside anotherclass then,
► Constructorofenclosingclasswillbecalledfirst (Page496)
► Constructorofinnerobjectwillbecalledfirst
► ConstructorandDestructorwillbecalledsimultaneously
► Noneofthegivenoptions
QuestionNo:28(Marks:1)-Pleasechoose one
Inthememberinitializerlist,thedatamembersareinitialized,
► Fromleftto right
► Fromrighttoleft
► Inthe order inwhichtheyare definedwithinclass
► Noneofthegivenoptions
QuestionNo:29(Marks:1)-Pleasechoose one
newoperatorallocatesmemoryfromfree store andreturn .
21
► Apointer
► Areference
► Aninteger
► Afloat
QuestionNo:30(Marks:1)-Pleasechoose one
"new"and"delete" keywordsare inC++ language.
► Built-in-Function
► Operators
► MemoryAllocationFunction (Page332)
► Noneofthegivenoptions
QuestionNo:1(Marks:1)-Pleasechooseone
&&is operator.
► Anarithmetic
► Logical (Page 40)
► Relational
► Unary
QuestionNo:2(Marks:1)-Pleasechooseone
Whichofthefollowingfunction(s)is/areincludedinctype.hheaderfile?
► isdigit(intc)
► isxdigit(intc)
► tolower(intc)
► Allof the above (Page188)
QuestionNo:3(Marks:1)-Pleasechooseone
Disks are deviceshavingaccesstime of milliseconds.
► Electro-physical, 6
► Electro-Mechanical,4
► Electro-physical, 5
► Electro-Mechanical,7 (Page427)
http://www.tns.com/taocs_dp.asp
QuestionNo:5(Marks:1)-Pleasechooseone
Whenweusemanipulatorsinourprogramthenwhichheaderfileshouldbe included?
► iostream.h
► stdlib.h
► stdio.h
► iomanip.h (Page433)
QuestionNo:6(Marks:1)-Pleasechooseone
setprecisionisaparameterlessmanipulator.
22
► True
► False(Page 439)
QuestionNo:7(Marks:1)-Pleasechooseone
WhichofthefollowingisNOTapreprocessor directive?
► #error
► #define
► #line
► #ndefine(Page 272)
QuestionNo:8(Marks:1)-Pleasechooseone
Wecandoarithmeticwithreferenceslike pointers.
► True
► False(Page369)
QuestionNo:9(Marks:1)-Pleasechooseone
Whatdoes(*this)represents?
► Thecurrentfunctionofthe class
► Thecurrentpointerofthe class
► Thecurrentobjectoftheclass(Page390)
► Avalueofthedata member
QuestionNo:10(Marks:1)-Pleasechoose one
Friend function ofa classis .
► Memberfunction
► Non-memberfunction(Page348)
► Privatefunction
► Publicfunction
QuestionNo:11(Marks:1)-Pleasechoose one
Afunctioncandeclareitselfafriendofa class.
23
► True
► False (Page346)
QuestionNo:12(Marks:1)-Pleasechoose one
Overloadeddeleteoperatorfunctiontakesthesameparameterasanargument returned by
new operator function.
QuestionNo:13(Marks:1)-Pleasechoose one
Thesecondparameterofoperatorfunctionsfor<<and>>areobjectsoftheclass for
which we are overloading these operators.
► True (Page453)
► False
Thesecondparametertooperator<<isanobjectoftheclassthatweareoverloadingtheoperatorfor.Similar is the case
for operator >>
QuestionNo:15(Marks:1)-Pleasechoose one
Atemplatefunctionmusthaveonlygenericdatatypes.
► True
► False (Page501)
QuestionNo:16(Marks:1)-Pleasechoose one
Wecannotmakeamemberfunctionofaclassastemplate function.
► True
► False(Page506)
QuestionNo:17(Marks:1)-Pleasechoose one
Whichcharacterisinsertedattheendofstringtoindicatetheendofstring?
► newline
► tab
► null (Page113)
► carriagereturn
QuestionNo:18(Marks:1)-Pleasechoose one
is used for .
24
► calculation
► reading
► assigningvalueto variables (Page372)
► Noneofthegivenoptions.
QuestionNo:19(Marks:1)-Pleasechooseonevuzs
The object maybe usedbothforfileinputandfile output
QuestionNo:20(Marks:1)-Pleasechoose one
Whichofthefollowingfunctioncallingmechanismistrueforthefunctionprototypegivenbelow?
floatfunc(float&);
► Callbyvalue
► Callbyreferenceusingpointer
► Callbyreferenceusingreference variable
► Noneofthegivenoptions
QuestionNo:21(Marks:1)-Pleasechoose one
Theprograms,inwhichweallocatestaticmemory,runessentiallyon
► Heap
► SystemCache
► Noneofthegivenoptions
► Stack (Page280)
QuestionNo:22(Marks:1)-Pleasechoose one
Overloadeddeleteoperatorfunctiontakesparameterofvoidpointerandreturns
.
► void
► voidpointer
► pointertoan object
► pointeroftype int
QuestionNo:23(Marks:1)-Pleasechoose one
Whatshouldbe thereturntype ofthe constructor?
► voidpointer
► int
► sameasobjecttype
► constructorsdonotreturnanything (Page313)
QuestionNo:24(Marks:1)-Pleasechoose one
Itisa wayofreusingthe code whenwecontainobjectsofouralreadywrittenclassesintoa new class,
► True
25
► False
QuestionNo:25(Marks:1)-Pleasechooseonevuzs
Templatesarenottype safe.
► true
► false(Page 518)
QuestionNo:26(Marks:1)-Pleasechoose one
The functionsusedfordynamic memoryallocationreturnpointeroftype
► int
► float
► void
► double
► Two (Page9)
► Three
► Four
► Five
► Different
► Identical
► Twonamesofsamefunction
► Noneoftheabove
►Accordingtodatatype(Page160)
► 1byte exactly
► 1bit exactly
► Apointervariablecannotbeincremented
26
► True (Page437)
► False
►True(Page 433)
► False
► Local
► Global
►Globalorstatic(Page369)
► Noneofthe givenoption
►Class-Nameoperator+(Class-Namerhs) (Page371)
► operatorClass-Name+( )
► operatorClass-Name+( rhs)
► Class-Nameoperator+()
► True
► False (Page476)
► Deletesalltheobjectsof array
►Deletesoneobjectofarray(Page411)
► Do not deleteanyobject
► Resultsintosyntax error
Thisstatementwillcallthedestructoronlyfortheobjectpointedbythearranddeallocatethespaceallocatedto this object
27
► Onlyblock ofmemoryis allocated for objects
► Onlyconstructor iscalledfor objects
►Memoryisallocatedfirstbeforecallingconstructor (Page414)
► Constructoriscalledfirstbeforeallocatingmemory
QuestionNo:11 (Marks:1)- Please choose one
Whatis thesequenceofevent(s)when deallocatingmemoryusingdeleteoperator?
► Onlyblockofmemoryisdeallocatedfor objects
► Onlydestructoriscalledforobjects
► Memoryisdeallocatedfirstbefore callingdestructor
►Destructoriscalledfirstbeforedeallocatingmemory(Page414)
► True
► False (Page414)
► True
►False(Page 446)
►0
► 99
► 100 (Page103)
► 101
28
QuestionNo:17 (Marks:1)- Please choose one
Thenameofanarrayrepresents address offirstlocation ofarrayelement.
► True
► False
The nameofthe arrayisa constantpointerwhichcontainsthememoryisthe addressoffirstelementofthe array
► True
► False
► Thenewoperator determinesthesizeofanobject
► Allocatesmemorytoobject andreturnspointerofvalidtype
► Createsanobject andcallstheconstructor toinitializethe object
►Allofthegiven options
► Functions,operators
► Classes, operators
►Operators, functions (Page342-285)
► Operators,classes
► Non-memberfunctions
►Friendfunctions (Page346)
► Anyfunction outsideclass
► Noneofthe givenoptions
► Friendfunctionmustbedeclaredafterpublic keyword.
► Friendfunctionmustbedeclaredafterprivate keyword.
► Friendfunctionmustbedeclaredatthetopwithinclassdefinition.
►Itcanbedeclaredanywhereinclassasthesearenotaffectedbythepublicandprivatekeywords.
(Page 346)
29
QuestionNo:23 (Marks:1)- Please choose one
TheoperatorfunctionoverloadedforanAssignmentoperator(=)mustbe
► Non-memberfunctionofclass
► Memberfunctionof class (Page372)
► Friendfunctionofclass
► Noneofthe givenoptions
► Objectofoperatorclass
► Objectofdifferentclass
► Built-indatatype
► Allof thegiven options (Page375)
►Memberfunction (Page373)
► Non-memberfunction
► Friendfunction
► Noneofthe givenoptions
► Class-nameoperator+();
► Class-nameoperator+(int);
►Class-nameoperator++(); (Page389 )
► Class-nameoperator++(int);
► True
► False
Parameterizedmanipulatorsrequireoneormorearguments.setfill(nearthebottom
oftheiomanip.hheaderfile)is an example of a parameterized manipulator. You can create your own
parameterized manipulators and your own simple manipulators.
► Heap
► Freestore
► static storage
► stack (Page461)
QuestionNo:1(Marks:1)-Pleasechooseone
IfNumisanintegervariablethenNum++means,
Add1twotimeswithNum
Add1 withNum
Add2withNum
Subtract2fromNum
QuestionNo:2(Marks:1)-Pleasechooseone
Ifthe returntype ofafunctionisvoidthenitmeansthatitwill,
Returnanytypeofdata
Returnsomespecifictypeofdata
Returnnodata
Returnjustcharacterdata
QuestionNo:3(Marks:1)-Pleasechooseone
Whichofthefollowingisavalidclass declaration?
classA{ intx; };
classB {}
publicclassA{}
objectA{intx;};
QuestionNo:4(Marks:1)-Pleasechooseone
31
Whenweusemanipulatorsinourprogramthenwhichheaderfileshouldbeincluded?
iostream.h
stdlib.h
stdio.h
iomanip.h (Page433)
QuestionNo:5(Marks:1)-Pleasechooseone
Wecanalsocreateanarrayofuserdefinedatatype.
True (Page408)
False
QuestionNo:6(Marks:1)-Pleasechooseone
Thenormalsourceofcinobjectis,
File
Disk
Keyboard (Page 424)
RAM
QuestionNo:7(Marks:1)-Pleasechooseone
Astreamisanorderedsequenceofbytes.
True (Page423)
False
QuestionNo:8(Marks:1)-Pleasechooseone
Whatisthesequenceofevent(s)whenallocatingmemoryusingnewoperator?
QuestionNo:9(Marks:1)-Pleasechooseone
We candeleteanarrayofobjectswithoutspecifying[]bracketsifa classisnotdoingdynamicmemory allocation
internally.
True(Page 412)
False
QuestionNo:10(Marks:1)-Pleasechoose one
Thesecondparameterofoperatorfunctionsfor<<and>>areobjectsoftheclassfor which
we are overloading these operators.
True (Page453)
False
QuestionNo:11(Marks:1)-Pleasechoose one
Whichloopingprocesschecksthetestconditionattheendoftheloop?
32
for
while
dowhile
no looping process checks the test condition at the end
http://mathbits.com/MathBits/CompSci/looping/MCLooping.htm
QuestionNo:12(Marks:1)-Pleasechoose one
Inagroupofnestedloops,whichloopisexecutedthemostnumberoftimes?
theoutermostloop
theinnermostloop
allloopsareexecutedthesamenumberoftimes
cannotbedeterminedwithoutknowingthesizeoftheloops
http://mathbits.com/mathbits/java/Looping/MCLooping.htm
QuestionNo:13(Marks:1)-Pleasechoose one
Templateclasscannothavestaticvariables.
True
False(Page 513)
QuestionNo:14(Marks:1)-Pleasechoose one
Considerthefollowingstatementstoinitializeatwo-dimensionalarray.
(ii) only
(iii) only
(ii)and (iii)
and (iii)
QuestionNo:15(Marks:1)-Pleasechoose one
Thereisapointervariablenamedptroftypeintthenaddressofwhichtype ofvariabletheptrwillstoreinit?
variableoftypechar
variableoftypeshort
variableoftypeint
variableoftypedouble
QuestionNo:16(Marks:1)-Pleasechoose one
Letsuppose
UnionintorDouble{ I
nt ival;
Double charvar;
};
main(){
33
intorDoubleVAZ;
int size ;
size=sizeof(VAZ);
}
Whatwillbethevalueofvariable"size",ifintoccupies4bytesanddoubleoccupies8 bytes?
2
4
8
12
QuestionNo:17(Marks:1)-Pleasechoose one
new and delete are whereasmalloc and free are .
Functions,operators
Classes,operators
Operators,functions (Page342-285)
Operators,classes
QuestionNo:18(Marks:1)-Pleasechoose one
The memberfunctionsofa classoccupy region in memoryfor object(s)ofclass.
separate,each
common,all (Page334)
different,each
different,all
QuestionNo:19(Marks:1)-Pleasechoose one
Friend functions are ofaclass.
Memberfunctions
Publicmember functions
Privatememberfunctions
Non-memberfunctions (Page346)
QuestionNo:20(Marks:1)-Pleasechoose one
Whichofthefollowingistruewhileoverloadingoperators?
Precedenceofanoperatorcanbechanged
Thearity(numberofoperands)canbechanged
Nonewoperatorscanbecreated
Associativityofanoperatorcanbechanged
QuestionNo:21(Marks:1)-Pleasechoose one
Whichofthefollowingoptionwillbetruetooverloadthe-=operator?
only-operator needstobeoverloaded(notsure)
Minus(-)and=operatorsneedtobe overloaded
the-=operatorneedtobeoverloadedexplicitly
the-and=operatorsneedtobe overloadedimplicitly
34
QuestionNo:22(Marks:1)-Pleasechoose one
The input/outputstreams;cinandcoutare
Operators
Functions
Objects
Structures
QuestionNo:23(Marks:1)-Pleasechoose one
dec, hex, oct are all
Memberfunctions
Objectsofinput/output streams
Parameterizedmanipulators
Non-parameterizedmanipulators (Page435)
QuestionNo:24(Marks:1)-Pleasechoose one
Whatwillbetheoutputofthefollowingstatement? cout
<< setbase(16) << 52 ;
74
52
34
64
QuestionNo:25(Marks:1)-Pleasechoose one
Thefirstparameterofoverloadedstreaminsertionoperatoris where secondparameteris
inputstream,objectofclass
objectofclass,output stream
outputstream,objectofclass
objectofclass,input stream
QuestionNo:26(Marks:1)-Pleasechoose one
Wecanalsodoconditionalcompilationwithpreprocessordirectives.
True (Page272)
False
QuestionNo:27(Marks:1)-Pleasechoose one
Withuser-defineddatatypevariables(Objects),selfassignmentcanproduce .
Syntaxerror
Logicalerror
Linkerror
Nonofthegivenoptions
QuestionNo:28(Marks:1)-Pleasechoose one
The returntype ofthe operatorfunctionfor>>operatoris .
35
classforwhichweoverloadthis operator
referenceofostreamclass(ostream&)
referenceofistreamclass(istream&)
void
QuestionNo:29(Marks:1)-Pleasechoose one
Whenanobjectofa classisdefinedinside anotherclass then,
Constructorofenclosingclasswillbecalledfirst (Page496)
Constructorofinnerobjectwillbecalledfirst
ConstructorandDestructorwillbecalledsimultaneously
Noneofthegivenoptions
QuestionNo:30(Marks:1)-Pleasechoose one
Wherewecanincludeaheaderfileinthe program?
anywhere (Page270)
in start
atthe end
noneofthegivenoptions.
36