Sie sind auf Seite 1von 30

Chapter-1 1) a) . is inventor of C++.

Dennis Ritchie b) Bjarne Stroustrup c) George Boole d) George Cantor

2)

is collection of instance variable and method.

a)Function b) tructure c) Class d)!nion ") a) %) a) +) a) .) 'da is an identifiable entit# $ith some characteristics and behavior. Class b) Object c) Function d) Constructor

is su&erset of C. b)Fortran c) C ++ d) () * is the e,tension of C++. .ob- b) .cpp c) .c d).e,e

Compiling,linking and running are three ste&s in e,ecution of C++ &rogram.

a)binding lin/ing running b)lin/ing e,ecuting running c) compiling linking running d)none of these

0)1ver# statement in C++ ends $ith a 2222222222222222 a) comma b) colon c) semicolon d) 3uotion 4) tate true or false

a)1ver# C++ &rogram should have &rotot#&e function.25rue b) 6e use clrscr7) function to clear out&ut of further &rogram.2 5ure 8) a) ame method name but $ith different &arameter is /no$n as ___________ overriding b) overloa ing c) inheritance d)abstraction

1!) tate true or false

a) C++9-ava9cshar&9smalltal/ )s an ::* language.25rue 11) a) #nta, error error can be traced using debug tool in the editor. b) "ogical error c) lin/er error d)none of these

1#) a)

error occurs $hen the files during lin/ing are missing or miss&elt. #nta, error b) logical error c) linker error d) none

1") tate true or false b) C++ &rogram goes through t$o &hases i.e. com&iling and lin/ing before e,ecution. $%true&'alse) c) ;ariable names are not case sensitive.$true&%'alse)

Chapter-# 1) a) 2) tate true or false 5$o t#&es of control statement in C++ are selection < iteration statements.25rue tate true or false

a)=ulti&le conditions can be chec/ed using logical << o&erator7'>D) and ?? o&erator7:R ). $%true&'alse ") tate true or false b) 5he absence of the brea/ statement cannot cause e,ecution of statements in the ne,t case.$true&%'alse) %) 5hree loo& statements in C++ are (hile loop, o (hile loop )'or loop. a) b) c) d) For each 9 for9 do2$hile *hile, o (hile ) 'or loop For 9$hile9 for each >one +) 222222222222222 Control statement is com&act and clear in s&ecification. a) +or loop b) $hile c) do2$hile d)for each .) tate true or false

a)Conditional o&erator is an alternative to if statement.$%true&'alse) 0) tate true or false a)Do$hile loo& $ill be e,ecuted at least once even if the condition is false . $true&%'alse) ,) a) 8) statement ta/es the control to a &articular statement. Brea/ b) Continue c) go to d) $hile tate true or false a)Go to function in a &rogram ta/es the control out of the &rogram.$true&%'alse)

1!) tate true or false b)1@)5 statement ta/es the control out of the loo&.$true&%'alse) 11) a) >ested -+ can be avoided b# using 1lse b) loo& c) s(itch d)function statement is used to transfer control to the ne,t iteration in b) continue c) 1,it d) Goto Chapter-. statement.

12) &rogram. a) Brea/

1)

are datastructures that allo$ to store data of same datat#&e.

a) tructure b) !nion c) /rra0 d) tring 2) 1ver# string has a string. as its last characters $hich mar/s the end of the

a) tring character b) Bac/slash c) 1ull character d)>one ") 'rra#s of the basic datat#&es such as integers9charactersetc and datat#&es such as structure9ob-ects can be defined. a) %) a) *redefined b) 2ser e'ine c) both a and b d)none

're used to store large volumes of similar data together. tructure b) Function c) !nion ) /rra0

+) 5he elements can be accessed b# s&ecif#ing arra# name follo$ed b# the number $hich indicates the &osition of the element in the arra#. a) .) a) 0) *ointer b) /rra0 c) tructure d) tring

are character arra#s that handled sligltl# different than arra#s. Character b) 'rra# c) both a and b tate true or false )String

'n arra# declared as a31!4 can store ten integers.$%true&'alse) ,) State ture or 'alse a354 indicates the 7fifth)+th integer in arra# list.$'alse) 8) strlen function is used to find the length of the string. a) tringlength b) strlen c)stringlen d) stringlen

1A) ------------------ function arranges the characters in the string variable in reverse order e,ce&t for the null character. a) tringrev b) trirev c) strrev d) stringreverse function can be used if t$o strings have to be com&ared $ithout case b)Strcmpi c)both a and b) d) >one

11) sensitiveness. a) trcm&

