WordPress.com



Id1QuestionEvery class has at least one constructor function, even when none is declared. ATRUEBFALSECDAnswerAMarks1UnitIId2QuestionCan constructors be overloaded? ATRUEBFALSECDAnswerAMarks1UnitIId3QuestionWhat is the difference between struct and class in terms of Access Modifier?ABy default all the struct members are private while by default class members are public. BBy default all the struct members are protected while by default class members are private. CBy default all the struct members are public while by default class members are private. DBy default all the struct members are public while by default class members are protected. AnswerCMarks1UnitIId4QuestionAn abstract class can be instantiated. ATRUEBFALSECDAnswerBMarks1UnitIId5QuestionThe default access level assigned to members of a class is ______APrivateBPublicCProtectedDNeeds to be assignedAnswerAMarks1UnitIId6QuestionThere is nothing like a virtual constructor of a class. ATRUEBFALSECDAnswerBMarks1UnitIId7QuestionWhich of the following operators allow defining the member functions of a class outside the class? A::B?C:?D%AnswerAMarks1UnitIId8QuestionWhich type of class has only one unique value for all the objects of that same class? AThisBFriendCStaticDBoth a and bAnswerCMarks1UnitIId9QuestionWhich one of the following is not a fundamental data type in C++? AFloatBstring CIntDCharAnswerBMarks1UnitIId10QuestionWhat is a constructor? AA class automatically called whenever a new object of this class is created. BA class automatically called whenever a new object of this class is destroyed. CA function automatically called whenever a new object of this class is created. DA function automatically called whenever a new object of this class is destroyed. AnswerCMarks1UnitIId11QuestionUnder what conditions a destructor destroys an object? AScope of existence has finished BObject dynamically assigned and it is released using the operator delete. CProgram terminated. DBoth a and b. AnswerDMarks1UnitIId12QuestionIf a member needs to have unique value for all the objects of that same class, declare the member as AGlobal variable outside class BLocal variable inside constructor CStatic variable inside class DDynamic variable inside class AnswerBMarks1UnitIId13QuestionIf a member needs to have unique value for all the objects of that same class, declare the member as AGlobal variable outside class BLocal variable inside constructor CStatic variable inside class DDynamic variable inside class AnswerBMarks1UnitIId14QuestionWhen class B is inherited from class A, what is the order in which the constructers of those classes are called AClass A first Class B next BClass B first Class A next CClass B's only as it is the child class DClass A's only as it is the parent class AnswerAMarks1UnitIId15QuestionWhich one of the following is not a valid reserved keyword in C++? AExplicit BPublic CImplicit DPrivate AnswerCMarks1UnitIId16QuestionVariables declared in the body of a particular member function are known as data members and can be used in all member functions of the class.ATRUEBFALSECDAnswerBMarks1UnitIId17QuestionIn a class definition, data or functions designated private are accessibleAto any function in the program.Bonly if you know the password.Cto member functions of that class.Donly to public members of the class.AnswerCMarks1UnitIId18QuestionA member function can always access the dataAin the object of which it is a member.Bin the class of which it is a member.Cin any object of the class of which it is a member.Din the public part of its class.AnswerAMarks1UnitIId19QuestionClasses are useful because theyAcan closely model objects in the real world.Bpermit data to be hidden from other classes.Cbring together all aspects of an entity in one place.DOptions A, B and CAnswerDMarks1UnitIId20QuestionFor the object for which it was called, a const member functionAcan modify both const and non-const member data.Bcan modify only const member an modify only non-const member data.Dcan modify neither const nor non-const member data.AnswerDMarks1UnitIId21QuestionDividing a program into functionsAis the key to object-oriented programming.Bmakes the program easier to conceptualize.Cmay reduce the size of the program.DOption B and CAnswerDMarks2UnitIId22QuestionAn expressionAusually evaluates to a numerical value.Bmay be part of a statement.Calways occurs outside a function.DOption A and BAnswerDMarks2UnitIId23QuestionA variable of type char can hold the value 301.ATRUEBFALSECDAnswerBMarks1UnitIId24QuestionIn an assignment statement, the value on the left of the equal sign is always equal to the value on the right.ATRUEBFALSECDAnswerBMarks1UnitIId25QuestionIt’s perfectly all right to use variables of different data types in the same arithmetic expression.ATRUEBFALSECDAnswerAMarks1UnitIId26QuestionA function’s single most important role is toAgive a name to a block of code.Breduce program size.Caccept arguments and provide a return value.Dhelp organize a program into conceptual units.AnswerDMarks1UnitIId27QuestionA function argument isAa variable in the function that receives a value from the calling program.Ba way that functions resist accepting the calling program’s values.Ca value sent to the function by the calling program.Da value returned by the function to the calling program.AnswerCMarks1UnitIId28QuestionWhen arguments are passed by value, the function works with the original arguments in the calling program.ATRUEBFALSECDAnswerBMarks1UnitIId29QuestionWhich of the following can legitimately be passed to a function?AA constantBA variableCA structureDAll of the aboveAnswerDMarks1UnitIId30QuestionHow many values can be returned from a function?A0B1C2D3AnswerBMarks1UnitIId31QuestionWhen a function returns a value, the entire function call can appear on the right side of the equal sign and be assigned to another variable.ATRUEBFALSECDAnswerAMarks1UnitIId32QuestionWhen an argument is passed by referenceAa variable is created in the function to hold the argument’s value.Bthe function cannot access the argument’s value.Ca temporary variable is created in the calling program to hold the argument’s value.Dthe function accesses the argument’s original value in the calling program.AnswerDMarks1UnitIId33QuestionOverloaded functionsAare a group of functions with the same name.Ball have the same number and types of arguments.Cmake life simpler for programmers.DA and CAnswerDMarks2UnitIId34QuestionA default argument has a value thatAmay be supplied by the calling program.Bmay be supplied by the function.Cmust have a constant value.DA and BAnswer1Marks1UnitIId35QuestionA static local variable is used toAmake a variable visible to several functions.Bmake a variable visible to only one function.Cretain a value when a function is not executing.DB and CAnswerDMarks2UnitIId36QuestionIn C++ there can be an array of four dimensions.ATRUEBFALSECDAnswerAMarks1UnitIId37QuestionWhen an array name is passed to a function, the functionAaccesses exactly the same array as the calling program.Brefers to the array using a different name than that used by the calling program.Crefers to the array using the same name as that used by the calling program.DA and BAnswerDMarks1UnitIId38QuestionThe compiler will complain if you try to access array element 14 in a 10-element array.ATRUEBFALSECDAnswerBMarks1UnitIId39QuestionThe extraction operator (>>) stops reading a string when it encounters a space.ATRUEBFALSECDAnswerAMarks1UnitIId40QuestionYou can read input that consists of multiple lines of text usingAthe normal cout <<combination.Bthe cin.get() function with one argument.Cthe cin.get() function with two arguments.Dthe cin.get() function with three arguments.AnswerDMarks1UnitIId41QuestionYou should prefer C-strings to the Standard C++ string class in new programs.ATRUEBFALSECDAnswerBMarks1UnitIId42QuestionObjects of the string classAare zero-terminated.Bcan be copied with the assignment operator.Cdo not require memory management.DBoth B and CAnswerDMarks1UnitIId43QuestionCan destuctors be private in C++?AYesBNoCDAnswerAMarks1UnitIId44QuestionWhat is value of size?A28B32C20D24AnswerCMarks1UnitIId45QuestionWhat value will be printed for data.i?A10 220.5 230.5 Unpredictable Value B220C230.5DUnpredictable Value AnswerDMarks1UnitIId46QuestionA25B30C9D3AnswerBMarks1UnitIId47QuestionA1B3C4D6AnswerAMarks1UnitIId48QuestionWhat is the compilation error for this program?AEach undeclared identifier is reported only once Bcout and cin not declared in scope Cinvalid conversion from int to float DAll of the above AnswerBMarks2UnitIId49QuestionA45B55CArray Sum: 45 DWill not compile AnswerDMarks2UnitIId50QuestionA5B20C15DUnpredictable value AnswerBMarks1UnitIId51QuestionAonly 2 Bonly 1Cboth 1 &2DNone of the above AnswerBMarks2UnitIId52QuestionAcall-2Bcall-1Ccall-3Dcall-1, call-2AnswerBMarks1UnitIId53QuestionWhat will be the output of the program?A1BDefault valueCWill not compileDNone of the above AnswerCMarks1UnitIId54QuestionWhat is the output of the program?A0 0Bx = 0 y = 0C0DCompilation error AnswerDMarks1UnitIId55QuestionWhich function will change the state of the object?AOnly set() BOnly display() Cdisplay() and set() both D None of the above AnswerAMarks2UnitIId56QuestionWhat will be the output of the following program?ACompilation Error: display() cannot be accessed in application BCompilation Error:Test class object cannot be accessed in function Demo CCompilation Error: Variable x is private in Test DBoth A and B AnswerCMarks2UnitIId57QuestionThe only integer that can be assigned directly to a pointer is _________A0B-1C999D-999AnswerAMarks1UnitIId58QuestionWhich of the following feature is not supported by C++?AException HandlingBReflectionCOperator OverloadingDNamespaceAnswerBMarks1UnitIId59QuestionSuppose aand bare integer variables and we form the sum a + b. Now suppose canddare floating-point variables and we form the sum c + d.The two +operators here areclearly being used for different purposes. This is an example of ____________AOperator OverloadingBInheritanceCFunction OverloadingDConstructorAnswerAMarks1UnitIId60QuestionThe operators that cannot be overloaded isA*B-C::D()AnswerCMarks1UnitIId61QuestionEmpty parentheses following a function name in a function prototype indicate that the function does not require any parameters to perform its task.ATRUEBFALSECDAnswerAMarks1UnitIId62QuestionC++ programmers concentrate on creating , which contain data members and the member functions that manipulate those data members and provide services to clients.AStructuresBClassesCObjectsDFunctionAnswerBMarks1UnitIId63QuestionWhich of the following is FALSE about references in C++AA reference must be initialized when declaredBOnce a reference is created, it cannot be later made to reference another object; it cannot be resetCReferences cannot be NULLDReferences cannot refer to constant valueAnswerDMarks1UnitIId64QuestionWhat will be the output of following program?#include <iostream>using namespace std; class Test{public: Test() { cout <<"Hello from Test() "; }} a; int main(){ cout <<"Main Started "; return 0;}AMain StartedBMain Started Hello from Test()CHello from Test() Main StartedDCompiler Error: Global objects are not allowedAnswerCMarks2UnitIId65QuestionWhich of the following is true about constructors. They cannot be virtual. They cannot be private. They are automatically called by new operatorAAll 1, 2, and 3BOnly 1 and 3COnly 1 and 2DOnly 2 and 3AnswerBMarks1UnitIId66QuestionWhich of the following operators are overloaded by default by the compiler?1) Comparison Operator ( == )2) Assignment Operator ( = )ABoth 1 and 2BOnly 1COnly 2DNone of the twoAnswerCMarks1UnitIId67QuestionWhich of the following is true about inline functions and macros.AInline functions do type checking for parameters, macros don'tBMacros cannot have return statement, inline functions canCMacros are processed by pre-processor and inline functions are processed in later stages of compilation.DAll of the aboveAnswerDMarks1UnitIId68QuestionIn C++, const qualifier can be applied to Member functions of a classFunction arguments To a class data member which is declared as static Reference variablesAOnly 1, 2 and 3BOnly 1, 2 and 4CAllDOnly 1, 3 and 4AnswerCMarks1UnitIId69QuestionIn C++ ..................... operator is used for Dynamic memory allocation.AScope resolutionBConditionalCNewDMembership accessAnswerCMarks1 MUnitIId70QuestionWhat is the output of the program#include<iostream.h>void main(){? ? ?int n=1;? ? ?cout<<endl<<"The numbers are;"<<endl;? ? ?do? ? ? ? ? ?{cout <<n<<"\t";n++;? ? ? ? ? ?} while (n<=100);? ? ?cout <<endl;?}APrint natural numbers 0 to 99BPrint natural numbers 1 to 99CPrint natural numbers 0 to 100DPrint natural numbers 1 to 100AnswerDMarks2 MUnitIId71QuestionBecause the lifetime of a local variable is limited and determined automatically, these variables are also calledAAutomatorBAutomaticCDynamicDStaticAnswerBMarks1 MUnitIId72QuestionWhich of the following header file includes definition of cin and cout?Aistream.hBostream.hCiomanip.hDiostream.hAnswerDMarks1UnitIId73QuestionWhich of the following statements regarding inline functions is correct?AIt speeds up executionBIt slows down executionCIt increases the code sizeDBoth A and C.AnswerDMarks1UnitIId74QuestionWhich of the following access specifier is used as a default in a class definition?APublicBPrivateCProtected DFriendAnswerBMarks1UnitIId75QuestionWhich of the following statements is correct in C++?AClasses cannot have data as protected members.BStructures can have functions as lass members are public by default.DStructure members are private by default.AnswerBMarks1UnitIId76Questioncout is a/an __________Aoperator BFunctionCobjectDMacroAnswerCMarks1UnitIId77QuestionWhich of the following concepts of OOPS means exposing only necessary information to client?AEncapsulationBAbstractionCData hidingDData bindingAnswerCMarks1Unit1Id78QuestionWhich of the following keywords is used to control access to a class member? ADefaultBBreakCProtectedDAsmAnswerCMarks1Unit1Id79QuestionUtility functions are also called as .......AVirtual functionBFriend functionCHelper functionDNone of aboveAnswerCMarks1Unit1Id80Question......... is a member function with the same name as the class.AFriend functionBConstructorCDestructorDNone of aboveAnswerBMarks1Unit1Id81QuestionWhich is not the feature of constructor?AIt cannot be inherited.BIt should be declared in Private.CIt do not have return typeDAll of aboveAnswerBMarks1Unit1Id82QuestionWhich is not type of constructor?ADefaultBCopyCParameterized DNone of aboveAnswerDMarks1Unit1Id83QuestionObjects are destroyed in the reverse order of its creation.ATrueBFalseC-D-AnswerAMarks1Unit1Id84Question.... constructor is used for copying the object of same class type.ACopyBDefaultCParameterizedDNone of aboveAnswerAMarks1Unit1Id85QuestionThe function inside a class is called as .......AClass FunctionBMember FunctionCMethodDAll of aboveAnswerBMarks1Unit1Id86QuestionWhich operator is used to define member function of a class outside the class?A!B:C::D.AnswerCMarks1Unit1Id87QuestionHow many objects can be created by a class?A1B2C3DAs Many as requiredAnswerDMarks1Unit1Id88QuestionDefault return type of C++ main( ) is .....AfloatBvoidCIntDPointerAnswerCMarks1Unit1Id89QuestionEnumerated data type is ........AUser-defined data typeBIn-built data typeCDerived data typeDNone of aboveAnswerAMarks1Unit1Id90QuestionAttributes of a class are called as ........AMember functionsBData membersCObjectsDAll of aboveAnswerBMarks1Unit1Id91QuestionClass acquire space in memory.ATrueBFalseC-D-AnswerBMarks1Unit1Id92QuestionIn object-oriented programming ........ is more important.AFunctionBProcedureCDataDAll of aboveAnswerCMarks1Unit1Id93QuestionObject-oriented programming follows Top-down approach.ATrueBFalseC-D-AnswerBMarks1Unit1Id94QuestionThe following operators can not be overloadedAUnary operatorBBinary operatorCTernary operatorDNone of the aboveAnswerCMarks1Unit1Id95QuestionC++ does not supports the followingAMultilevel inheritanceBHierarchical inheritanceCHybrid inheritanceDNone of the aboveAnswerDMarks1Unit1Id96QuestionWhich of the following is not the keyword in C++?AVolatileBFriendCExtendsDThisAnswerCMarks1Unit1Id97QuestionWhich data type can be used to hold a wide character in C++?Aunsigned char;BIntCwchar_tDNone of the aboveAnswerCMarks1Unit1Id98QuestionWhich type is best suited to represent the logical values?AintegerBbooleanCcharacterDall of the mentionedAnswerBMarks1Unit1Id99QuestionThe following is the C++ style commentA//B/*..*/C–DNone of aboveAnswerAMarks1Unit1Id100QuestionWhich of the following statements is false?AEvery C++ program must have a main().BIn C++, white spaces and carriage returns are ignored by the ++ statements terminate with semicolon.DMain() terminates with semicolon.AnswerDMarks1Unit1Id101QuestionWhich of the following statements regarding comments is false?A/*..*/BComment beginning with // extends to the end of the lineCComments may be nestedDComments are used to describe a programAnswerCMarks1Unit1Id102QuestionThe result of the following statement isint y = 7;int ans = ++y;cout<<”ans=”<<ans;cout<<”y”<<y;Aans=7, y=7Bans=8,y=7Cans=8,y=8;DNoneAnswerCMarks1Unit1Id103QuestionInline functions areADeclared in the class defined outside the classBDefined outside the class using keyword inlineCDefined inside the class using keyword inlineDNone of the aboveAnswerBMarks1Unit1Id104QuestionFunctions can returnsAArraysBReferencesCObjectsDAll of aboveAnswerDMarks1Unit1Id105QuestionWhich of the following control expressions are valid for an if statement?Aan integer expressionBa Boolean expressionCeither A or BDNeither A nor BAnswerCMarks1Unit1Id106QuestionState true of false.i) We cannot make the function inline by defining a function outside the class.ii) A member function can be called by using its name inside another member function of the same class, this is known as nesting of member function.ATrue, TrueBTrue, FalseCFalse, TrueDFalse, FalseAnswerCMarks1Unit1Id107QuestionWhat will be the values of x, m and n after execution of the following statements?Int x, m, n;?m=10;n=15;??????????????? x= ++m + n++;Ax=25, m=10, n=15Bx=27, m=10, n=15Cx=26, m=11, n=16Dx=27, m=11, n=16AnswerCMarks2Unit1Id108QuestionHow many types of polymorphisms are supported by C++?A1B2C3D4AnswerBMarks1Unit1Id109QuestionWhich of the following approach is adapted by C++?ATop-downBBottom-upCRight-leftDLeft-rightAnswerBMarks1Unit1Id110QuestionWhich of the following is the correct class of the object cout?AIostreamBistreamCOstreamDIfstreamAnswerCMarks1Unit1Id111QuestionWhich of the following functions are performed by a constructor?AConstruct a new classBConstruct a new objectCConstruct a new functionDInitialize objectsAnswerDMarks1Unit1Id112QuestionWhich of the following ways are legal to access a class data member using this pointer?Athis->xBthis.xC*this.xD*this-xAnswerAMarks1Unit1Id113QuestionWhich operator is having right to left associativity in the following?AArray subscriptingBFunction callCAddition and subtractionDType castAnswerDMarks1Unit1Id114QuestionWhich operator is having the highest precedence?APostfixBUnaryCShiftDEqualityAnswerAMarks1Unit1Id115Question #include <iostream> using namespace std; int main() { int a; a = 5 + 3 * 5; cout <<a; return 0; }A35B20C25D30AnswerBMarks2Unit1Id116Question #include <iostream> using namespace std; main() { double a = 21.09399; float b = 10.20; int c ,d; c = (int) a; d = (int) b; cout <<c <<' '<<d; return 0; }A20 10B10 21C21 10DNone AnswerAMarks2Unit1Id117Question #include <iostream> using namespace std; int main() { int num1 = 10; float num2 = 20; cout <<sizeof(num1 + num2); return 0; }A2B4C8DGarbageAnswerBMarks2Unit1Id118Question #include <stdio.h> using namespace std; int array1[] = {1200, 200, 2300, 1230, 1543}; int array2[] = {12, 14, 16, 18, 20}; int temp, result = 0; int main() { for (temp = 0; temp <5; temp++) { result += array1[temp]; } for (temp = 0; temp <4; temp++) { result += array2[temp]; } cout <<result; return 0; }A6553B6533C6522D12200AnswerBMarks2Unit1Id119QuestionIn procedural programming the focus in on …...........A dataB structureC functionD pointersAnswerCMarks1Unit1Id120QuestionIn object oriented programming the focus is on ….......A dataBstructureCfunctionD pointersAnswerAMarks1Unit1Id121QuestionWhich of the following feature of procedure oriented program is false?A Makes use of bottom up approachB Functions share global dataC The most fundamental unit of program is functionD All of theseAnswerAMarks1Unit1Id122QuestionWhich of the following feature of object oriented program is false?A Data and Functions can be added easilyB Data can be hidden from outside worldC Object can communicate with each otherD The focus is on proceduresAnswerDMarks1Unit1Id123QuestionC++ was originally developed by ….......A Donald KnuthB Bjarne SroustrupsC Dennis RitchieD None of theseAnswerBMarks1Unit1Id124QuestionWhich of the following approach is adopted in C++?ATop downB Bottom upC HorizontalD VerticalAnswerBMarks1Unit1Id125QuestionWhich feature of C++ contain the concept of super class and subclass?A Class and objectB EncapsulationC AbstractionD InheritanceAnswerDMarks1Unit1Id126QuestionThe main intention of using inheritance is ….........A to help in converting one data type to otherB to hide the details of base classC to extend the capabilities of base classD to help in modular programmingAnswerCMarks1Unit1Id127QuestionIf particular software can be used in some other application than the onefor which it is created then it reveals ….........A data bindingB data reusabilityC data encapsulationD none of theseAnswerBMarks1Unit1Id128QuestionWhich of the following data type does not return anything?A IntB shortC longD voidAnswerDMarks1Unit1Id129QuestionHow many objects can be created from an abstract class?AZeroBOneCTwoDAs many as we wantAnswerAMarks1Unit1Id130QuestionWhich of the following statements is correct for a static member function? 1. It can access only other static members of its class.It can be called using the class name, instead of objectsAOnly 1 is correctBOnly 2 is correctCBoth 1 and 2 are correctDBoth 1 and 2 are incorrectAnswerCMarks1Unit1Id131QuestionSelect the correct statementI. In procedural programming oriented language all the function calls areresolved at compile time.II. In object oriented programming language all function calls areresolved at compile time.A Only IB Only IIC Both I and IID Neither I nor IIAnswerAMarks1Unit1Id132QuestionWhat happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?ACompile-time errorB Preprocessing errorC Runtime errorD Runtime exceptionAnswerAMarks1Unit1Id133QuestionWhich of the following interface determines how your program will be used by other program?A PublicB PrivateC ProtectedD None of theseAnswerAMarks1UnitIId134QuestionWhat is the difference between struct and class in C++?AAll members of a structure are public and structures don't have constructors and destructorsBMembers of a class are private by default and members of struct are public by default. When deriving a struct from a class/struct, default access-specifier for a base class/struct is public and when deriving a class, default access specifier is private.CAll members of a structure are public and structures don't have virtual functionsDAll aboveAnswerBMarks1UnitIId135QuestionPredict the output of following C++ program #include<iostream>using namespace std;??class Empty {};??int main(){??cout <<sizeof(Empty);??return 0;}AA non zero valueB0CCompile time errorDRuntime errorAnswerAMarks1UnitIId136Questionclass Test {????int x; };int main(){??Test t;??cout <<t.x;??return 0;}A0BGarbage valueCCompile time errorDAnswerCMarks1UnitIId137QuestionWhich of the following is true?AAll objects of a class share all data members of classBObjects of a class do not share non-static members. Every object has its own copyCObjects of a class do not share codes of non-static methods, they have their own copyDNoneAnswerBMarks1UnitIId138QuestionAssume that an integer and a pointer each takes 4 bytes. Also, assume that there is no alignment in objects. Predict the output following program. #include<iostream>using namespace std;?class Test{????static int x;????int *ptr;????int y;};?int main(){????Test t;????cout <<sizeof(t) <<" ";????cout <<sizeof(Test *);}A12 4B12 12C8 4D8 8AnswerMarks2UnitIId139QuestionWhich of the following is true about the following program #include <iostream>class Test{public:????int i;????void get();};void Test::get(){????std::cout <<"Enter the value of i: ";????std::cin >>i;}Test t;? // Global objectint main(){????Test t;? // local object????t.get();????std::cout <<"value of i in local t: "<<t.i<<'\n';????::t.get(); ????std::cout <<"value of i in global t: "<<::t.i<<'\n';????return 0;}ACompiler Error: Cannot have two objects with same class nameBCompiler Error in Line "::t.get();" CCompiles and runs fineDAnswerCMarks2UnitIId140QuestionHow to create a dynamic array of pointers (to integers) of size 10 using new in C++? Hint: We can create a non-dynamic array using int *arr[10]Aint *arr = new int *[10];Bint **arr = new int *[10];Cint *arr = new int [10];DNot possibleAnswer1Marks1UnitIId141QuestionWhich of the following is true about new when compared with malloc. 1) new is an operator, malloc is a function 2) new calls constructor, malloc doesn't 3) new returns appropriate pointer, malloc returns void * and pointer needs to typecast to appropriate type.A1 and 3B2 and 3C1 and 2DAll 1,2,3AnswerCMarks1UnitIId142QuestionPredict the output? #include <iostream>using namespace std;?class Test {??int x;??Test() { x = 5;}};?int main(){???Test *t = new Test;???cout <<t->x;}ACompile time errorBGarbage C0D5AnswerAMarks2UnitIId143QuestionWhat happens when delete is used for a NULL pointer? int *ptr = NULL;delete ptr; ACompile time errorBRun time errorCNo effectDAnswerCMarks1UnitIId144QuestionIs it fine to call delete twice for a pointer? #include<iostream>using namespace std;?int main(){????int *ptr = new int;????delete ptr;????delete ptr;????return 0;}AYesBNoCDAnswerBMarks1UnitIId145QuestionWhich of the followings is/are automatically added to every class, if we do not write our own.ACopy constructorBAssignment operatorCA constructor without any parameterDAllAnswerDMarks1UnitIId146QuestionWhen a copy constructor may be called?AWhen an object of the class is returned by valueBWhen an object of the class is passed (to a function) by value as an argumentCWhen an object is constructed based on another object of the same classDAllAnswerDMarks1UnitIId147QuestionOutput of following program? #include<iostream>using namespace std;class Point {????Point() { cout <<"Constructor called"; }};?int main(){???Point t1;???return 0;}ACompile time errorBRun time errorCConstructor calledDAnswerAMarks1UnitIId148QuestionWhich of the following interface determines how your program will be used by other program?A PublicB PrivateC ProtectedD None of theseAnswerAMarks1UnitIId149Question#include<iostream>using namespace std;class Point {public:????Point() { cout <<"Constructor called"; }};?int main(){???Point t1, *t2;???return 0;}ACompiler ErrorBConstructor calledConstructor calledCConstructor calledDAnswerCMarks1UnitIId150Question#include<iostream>using namespace std;?class X {public:????int x;};?int main(){????X a = {10};????X b = a;????cout <<a.x <<" " <<b.x;????return 0;}ACompiler ErrorB10 followed by Garbage ValueC10 10D10 0AnswerDMarks1UnitI ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download