Chapter-6,5 1) BBBBBBBBBBB&rovide an eas# means to organiCe the &rogram into smaller modules and use them $ithout re2$riting all the code. a) 2) +unctions b)structure c)union d) none

/rguments are in&ut to the functions and are used inside the function. b)function c) /rguments d) data t#&e

a)declaration ")

1ver# BBBBBBBBBBBfunction should be declared in the &rogram before it is used. b) user- e'ine c)function d)s3uare

a)declaration

%) 5he variable number has sco&e onl# inside the function fact and is /no$n as BBBBBBBBBBBBBB. a)function b)number c)value ) local variable.

+) Data can be &assed to functions in ________$a#s one method is BBBBBBBBBBB'nd another method is BBBBBBBBBBBBBBBBBBBB. a) 7(o, passing b0 value, passing b0 re'erence. b) &assing b# reference9 t$o9 &assing b# reference. c) &assing b# value9 &assing b# reference9 t$o. d)none .) =ore than one user defined functions can have same name and &erform different o&erations is /no$n as 'unction overloa ing. a)im&lement 0) b)overloaded c) 'unction overloa ing. d) Function

1ver# overloaded functions should have a different &rotot#&e.

$%true&'alse)

4)

'utomatic variable is default variable in C++.

$%true&'alse) 8) B# default automatic variables are not initialiCed to an# s&ecific values unless and until s&ecified.7Dtrue&'alse) 1A) 1,ternal variables are variables local to an# function

$true&%'alse) 11) tatic variables are mi,ed of e8ternal and automatic variables. b)automatic9 e,ternal c)data9 automatic d) automatic9 data.

a) 98ternal, automatic 12)

1,ternal variables have a life of the fileE&rogram in $hich the# are defined

$%true&'alse) 1") Structures are a grou& of dissimilar data that are related $ith each other. b)&ointer c)string d)function

a) Structures

1%)

tructure variables can be initialiCed during declaration.

$%true&'alse) 1+) a)data BBBBBBBBBBBBare good mechanism of creating user defined data t#&e. b)&ointer c) Structures d)none

1.) C++ s&ecifies another method /no$n as BBBBBBBBBBBBBBBBBBdata t#&e to enable user to create their o$n datat#&e. a) 9numerate b) automatic c)arithmetic d)data t#&e

10) BBBBBBBBBBBBBdata t#&e can store fi,ed set of values and #ou can &erform airthematic on them as $ell. a)declaration b) 9numerate c)string d)none

14) _________an ___________ data t#&es enables to users to create user defined data t#&es. a) structures an enumerate c)assigned d)none b) enumerated and structures

18) BBBBBBBBBBBdata t#&e create data t#&es that can store &re2defined and fi,ed set of values. a)declaration b)integer c)&ointer ) 9numerate

2A) BBBBBBBBBfunction enables &rogrammers to save &rocessing time b# reducing the overheads involved in function call. a) -nline b) return c)class Chapter-5 1) Classes &rovides users a method to create user defined data t#&e. b)data t#&e c) Classes d)structure d)none

a)ob-ect 2)

5$o t#&es of user defined data t#&es are BBBBBBBBBand BBBBBBBBBBB. b) structure an enumerate

a) 1numerated and structure c) class and ob-ect ")

d)inline and structure

__________enable #ou to bind data and functions that o&erate on data together. b)data t#&e c)ob-ect d)method

a) Classes %)

___________is an instance of a class.

a) Object

b)class definition

c)inheritance d)function

+) Class is a definition9BBBBBBBBBBBB is used in the &rogram that enables #ou to store data and use them. a)data t#&e b)class c) object d)&rivate

.)

' the ob-ects of a class share the function.

7Dtrue&'alse) 0) >o se&arate co&# of the methods is created for each and ever# ob-ect.

$true&'alse) 4) :b-ects can access the data through the methods

$%true&'alse) 8) 5he methods defined in the class can onl# be invo/ed b# the ob-ects of the class.

%true&'alse) 1A) 6ithout an ob-ect9 methods of the function can be invo/ed.

$true&%'alse) 11) 5o invo/e a method BBBBBBBBBBBBBBBBBBBBBBBis used. b)class name. ob-ect name d)iste/har name. Far/hit name.

a) Object name. metho name c) method name. strut name

12) BBBBBBBBBBBBBBBBare member functions of a class $hich have same name as the class name. a)declaration b)argument c) Constructors d)overloaded

1") )n a class9 the data and functions are ______b# default soBBBBBBB /e#$ord can be omitted. a) :rivate, private d) &rivate9 data t#&e 1%) b) &rivate9 class c)&ointer9 class

BBBBBBBBBBBBBare called automaticall# $henever an ob-ect of the class is created.

a) Constructors

b) instructor

c) destructor

d) strength

1+) BBBBBBBBBBBBBB are also member functions $ith the same name as class but are &refi,ed $ith tilde7G) sign to differentiate it from the constructor. a) tructure b) estructors c) argument d) dee&a

1.) BBBBBBBBBBBBBBBB are invo/ed automaticall# $henever the ob-ectHs life e,&ires or is destro#ed. a) *roduct b) scoot c) tractor ) estructors

10) ;estructors can be used to return the memor# bac/ to the o&erating s#stem if the memor# $as d#namicall# allocated. a) =odule b) estructors c) creature d) ligature

14) a) 18) a)

________________ u&on the argument that is &assed. Constructors b) c) d)

;estructors cannot be overloaded and cannot Fave an# argument. b)

2A) Static data member of the class is one data member that is common for all the ob-ects the class and are accessible for the class. 21) tatic functions are also defined b# &refi,ing the /e#$ord static.

22) Static 'unction is called using class name follo$ed b# sco&e resolution o&erator and function name.

Chapter-< 1) everal o&erators such as dot o&erator 9sco&e resolution7II) o&erator9 conditional7JI) o&erator cannot be overloaded. $%true&'alse) 2) ") !nar# o&erators are im&lemented $ith no arguments.

Binar# o&erators are those that $or/ on t$o arguments.

$true&%'alse)

%) :verloading binar# o&erators are different from overloading unar# o&erators mainl# in terms of the $a# it is invo/ed and arguments &assed. $%true&'alse) +) 6hen #ou overload binar# o&erators9 the o&erand to the le't of the o&erator calls the o&erator and the o&erand to right of the o&erator is &assed as an argument. .) Overloa ing should be used onl# to im&l# default meanings to avoid confusion in its usage. 0) >ot all the o&erators can be overloaded.

$%true&'alse) 4) 5he return value of integer t#&e7A or1) indicating su&&ort to create Boolean data t#&es. 8) true or 'alse or some com&ilers

=ember functions are declared inside the class but not are defined outside the class.

$true&%'alse) 1A) ' function is made friend -ust b# &refi,ing /e#$ord $ithin the class definition. 'rien in the function declaration

11) !nar# o&erators li/e increment and decrement o&erators cannot be com&letel# du&licated. $%true&'alse) 12) Compiler cannot differentiate bet$een &ost and &re incrementEdecrement o&erators.

Chapter-< 1) -nheritance allo$s reuse of code $ithout modif#ing the original code.

2) -nheritance feature has enabled to disturbed class libraries $hich allo$s the &rogrammer to use the standard code develo& b# some another com&an#. ") -nheritance is the &rocess of creating ne$ classes /no$n as derived classes from the e,isting or base class. %) 5he chil class has all the functionalit# of &arent class and has additional functionalities of its o$n. +) .) 5he data members in a class are usuall# declared private . :rivate members cannot be access b# the inherited class member function.

0) :rotecte access s&ecifies allo$ data members to be accessed b# the member functions of inherited class but does not allo$ to be accessed from e,ternal &rograms. 4) 5he accessibilit# of base class members are also de&endent on the t#&e of inheritance private or public . 8) Function of the derived class can access &ublic and &rotected members of the base class but not the &rivate members of the base class. $%true&'alse) 1A) 6hen both the base class and derived class has a function $ith same name the ob-ect. function name statement $ith the base class ob-ect $ill al$a#s access the function defined in the base class as/ the base class does not /no$ an#thing about the derived class. $%true&'alse) 11) )nheritance can also be multilevel inheritance $here another class is derived from the derived class. $%true&'alse) 12) 5he derived class can also have multi&le &arents $hich is /no$n as multi&le b)

a) -nheritance 1")

Child class inherits all the &ro&erties of all its &arents.

$%true&'alse) 1%) =ulti&le inheritance is im&lemented same as single inheritance e,ce&t that both the &arent names have to be s&ecified $hile defining the class. $%true&'alse) 1+) if the derived class is derived &rivatel# than ob-ect of the derived class can access the &ublic member function of the base class. 7true&%'alse) 1.) pointers are sometimes the most confusing conce&t in C and C++. b)

a)string

10) 1ver# variable created in a &rogram has an address $hich s&ecifies its location in the s#stemHs memor#. $%true&'alse) 14) 5he statement CoutKK<numL the &rogram $ill dis&la# BBBBBBBBBof the variable num $hich $ill be aBBBBBBBBBBBBBBB number.

a) he,adecimal9 address d)union9 &ointer 18) 2A)

b) a

ress, he8a ecimal

c) &ointer9 union

:ointers are variable that stores address values of the other variables. :ointers are defined b# &refi,ing a D to the variable name.

21) 5he data t#&e of a &ointer variable can be an# of the basic or user2defined data t#&e or even void. $%true&'alse) 22) ' &ointer if defined as of a &articular data t#&e then it can store address of variables of that data t#&e onl#. $%true&'alse) 2") >e$ o&erator in C++ allo$s MthisN similar to malloc in C.

2%) >e$ re3uest the memor# of s&ecific siCe from the s#stem during runtime and returns the address of the first element in the arra#. 2+) *ointer can &oint to user2defined ob-ects as $ell.

7DtrueEfalse) 2.) 5o access the member functions through the &ointer there is sim&le o&erator2O $hich is /no$n as membershi& access o&erator. 20) 1ver# node stores data and lin/ to the ne,t node in the te,t.

7DtrueEfalse) 24) 1ver# ob-ect has a default &ointer /no$n as this &ointer.

7DtrueEfalse) 28) 'll the member functions have access to this &ointer.

7DtrueEfalse)

2nit , multiple inheritance, virtual 'unctions an pol0morphism 1. Diagram arises $hen both the &arent classes have been derived from a single &arent class. 2. ;irtual means e,isting in effect but not in realit#.

". %. +. .. 0.

;irtual functions are &rimaril# used in inheritance. ;irtual functions are for -ust name sa/e and $ill not be e,ecuted man# a times. ' &url virtual function is one $hich does not have an# bod#. trueEfalse. uch classes $hich do not have an# ob-ects are /no$n as abstract classes. :ol0morphism means same content but different frome.

4. )n c++9 pol0morphism enables the same &rogram code calling different function of different classes. 8. ' t#&e of &ol#mor&hism $hich allo$s the same o&erators to behave differentl# $hit different data t#&esEo&erands. 1A. 11. ;irtual function in base class hel&s to im&lement &ol#mor&hism in c++. 'bstract classes are classes $ithout an# ob-ects.

2nit =- >,1!,11,1.
1. 2. ". %. Feader file 'stream.h contains declarations for classes used for dis/ file )E:. Streams are name given for flo$ of data. 5he# are logical abstraction bet$een user and the e,ternal device. 1ach stream is associated and re&resented through a class in C++.trueEfalse.

+. 'll streams behave in the same $a# even though the# are connected to different devices. trueEfalse. .. ome of the function such as get 7)9 get line 7)9 read and overloaded e,traction 7OO) o&erators are defined in istream class. 0. 6hile ostream class $hich is also derived from ios class.

4. 5he class i'stream $hich is inherited from both istream and fstrambase is used for in&ut files. 8. Class o'stream $hich is inherited from both ostream and fstreambase is used for out&ut files. 1A. 5he class 'stream inherited from both iostream and fstrambase is used for files that $ill &erfrom both in&ut and out&ut. 11. 5he file 'stream.h also includes oistream.h9 so the &rograms using fstream.h need not e,&licitl# include iostream.h.

12. 1". 1%. 1+. 1.. 10.

5he function &ut 7) is used $hit the ob-ect to $rite to the file. trueEfalse. / te8t 'ile is created in the out&ut director# s&ecified in #our com&iler. 5he function get $) reads one character at a time. 5he function get $) and get line $) is used $hit the ob-ect to read the file. 9o'$) member function is used to chec/ end of file condition. 5he get line $) function reads line b# line.

14. Comman line arguments are useful to &ass argument to the &rogram $hile running the &rogram. 18. 2A. 21. 22. 1522 Commend line arguments are used $hen invo/ing the &rogram from D: .trueEfalse 5here are t(o default variables argc of t#&e int and arvg. Dist in&ut and out&ut is handled is c++ using an hierarch# of stream classes. trueEfalse. Cin and cout are &redefined ob-ects of stream classes. true&'alse.

!nit 1 elf 'ssessment Puestions 1. (ist the limitations of &rocedural languages 2. BBBBBBB is an ::* (anguage ". )n ::* a&&roach &rogrammers can create their o$n data t#&es. 5rueEFalse %. )n &rocedural languages9 the &rograms are $ritten b# dividing the &rograms into smaller units /no$n as BBBBBBBBBB +. BBBBBBBBBBBBB feature in ::* allo$s to reuse code. .. 5he conce&t of bundling data and functions into single unit is termed as BBBBBBBBBBB 0. :b-ect is an BBBBBBBBBB of a class 4. Give an e,am&le of a class and an ob-ect

8. BBBBBBBBBBBBBB is an advantage of ::* a&&roach 1A. BBBBBBBBBBBBBB is a header file used in c++ that handles in&ut and out&ut functions. 11. BBBBBBBBBBBB statement is used to in&ut data from the user in c++. 12. BBBBBBBBBBBBBB statement is used to dis&la# data on the dis&la# screen in c++. 1". BBBBBBBBBBBBBB is a master function re3uired in all C++ &rogram and &rogram e,ecution begins from the first statement of this function. 1%. BBBBBBBBBBB9 BBBBBBBBBBBBBB and BBBBBBBBBBBBB are &hases in e,ecution of a C++ &rogram 1+. 5he logical error is identified b# the com&iler. 5rueEFalse 1.. BBBBBBBBBBBBBBBB is the e,tension of C++ &rogram source files 10. BBBBBBBBBBBBBBBB is the e,tension of C++ ob-ect code 14. )n if else statement9 at an# &oint of time statements in both the if and else &art ma# be e,ecuted. 5rueEFalse 18. Conditional o&erator is an alternative to BBBBBBBBBB statement 2A. ++ o&erator increments the value of the o&erand b# BBBBBBBBB 21. 5he ++ o&erator used as &ostfi, and &refi, has the same effect. 5rue or False 22. 1ach case in s$itch statement should end $ith BBBBBBBBB statement 1.8 'ns$ers elf 'ssessment 1. (imitations of &rocedural languages are no im&ortance to data and inabilit# to define user defined datat#&es and define functionalit# for the same 2. C++9 smalltal/9 Qava are all ::* (anguages

". 5rue %. Functions or &rocedures +. )nheritance .. Data 'bstraction 0. :b-ect is an instance of a class 4. Class 2 car and ob-ect R =aruti 4AA 8. Reusabilit# of code 1A. iostream.h 11. cin 12. cout 1". main7) function 1%. Com&iling9 (in/ing and Running 1+. False9 it can assist in identif#ing using debug tool 1.. .c&& 10. .ob14. False 18. if statement 2A. one value 21. False 22. brea/ statement.

!>)5 2 elf 'ssessment Puestions 1. 6hich of the follo$ing loo& $ill be e,ecuted atleast once even if the condition is false. a. For loo& b. $hile loo& c. do..$hile loo& d. >one of the above

2. BBBBBBBBBBB is the loo& variable in the loo& for7int /SnL/TSAL/S/22) ". 5he loo& for7int iSALiKnLi++) $ill be e,ecuted till the statement BBBBBBBBB becomes false. %. )f there is more than one statements inside a loo&9 then the statement should be enclosed $ithin BBBBBBBBBBBBBB +. BBBBBBBBB statement ta/es the control out of the loo&. .. BBBBBBBBBB header file should be included to use e,it function 0. BBBBBBBBBB statement ta/es the control to the beginning of the loo&. 4. BBBBBBBB statement ta/es the control to a &articular statement 8. 'rra#s grou& data of BBBBBBBBBB t#&e 1A. 'n arra# declared as int aU1AV can store BBBBBBBBBB integers 11. aU+V re&resents the BBBBBBBBB integer in the arra#. 12. 'rra# elements are accessed through BBBBBBBBBBBBBBB 1". 'n arra# $ith the declaration int ,U%VU+V can store BBBBBBBB numbers 1%. )n the above arra# the number in the third ro$ and fourth column can be accessed b# BBBBBBBBBBBB 1+. int aU V U V is a valid declaration. 5rueEFalse 1.. char strU VL is a valid statement. 5rueEFalse 10. char strU2AV $ill allo$ ma,imum of BBBBBBBB characters to stored in the string. 14. BBBBBBBBB member function of cin allo$s user to in&ut embedded blan/s and linefeed $ithin the string. 18. BBBBBBBBB libra# function can be used to co&# the contents of one string to another string. 2.8 'ns$ers elf 'ssessment Puestions

1. do..$hile loo& 2. / ". iKn %. statements should be enclosed in flo$er brac/ets W X +. brea/ .. &rocess.h 0. continue 4. go to 8. same 1A. ten 11. si,th 12. arra# name follo$ed b# inde, number in s3uare brac/ets 1". 2A 1%. aU2VU"V 1+. False 1.. False 10. 18 characters 14. get7) 18. strc&#7)

!>)5 " elf 'ssessment Puestions 1. Functions enable to reuse code. 5rueEFalse 2. void &rint7) $ould return BBBBBBB value ". BBBBBBBB statement is used to return value to the main &rogram. %. Function call should al$a#s contain function name follo$ed b#

&aranthesis even if there are no arguments. 5rueEFalse +. 5he values in the original variable remain unchanged during BBBBBBBB t#&e of function call .. 5he advantage of &assing b# reference is BBBBBBBBBBBBB 0. 5he feature of C++ $hich enables t$o or more functions to have same name but different &rotot#&es are /no$n as BBBBBBBBBBB 4. Default values for the arguments have to be s&ecified during 8. )nline functions hel& in saving BBBBBBBBBBBBBB of &rograms 1A. tatic variables are initialiCed to BBBBBBBBB automaticall#.

11. 1,ternal variables are accessible throughout the BBBBBBBBB. 12. tructures grou& data of similar t#&e. 5rueEFalse

1". BBBBBBBBBBB /e#$ord is used to create structures. 1%. =ember data of the structure are accessed b# BBBBBBBB o&erator

".4 'ns$ers elf 'ssessment Puestions 1. 5rue 2. no value ". return %. 5rue +. &assing b# value .. returning multi&le values and modif#ing original values 0. Function overloading 4. declaration 8. e,ecution time 1A. Cero

11. *rogram file 12. False 1". struct 1%. dot o&erator 7structure variable name.member name)

!>)5 %

elf 'ssessment Puestions 1. *rivate data members can be accessed onl# b# the BBBBBBBBBB of the class 2. *ublic data members can be accessed directl# in the main function $ithout an ob-ect. 5rueEFalse ". 1ver# ob-ect of a class has its o$n co&# of the data and functions. 5rueEFalse %. BBBBBBBBBBBBBBBBBB &ointer stores the address of the class instance. +. BBBBBBBBBBBBBBBBB /e#$ord grants access to non2member functions or to another class. .. 5he BBBBBBBBBBBB and BBBBBBBBBBBBBBBBBBBB /e#$ords do not a&&l# to friend functions. 0. tatic data member of a class can be modified b# all ob-ects of the

class. 5rueEFalse 4. 8. tatic functions are accessed using BBBBBBBBBB tatic data need not be initialiCed. 5rueEFalse

'ns$ers elf 'ssessment Puestions

1. member functions 2. False ". False9 onl# se&arate co&# of data9 but not functions %. 5his +. Friend .. &ublic and &rotected. 0. 5rue 4. class name and sco&e resolution o&erator 8. False !>)5 + elf 'ssessment Puestions 1. &ecial member function $hich has the name as class called as

BBBBBBBBBBBBBBBB. 2. )f no constructor is su&&lied then BBBBBBBBBBBBBBBB one is created b# com&iler. ". Constructors never be virtual state U5rueEFalseV. %. BBBBBBBBBBBBBBBB constructor is used to create instances of that class. +. )m&licit calling of constructor can be avoided b# adding the BBBBBBBBBBBBBBBBBBBB 3ualification .. Destructor ta/es arguments and returns value state U5rueEFalseV 0. 5he destructor for a BBBBBBBBBBBBBBBBBBBBBBis called before destructors for members and bases are called. 4. ' destructor can be declared virtual or &ure virtual state U5rueEFalseV 8. BBBBBBBBBBBBBBBB o&erator can be used to invo/e destructor. 'ns$ers elf 'ssessment Puestions

1. Constructor 2. Default ". 5rue %. Class +. 1,&licit .. False 0. class ob-ect 4. 5rue 8. delete

!>)5 . elf 'ssessment Puestions 1. :&erator overloading feature hel&s to change the functionalit# of o&erators $ith an# datat#&e. 5rueEFalse 2. You can overload all o&erators in C++. 5rueEFalse ". )t is necessar# to overload o&erators for all classes. 5rueEFalse %. !nar# o&erators are im&lemented $ith BBBBB arguments. +. !nar# o&erators should have return value as BBBBBBBB. .. !nar# o&erators overloaded for the class can differentiate bet$een &ost and &re o&erators. 5rueEFalse 0. =ember functions of a class can be defined outside the class using BBBBBBBB o&erator along $ith the class name. 4. BBBBBBBBB functions are e,ternal functions that can access &rivate data members of a class. 8. :verloaded relational binar# o&erators should return BBBBBBBBB. 1A. (eft o&erand calls the o&erator in case of binar# o&erator. 5rueEFalse.

'ns$ers 1. 5rue 2. False ". False %. >o +. ame as class datat#&e

.. False 0. sco&e resolution o&erator 4. Friend Function 8. )nteger or Boolean values 1A. 5rue

!>)5 0 elf 'ssessment Puestions 1. 5he derived class ob-ect can access BBBBB members of the &arent class. 2. 5he derived class member functions can access BBBBBBBBBBBBB members of the &arent class ". )nheritance allo$s BBBBBBBBBBB of the &rogram code. %. 6hen the derived class has more than one &arent it is /no$n as BBBBB. +. )n BBBBBBBBBB inheritance9 ob-ects of derived class cannot access &ublic member functions of the base class .. ' class can be derived further from the derived class. 5rueEfalse 0. *ointers are variables that store BBBBBBBBBBBB. 4. BBBBBBBBBBBB o&erator can be used to re3uest memor# from the s#stem during runtime.

8. 5he memor# allotted d#namicall# should be returned to the s#stem using BBBBBBBB o&erator. 1A. 5he default &ointer that &oints to the ob-ect is /no$n as BBBB &ointer. 11. 5he member functions of a class can be accessed through the &ointers using BBBBBBBB o&erator. 12. 5he &ointer variables can be members of a class. 5rueEFalse.

'ns$ers 1. &ublic 2. &ublic and &rotected ". reusabilit# %. =ulti&le )nheritance +. *rivate )nheritance .. 5rue 0. addresses 4. ne$ 8. delete 1A. this 11. 2O o&erator 12. 5rue

!>)5 4

elf 'ssessment Puestions 1. )n case of multi&le inheritance9 the child class has a co&# of data of all the &arent classes. 5rueEFalse

2. 5he &roblem of diamond inheritance ambiguit# is resolved b# declaring the child classes as BBBBBBBBBBBB ". )n multi&le inheritance if the both the &arent class 7' and B) have same function and child class 7C) does not have that function9 then the $hich function is called a. Class ' b. Class B c. Fave to be s&ecified e,&licitl# d. >o function $ill be called %. Base class functions $hich does not have an# bod# is /no$n as BBBBBBB. +. 5he &rocess of deciding $hich class function to be called during runtime is /no$n as BBBBBBBBBBBBBBBBBBBBBBB .. 5he classes $hich do not have an# ob-ects are /no$n as BBBBBBBBBBB 0. ' &ointer to a base class can &oint to the ob-ects of a derived class. 5rueEFalse 4. )f there is a &ointer &9 to the ob-ects of a base class and it contains the address of an ob-ect of a derived class9 and both classes contain a virtual member function9 ding7)9 then the statement &2Oding7)L $ill cause the version of ding7) in the BBBBBBBBBBBBBBBB class to be e,ecuted 8. *ol#mor&hism in C++ is im&lemented through BBBBBBBBBBBBBBBB. 'ns$ers elf 'ssessment Puestions 1. 5rue 2. ;irtual Base class ". Fave to be s&ecified e,&licitl#

%. *ure virtual functions +. (ate binding or d#namic binding .. 'bstract classes 0. 5rue 4. Derived 8. ;irtual functions

!>)5 8

1. cin is a &redefined ob-ect of BBBBBBBBBBBBB class 2. BBBBBBBBBBB header file has to be included for file in&ut and out&ut. ". cout is a &redefined ob-ect of BBBBBBBBBBBB class. %. BBBBBBBBBB is class ob-ect is used to read data from dis/ files +. BBBBBBBB class ob-ect is used to $rite date into dis/ files .. BBBBBBBBBB functions reads data from files line b# line 0. BBBBBBBBB function $rites data into files character b# character 4. BBBBBBBBBB is the &redefined filename assigned to &rinter b# D: 8. BBBBBBBB variable holds the count of command line arguments. 1A. BBBBBBBBBBB ob-ect is created to send an# content to &rinter. 1. istreamB$ithassign 2. fstream.h ". ostreamB$ithassign %. ifstream +. ofstream .. getline7) 0. &ut7)

4. *R> 8. argc 1A. ofstream !>)5 1A elf 'ssessment Puestions 1. ' BBBBBBBBBBBBBBBBis an abstraction that re&resents a device on $hich in&ut and out&ut o&erations are &erformed. 2. 5he base of the iostream librar# is the hierarch# of BBBBBBBBBBBBBBBBBBBBBBBBBB . ". =ani&ulators are global functions designed to be used in con-unction $ith insertion of BBBBBBBBBBBB and BBBBBBBBBB o&erators. %. F&os is a stream &osition class tem&late tate U5rueEFalseV. +. BBBBBBBBBBBBBBB and BBBBBBBBBBBBBBBBBBBBBBB are the t$o &osition associated $ith o&ening of file .. 5o connect the ifstream ZinBstreamZ to the file Ztest.t,tZ inBstream.o&en7Z5est.t,tZ) statement is used U5rueEFalseV 0. :fstream means BBBBBBBBBBBBBBBBBBBBBBB 4. BBBBBBBBBB function used to close the stream. 'ns$ers elf 'ssessment Puestions 1. tream

2. class tem&lates ". 7KK) 7OO) %. 5rue +. Current reading and $riting &osition. .. 5rue

0. out&ut of stream 4. Close7) !>)5 11 elf 'ssessment Puestions 1. BBBBBBBBBBBBBBBBBBB and BBBBBBBBBBBBBBB are the methods su&&orts to& o&en a file. 2. iosIIa&& su&&orts a. :&en file to read c. :&en to a&&end b. :&en file to $rite d. >one of the above

". the function see/g7) $ill &ut the inside2&ointer to a s&ecific &lace U5rueEFalseV %. 5he function bad7) returns true9 if the badbit flag is u& U5rueEFalseV. +. &ecif# t$o methods $hich deals $ith character one b# one in )E:

o&eration. .. 5o read a bloc/ of data from the file BBBBBBBBBBBBBBB function is used. 0. $hen $e read a file9 and $e $ant to get the current &osition of the &ointer9 $e should use BBBBBBBBBBBBBBBBBB 4. BBBBBBBBBBBBBBBBBB function can be used $ant to ignore certain amount of characters $hile reading. 8. BBBBBBBBBBBBBBBBBB identifier is used to &roduce desired effect in streams. 1. :&enfile9 o&en 2. :&en to a&&end ". 5rue %. 5rue +. Get7)9 &ut7)

.. Read7) 0. tellg77) 4. )gnore7). 8. =ani&ulator. !>)5 12

elf 'ssessment Puestions 1. BBBBBBBBBBBBB is the &arameter used in tem&late for an# t#&e. 2. 5he declarations and definitions of class tem&late need to be in the same header file U5rueEFalseV. ". 5em&late functions are different from normal functions onl# $ith the BBBBBBBBBBBBBBBBBBB /e#$ord. %. ' class generated from a class tem&late is called BBBBBBBBBBBBBBBBB. +. )nstantiating virtual member functions of a class tem&late instantiationU5rueEFalseV .. C++ allo$s #ou to s&ecif# a default tem&late &arameterU5rueEFalseV 0. BBBBBBBBBBBBBBBBBBBBBBBBBB cannot be s&ecified in a declaration or a definition of a s&ecialiCation 4. 5em&lates are com&iled $hen re3uired. U5rueEFalseV. 'ns$ers elf 'ssessment Puestion 1. 5 2. 5rue ". 5em&late %. generated class +. False

.. 5rue 0. Default arguments 4. 5rue !>)5 1" elf 'ssessment Puestions 1. BBBBBBBBBBBBBBBBBBBBBBB are li/e location s&ecifiers for containers or streams of data. 2. 5he 5( includes classes that overload the function o&erator

BBBBBBBBBBBBBB function. ". 5here are BBBBBBBBBBBBBBB t#&es of se3uence containers in the 5(. %. 5he de3ue has similar &ro&erties as vector U5rueEFalseV +. )n 5( BBBBBBBBBBBreturns an iterator &ointing to an element -ust after the last element. .. Fo$ mana# categories are there for iterator. 'ns$ers elf 'ssessment Puestions 1. )terators 2. 7o&erator7)) ". 5hree %. 5rue +. end7) .. Five !>)51% elf 'ssessment Puestions 1. 5he handlers must a&&ear directl# after the BBBBBBBBBBBBBBB bloc/ 2. 1ach catch clause ta/es BBBBBBBBBBBBB argument. ". Fo$ man# models are there in e,ce&tion handling theor#.

%. e,ce&tion handler is e,&ected to do something to rectif# the situation is called BBBBBBBBBBBBBBBBBBBBBB +. 5he e,ce&tion s&ecification reuses the /e#$ord thro$ U5rueEFalseV .. the thro$ causes the e,ce&tion to go to the e,ce&tion handlers in the BBBBBBBBBBBBBBBBBBBBBBBBB 0. )f no handler at an# level catches the e,ce&tion9 is called as BBBBBBBBBBBBBBBBBBBBB . 4. BBBBBBBBBBBBBBBBBBBBBBBB re&orts violation of a &recondition. 8. !se e,ce&tions to fi, the &roblem and call the function9 $hich caused the e,ce&tion again. U5rueEFalseV 'ns$ers 1. 5r# 2. ingle

". 5$o %. Resum&tion +. 5rue .. ne,t2higher conte,t. 0. [uncaught\ 4. DomainBerror. 8. 5rue

Das könnte Ihnen auch gefallen