C++ Mcqs

QUES.Which of the following type of class allows only one object of it to be created?

A.Virtual class

B.Abstract class

C.Singleton class

D.Friend class

 

QUES. Which of the following is not a type of constructor?

A.Copy constructor

B.Friend constructor

C.Default constructor

D.Parameterized constructor

 

QUES. Which of the following statements is correct?

a.Base class pointer cannot point to derived class.

b.Derived class pointer cannot point to base class.

c.Pointer to derived class cannot be created.

d.Pointer to base class cannot be created.

 

QUES.Which of the following is not the member of class?

a.Static function

b.Friend function

c.Const function

d.Virtual function

 

QUES.Which of the following concepts means determining at runtime what method to invoke?

A.Data hiding

B.Dynamic Typing

C.Dynamic binding

D.Dynamic loading

 

QUES.Which of the following term is used for a function defined inside a class?

A.Member Variable

B.Member function

C.Class function

D.Classic function

 

QUES. Which of the following concept of oops allows compiler to insert arguments in a function call if it is not specified?

A.Call by value

B.Call by reference

C.Default arguments

D.Call by pointer

 

QUES.Which of the following cannot be friend?

A.Function

B.Class

C.Object

D.Operator function

 

QUES.Which of the following concepts of OOPS means exposing only necessary information to client?

A.Encapsulation

B.Abstraction

C.Data hiding

D.Data binding

 

QUES.Why reference is not same as a pointer?

A.A reference can never be null.

B.A reference once established cannot be changed.

C.Reference doesn’t need an explicit dereferencing mechanism.

D.All of the above.

QUES.cout is a/an __________ .

A.Operator

B.Function

C.Object

D.Macro

 

QUES.Which of the following concepts provides facility of using object of one class inside another class?

A.Encapsulation

B.Abstraction

C.Composition         

D.Inheritance

 

QUES.How many types of polymorphisms are supported by C++?

A.1

B.2

C.3

D.4

 

QUES. Which of the following is an abstract data type?

A.Int

B.Double

C.String

D.Class

 

QUES.Which of the following concepts means adding new components to a program as it runs?

A.Data hiding

B.Dynamic typing

C.Dynamic binding

D.Dynamic loading

 

QUES.Which of the following statement is correct?

A.A constructor is called at the time of declaration of an object.

B.A constructor is called at the time of use of an object.

C.A constructor is called at the time of declaration of a class.

D.A constructor is called at the time of use of a class.

 

QUES.Which of the following approach is adapted by C++?

A.Top-down

B.Bottom-up

C.Right-left

D.Left-right

 

QUES.Which of the following is correct about function overloading?

A.The types of arguments are different.

B.The order of argument is different.

C.The number of argument is same.

D.Both A and B.

 

QUES.Which of the following is correct about class and structure?

A.class can have member functions while structure cannot.

B.class data members are public by default while that of structure are private.

C.Pointer to structure or classes cannot be declared.

D.class data members are private by default while that of structure are public by default.

 

QUES.Which of the following concepts means wrapping up of data and functions together?

A.Abstraction

B.Encapsulation

C.Inheritance

D.Polymorphism

 

QUES.Which of the following concepts means waiting until runtime to determine which function to call?

A.Data hiding

B.Dynamic casting

C.Dynamic binding

D.Dynamic loading

 

QUES.How “Late binding” is implemented in C++?

A.Using C++ tables

B.Using Virtual tables

C.Using Indexed virtual tables

D.Using polymorphic tables

 

QUES. Which of the following operator is overloaded for object cout?

A.>>

B.<<

C.+

D.=

 

QUES.Which of the following is the correct class of the object cout?

A.iostream

B.istream

C.ostream

D.ifstream

 

QUES. Which of the following cannot be used with the keyword virtual?

A.Class

B.member functions

C.Constructor

D.Destructor

 

QUES.Which of the following functions are performed by a constructor?

A.Construct a new class

B.Construct a new object

C.Construct a new function

D.Initialize objects

 

QUES.Which of the following problem causes an exception?

A.Missing semicolon in statement in main().

B.A problem in calling function.

C.A syntax error.

D.A run-time error.

 

QUES. Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object.

A.Inheritance

B.Polymorphism

C.Abstraction

D.Encapsulation

 

QUES.Which of the following is the correct way of declaring a function as constant?

A.const int ShowData(void) { /* statements */ }

B.int const ShowData(void) { /* statements */ }

C.int ShowData(void) const { /* statements */ }

D.Both A and B

 

QUES.Which of the following concepts is used to implement late binding?

A.Virtual function

B.Operator function

C.Const function

D.Static function

 

QUES.. Which of the following statement is correct?

A.C++ allows static type checking.

B.C++ allows dynamic type checking.

C.C++ allows static member function be of type const.

D.Both A and B.

 

QUES.Which of the following factors supports the statement that reusability is a desirable feature of a language?

A.It decreases the testing time.

B.It lowers the maintenance cost.

C.It reduces the compilation time.

D.Both A and B.

 

QUES.Which of the following ways are legal to access a class data member using this pointer?

A.this->x

B.this.x

C.*this.x

D.*this-x

 

QUES.Which of the following is a mechanism of static polymorphism?

A.Operator overloading

B.Function overloading

C.Templates

D.All of the above

 

QUES.Which of the following is correct about the statements given below?

All operators can be overloaded in C++.

We can change the basic meaning of an operator in C++.

A.Only I is true.

B.Both I and II are false.

C.Only II is true.

D.Both I and II are true

 

QUES.What happens if the base and derived class contains definition of a function with same prototype?

A.Compiler reports an error on compilation.

B.Only base class function will get called irrespective of object.

C.Only derived class function will get called irrespective of object.

D.Base class object will call base class function and derived class object will call derived class function.

 

QUES.Which of the following are available only in the class hierarchy chain?

A.public data members

B.Private data members

C.Protected data members

D.Member functions

 

QUES.Which of the following is not a type of inheritance?

A.Multiple

B.Multilevel

C.Distributive

D.Hierarchical

 

QUES.Which of the following operators cannot be overloaded?

A.[]

B.->

C.?:

D.*

 

QUES.In which of the following a virtual call is resolved at the time of compilation?

A.From inside the destructor.

B.From inside the constructor.

C.From inside the main().

D.Both A and B.

 

QUES.Which of the following statements regarding inline functions is correct?

A.It speeds up execution.

B.It slows down execution.

C.It increases the code size.

D.Both A and C

 

QUES.Which one of the following is the correct way to declare a pure virtual function?

A.virtual void Display(void){0};

B.virtual void Display = 0;

C.virtual void Display(void) = 0;

D.void Display(void) = 0;

 

QUES. Which of the following header file includes definition of cin and cout?

A.istream.h

B.ostream.h

C.iomanip.h

D.iostream.h

 

QUES.Which of the following keyword is used to overload an operator?

A.overload

B.operator

C.friend

D.override

 

QUES.What will happen if a class is not having any name?

A.It cannot have a destructor.

B.It cannot have a constructor.

C.It is not allowed.

D.Both A and B.

 

QUES.Which inheritance type is used in the class given below?

class A : public X, public Y

{}

A.Multilevel inheritance

B.Multiple inheritance

C.Hybrid inheritance

D.Hierarchical Inheritance

 

QUES.Which one of the following is correct about the statements given below?

All function calls are resolved at compile-time in Procedure Oriented Programming.

All function calls are resolved at compile-time in OOPS.

A.Only II is correct.

B.Both I and II are correct.

C.Only I is correct.

D.Both I and II are incorrect.

 

QUES.Which of the following is an invalid visibility label while inheriting a class?

A.public

B.private

C.protected

D.friend

 

QUES. Which one of the following options is correct?

A.Friend function can access public data members of the class.

B.Friend function can access protected data members of the class.

C.Friend function can access private data members of the class.

D.All of the above.

 

QUES.Which of the following statements is correct in C++?

A.Classes cannot have data as protected members.

B.Structures can have functions as members.

C.Class members are public by default.

D.Structure members are private by default.

QUES.Which of the following is used to make an abstract class?

A.Declaring it abstract using static keyword.

B.Declaring it abstract using virtual keyword.

C.Making at least one member function as virtual function.

D.Making at least one member function as pure virtual function

QUES.Which of the following access specifier is used as a default in a class definition?

A.protected

B.public

C.private

D.friend

QUES.What is correct about the static data member of a class?

A.A static member function can access only static data members of a class.

B.A static data member is shared among all the object of the class.

C.A static data member can be accessed directly from main().

D.Both A and B.

 

QUES.Which of the following provides a reuse mechanism?

A.Abstraction

B.Inheritance

C.Dynamic binding

D.Encapsulation

 

. QUES.Which of the following statement is correct?

A.Class is an instance of object.

B.Object is an instance of a class.

C.Class is an instance of data type.

D.Object is an instance of data type.

 

QUES.C++ was originally developed by;

A.Clocksin and Mellish

B.Donald E. Knuth

C.Sir Richard Hadlee

D.Bjame Stroustrup

 

QUES.How do we declare an ‘interface’ class?

 

a)By making all the methods pure virtual in a class

b)By making all the methods abstract using the keyword ‘abstract’ in a class

c)By declaring the class as interface with the keyword ‘interface’

d)It is not possible to create interface class in C++

 

QUES:How do we declare an abstract class?

 a)By providing at least one pure virtual method (function signature followed by ==0;) in a class

b)By declaring at least one method abstract using the keyword

‘abstract’ in a class

c)By declaring the class abstract with the keyword ‘abstract’

d)It is not possible to create abstract classes in C++

QUES:Which of the following is not an advantage of secondary memory

a)It is cost-effective

b)It has large storage capacity

c)It has highest speed

d)It is easily portable

QUES:Which of the following correctly describes the meaning of‘namespace’ feature in C++?

a)Namespaces refer to the memory space allocated for names used in a program

b)Namespaces refer to space between the names in a program

c)Namespaces refer to packing structure of classes in a program.

d)Namespaces provide facilities for organizing the names in  a program to avoid name clashes.

QUES:Which of the following correctly describes the meaning of ‘namespace’ feature in C++?

a)Namespaces refer to the memory space allocated for names used in a program

b)Namespaces refer to space between the names in a program

c)Namespaces refer to space between the names in a program

d)namespaces provide facilities for organizing the names in a program to avoid name clashes

 

QUES:Which of the following language is not supported by C++?

a)Exception Handling

b)Reflection

c)Operator Overloading

d)Namespaces

 

QUES:class derived: public base1, public base2 { } is an example of

a)Polymorphic inheritance

b)Multilevel inheritance

c)Hierarchical inheritance

d)Multiple inheritance

 

QUES:A constructor that does not have any parameters is called____________ constructor.

a. Custom
b. dynamic
c. static
d. default

QUES:If default constructor is not defined, then how the objects of the class will be created?

a. The compiler will generate error
b. Error will occur at run-time.
c. Compiler provides its default constructor to the class.

d.none of these

QUES: Which of the followings are true about constructors?

1. A class can have more than one constructor
2. They can be inherited
3. Their address can be referred
4. Constructors cannot be declared in protected section of the class
5. Constructors cannot return values

a. Only 1,2,4
b. 1,2,4,5
c. 1,3,5
d. 1,4,5
d. None of these

QUES:An exception is thrown using _____________ keyword in CPP.

a. throws
b. throw
c. threw
d. thrown

QUES:The code of statements which may cause abnormal termination of the program should be written under_________ block
a. try
b. catch
c. Finally
d. None of these

QUES:Exception handlers are declared with ____________ keyword

a. Try
b. catch
c. throw
d. finally

QUES:In C++ how many return statements are allowed in a non-void function?

a) 1
b) as many as you like
c) 0
d) 2

QUES:Generic pointers can be declared with__________

a. auto
b. void
c. asm
d. None of these

QUES: Run time polymorphism can be achieved with______

a. Virtual Base class
b. Container class
c. Virtual function
d. Both a and c

QUES:We can create objects of the abstract class.

a. True
b. False

QUES:________________ is a member function that is declared within a base class and redefined by derived class.

a. virtual function
b. static function
c. friend function
d. const member function

QUES:When a virtual function is redefined by the derived class, it is called___________

a. Overloading
b. Overriding
c. Rewriting

d. All of these

QUES:Which of the followings are true about Virtual functions?

a. They must be non-static member function of the class
b. They cannot be friends
c. Constructor Functions cannot be virtual
d. All of these

QUES:If a class contains pure virtual function, then it is termed as_____________________

a. Virtual class
b. Sealed class
c. Pure Local class
d. Abstract Class

QUES:If abstract class is inherited by derived class, then_______________

a. Derived class should provide definition for all the pure virtual functions
b. Derived class also become abstract if fails to implement pure virtual functions
c. Objects of derived class can’t be created if it fails to implement pure virtual functions
d. All of these

QUES:A virtual function that has no definition within the base class is called____________

a. Pure virtual function
b. Pure static function
c. Pure Const function
d. Friend function

QUES:Reusability of the code can be achieved in CPP through

a. Polymorphism
b. Encapsulation
c. Inheritance
d. Both a and c

QUES:When a child class inherits traits from more than one parent class, this type of inheritance is called _______________ inheritance.

a. Hierarchical
b. Hybrid
c. Multilevel
d. Multiple

QUES:class X, class Y and class Z are derived from class BASE. This is _____________ inheritance

a. Multiple
b. Multilevel
c. Hierarchical
d. Single
QUES:
The derivation of Child class from Base class is indicated by ____ symbol.

a. ::
b. :
c. ;
d. |

QUES: If the derived class is struct, then default visibility mode is_______

a. public
b. protected
c. private
d. struct can’t inherit class

QUES:When a base class is privately inherited by the derived class, then_______________

a. protected members of the base class become private members of derived class
b. public members of the base class become private members of derived class
c. both a and b

QUES:Scope resolution operator is used______

a. to resolve the scope of global variables only
b. to resolve the scope of functions of the classes only
c. to resolve scope of global variables as well as functions of the classes
d. None of these

QUES:A class can contain objects of other classes and this phenomenon is called__________

a. Relationship
b. Object Association
c. Containership
d. None of these

QUES:Which of the followings is/are pointer–to-member declarator ?

a . ->*
b. .*
c. ::*
d. both a and b

QUES:By default, members of the class are____________ in nature.

a. protected
b. private
c. public
d. static

QUES: ____________ refers to the act of representing only essential features without including the background details.

a. Data Hiding
b. Data Encapsulation
c. Data Abstraction
d. All of these

QUES:Only functions of the class can access the data of the class and they(functions) provides the interface between data, objects and the program. This kind isolation of the data from direct access by the program is called_______________

a. Data Abstraction
b. Data Hiding
c. Data Binding
d. Data Encapsulation

QUES: __________________ is the OOP feature and mechanism that binds together code and the data it manipulates, and keep both safe from outside world.

a. Data Binding
b. Data Encapsulation
c. Data Storing
d. Data Abstraction

QUES:Object oriented programming employs_________ programming approach.

a. top-down
b. procedural
c. bottom-up
d. all of these.

QUES:In CPP, cin and cout are the predefined stream__________

a. Operator
b. Functions
c. Objects
d. Data types

QUES:Classes in CPP are________

a.derived data types
b.User defined data types
c.built-in data types

d. All of these
QUES:When a class is defined inside any function or block, it is called_____________

a. Nested class
b. Block class
c. Local class
d. It is not possible

QUES:Use of virtual functions implies

a)overloading
b)overriding
c)static binding
d)dynamic binding
QUES:In multiple inheritance

a)the base classes must have only default constructors
b)cannot have virtual functions
c)can include virtual classes
d)None of the above.

QUES:Where does the execution of the program starts?
a) user-defined function
b) main function
c) void function
d) none of the mentioned

QUES:What are mandatory parts in function declaration?
a) return type,function name
b) return type,function name,parameters
c) both a and b
d) none of the mentioned

QUES:Which is more effective while calling the functions?
a) call by value
b) call by reference
c) call by pointer

d) none of the mentioned

QUES:Which rule will not affect the friend function?
a) private and protected members of a class cannot be accessed from outside
b) private and protected member can be accessed anywhere

c) both a & b
d) None of the mentioned

QUES:What is the syntax of friend function?
a) friend class1 Class2;
b) friend class;
c) friend class
d) None of the mentioned

QUES.To which of the following access aspecifiers are applicable?
a) Member data
b) Functions
c) Both a & b
d) None of the mentioned

QUES.In which of the following we cannot overload the function?

a) return function
b) caller

c) called function
d) none of the mentioned

QUES:Which of the following permits function overloading on c++?
a) type
b) number of arguments
c) both of the mentioned
d) none of the mentioned

QUES:Function overloading is also similar to which of the following?
a) operator overloading
b) constructor overloading
c) destructor overloading
d) none of the mentioned

QUES:How many specifiers are present in access specifiers in class?
a) 1
b) 2
c) 3
d) 4

QUES:Which other keywords are also used to declare the class other than class?
a) struct
b) union
c) object
d) both a & b

QUES:. Which class is used to design the base class?
a) abstract class

b) derived class
c) base class
d) None of the mentioned

QUES:Which is used to create a pure virtual function ?
a) $
b) =0
c) &
d) !

QUES:What is a template?
a) A template is a formula for creating a generic class
b) A template is used to manipulate the class
c) A template is used for creating the attributes
d) none of the mentioned
View Answer

QUES:. How to declare a template?
a) tem
b) temp
c) template<>

d)template;

QUES:. In multiple inheritance
A) the base classes must have only default constructors
B) cannot have virtual functions
C) can include virtual classes
D) None of the aboved) none of the mentioned

QUES:. Overloading the function operator

A) requires a class with an overloaded operator

B) requires a class with an overloaded [ ] operator.

C) allows you to create objects that act syntactically like functions.

D) usually make use of a constructor that takes arguments.

QUES:. Which of the following is the proper declaration of a pointer?

A) int x;

B) int &x;
C) ptr x;
D) int *x;

QUES:. The compilers converts all operands upto to type of the largest operand is called as …………

A) typeconversion
B) expression
C) evaluation
D) precedence

QUES.Which of the following is a mechanism of static polymorphism?

A)Operator overloading

B)Function overloading

C)Templates

D)All of the above

QUES.What happens if the base and derived class contains definition of a function with same prototype?

A)Compiler reports an error on compilation.

B)Only base class function will get called irrespective of object.

C)Only derived class function will get called irrespective of object.

D)Base class object will call base class function and derived class object will call derived class function.

 

QUES.Which of the following problem causes an exception?

A)Missing semicolon in statement in main().

B)A problem in calling function.

C)A syntax error.

D)A run-time error.

 

QUES.Which of the following concepts means adding new components to a program as it runs?

A)Data hiding

B)Dynamic typing

C)Dynamic binding

D)Dynamic loading

 

QUES.Which of the following correctly describes overloading of functions?

A)Virtual polymorphism

B)Transient polymorphism

C)Ad-hoc polymorphism

D)Pseudo polymorphism

 

QUES.. What does a default header file contain?
a) prototype
b) implementation
c) declarations
d) none of the mentioned

 

QUES. Which of the following header file does not exist?
a) <iostream>
b) <string>
c) <sstring>
d) <sstream>

 

QUES.Identify the incorrect option.
a) enumerators are constants
b) enumerators are user defined types
c) enumerators are same as macros
d) enumerator values start from 0 by default

 

QUES.In which type does the enumerators are stored by the compiler?
a) string
b) integer
c) float

d) none of the mentioned

 

QUES.To which of these enumerators can be assigned?
a) integer
b) negative
c) enumerator
d) all of the mentioned

 

QUES.. What will happen when defining the enumerated type?
a) it will not allocate memory
b) it will allocate memory
c) it will not allocate memory to its variables
d) none of the mentioned

QUES. Which variable does equals in size with enum variable?
a) int variable
b) float variable
c) string variable
d) none of the mentioned

QUES. Which of the following operators can’t be overloaded?
a) ::
b) +
c) –
d) []

QUES.How to declare operator function?
a) operator operator sign
b) operator
c) operator sign
d) None of the mentioned

QUES. The operator used for dereferencing or indirection is ____
a) *
b) &
c) ->
d) –>>

QUES.. Why we use the “dynamic_cast” type conversion?
a) result of the type conversion is a valid
b) to be used in low memory
c) result of the type conversion is a invalid
d) None of the mentioned

QUES. How many parameters does a conversion operator may take?
a) 0
b) 1
c) 2
d) as many as possible

QUES.. Which of the following is a correct comment?

  1. */ Comments */.
  2. ** Comment **.
  3. /* Comment */.
  4. { Comment }.

QUES.What is the only function all C++ programs must contain?

a. Start().

b. System().

c. Main().

d. Program().

QUES.What punctuation is used to signal the beginning and end of code blocks?

a. { }.

b. -> and <-.

c. BEGIN and END.

d. ( and ).

QUES. Which of the following is not a correct variable type?

a. Float.

b. Real.

c. Int.

d. Double.

QUES. Which of the following is the correct operator to compare two variables?

a. :=

.b. =.

c. equal.

d. = =.

QUES. Which of the following is the boolean operator for logical-and?

a. &.

b. &&.

c. |.

d. |&.  

QUES.The directives for the preprocessors begin with_____________.

a. ampersand symbol (&).

b. two Slashes (//).

c. number Sign (#).

d. less than symbol (<).  

QUES.There is a unique function in C++ program by where all C++ programs start their execution with ______________.

a. start().

b. begin().

c. main().

d. output().

QUES.. __________ storage class is the only request to the compiler.

a. Extern

b. Static

c. Register

d. Auto

 

QUES.. How many times is a do while loop guaranteed to loop?

a. 0.

b. Infinitely.

c. 1.

d. Variable.

QUES.. Which of the following is not a jump statement in C++?

a. Break.

b. Goto

c. Exit.

d. Switch.

QUES.A continue statement causes execution to skip to ____________.

a. the return 0; statement.

b. the first statement after the loop.

c. the statement following the continue statement.

d. the next iteration of the loop.  

 

QUES.In a group of nested loops, which loop is executed the most number of times?

a. The outermost loop

b. The innermost loop

c. All loops are executed the same number of times

d. Cannot be determined without knowing the size of the loops bottom of form  

 

QUES.. Each pass through a loop is called a/an _____________.

a. enumeration.

b. iteration.

c. culmination.

d. pass through.

 

QUES.. Which looping process checks the test condition at the end of the loop?

a. For.

b. While.

c. Do-while.

d. No looping process checks the test condition at the end.

 

QUES.. In C++, 14 % 4 = ___________.

a. 1.

b. 2.

c. 3.

d. 4.

QUES.. Variables that are declared, but not initialized, contain __________.

a. blank spaces.

b. zeros.

c. “garbage” values.

d. nothing – they are empty.

QUES.. Array indexing always starts with the number ____________.

a. 0.

b. 1.

c. 2.

d. none of these.

QUES.. Variables with names that describe the data stored at that particular memory location are called ________________.

a. identifiers.

b. constant variables.c

. floating point variables.

d. mnemonic variables.  

QUES.. The name of a variable is known as its _______________.

a. identifier.

b. constant.

c. data type.

d. base.

QUES.. What function is used to release the allocated memory space?

a. Deallocate().b. Release ().c. Free ().d. Empty ().

QUES.The general form, of assignment operator is _____ .

  1. variable_name=expression.
  2. datatype=expression.
  3. variable=expression.
  4. datatype=expression1.

QUES.. The compilers convert all operands up to the type of the largest operand are called as ______.

  1. expression.
  2. evaluaton.
  3. typeconversion.
  4. precence.

QUES. ______ variables are permanent variables within their own function or file.

  1. Auto.
  2. Static.
  3. Extern.
  4. Register.

 QUES. A ______ storage specifier is originally applied to variables of type int,char,pointers.

  1. auto.
  2. static.
  3. extern.
  4. register.

ANSWER: D

QUES.. _______ is referred to fixed value that the program may not alter.

  1. Constant.
  2. Variable.
  3. Expression.
  4. Keywords.

ANSWER: A

 QUES._____ is a named location in memory that is used t hold the value that may be modified by the program.

  1. Expression.
  2. Keyword.
  3. Variable.
  4. Identifiers.

ANSWER: C

QUES.A _______defines a new type that links code and data.

  1. array declaration.
  2. class definition.
  3. pointer declaration.
  4. variable declaration.

ANSWER: B

QUES.. A _______ access specifier is needed only when inheritance is involved.

  1. public.
  2. private.
  3. protected .
  4. automatic.

ANSWER: C

QUES.. _______ is the elements of a class that are called member or data member.

  1. Pointer.
  2. Variable.
  3. Character.
  4. Identifier.

ANSWER: B

QUES.A ________ function has access to all private and protected members of the class for which it is a friend.

  1. friend.
  2. member.
  3. nonmember.
  4. void.

QUES.. _______ function allows creating very efficient code.

  1. Friend.
  2. Member.
  3. Inline.
  4. Void.

ANSWER: C

QUES.. _________ is initialized when an object is created.

  1. Constructor.
  2. Destructor.
  3. Array.
  4. Pointer.

ANSWER: A

QUES.. ________ is automatically created when constructors are used.

  1. Objects.
  2. Destructors.
  3. Arrays.
  4. Reference.

ANSWER: B

QUES.. Which of the following type of class allows only one object of it to be created?

  1. Virtual class
  2. Abstract class
  3. Singleton class
  4. Friend class

ANSWER: C

QUES. A _______ defines a class type.

  1. structure.
  2. union.
  3. enumeration.
  4. type def.

ANSWER: A

QUES.. ________ function is a function that calls itself repeatedly.

  1. friend.
  2. inline.
  3. recursive.
  4. member.

ANSWER: C

QUES.. A _______ is an alias or synonym for another variable.

  1. reference.
  2. structure.
  3. pointer.
  4. array.

ANSWER: A

QUES.. ________ is the process of using the same name for two or more functions.

  1. Function Overloading.
  2. Operator Overloading.
  3. Default Function.
  4. Constructors.

ANSWER: A

QUES.. _____ is used to prevent problems when one object is used to initialize others.

  1. Default Constructor.
  2. Parameterized Constructor.
  3. Copy Constructor.
  4. Overloading Operator.

ANSWER: C

QUES.. ________ must be predefined in the C++ compiler

  1. Keywords.
  2. Variables.
  3. Identifiers.
  4. Operators.

ANSWER: D

QUES.. _________ function is not a member of the class which does not have “this” pointer.

  1. Inline.
  2. Friend.
  3. Member.
  4. Void.

ANSWER: B

QUES. The ______ function receives the pointer to the region of memory to be free.

  1. new.
  2. delete.
  3. free.
  4. alloc.

ANSWER: B

QUES.. The -> pointer operator is also called as _____.

  1. class member access.
  2. loc::operator.
  3. element.
  4. object.

ANSWER: A

QUES.. The class that acquires the properties of parent class is called _________ class.

  1. base.
  2. inherited.
  3. derived.
  4. public.

ANSWER: C

QUES.The keyword virtual precedes the inherited _______ specification.

  1. class.
  2. variable.
  3. array.
  4. pointer.

ANSWER: A

QUES.The inherited member access specification is to employ _______ within the derived class.

  1. class declaration.
  2. private declaration.
  3. public declaration.
  4. access declaration.

ANSWER: D

QUES.. The ______ is used to create generic function and classes.

  1. class.
  2. template.
  3. specifier.
  4. identifier.

ANSWER: B

QUES.. The _________ defines a general set of operation that will be applied to various types of data.

  1. generic function.
  2. member function.
  3. function overloading.
  4. operator overloading.

ANSWER: A

QUES.. The function ________ displays its first argument at the tab position requested by its argument.

  1. tab.
  2. out .
  3. tabout.
  4. tab( ).

ANSWER: C

QUES.. The ________ parameter is a standard call by value parameter.

  1. tabout ( ).
  2. tab.
  3. out.
  4. tab ( ).

ANSWER: B

QUES.Which of the following keywords is used to control access to a class member?

  1. Default
  2. Break
  3. Protected
  4. Asm

ANSWER: C

 QUES.. ______ is an implicit parameter to all member functions.

  1. Pointer.
  2. This.
  3. Enum.
  4. Array.

ANSWER:2

QUES.A ________ is an object that contains memory address.

  1. constructor.
  2. destructor.
  3. pointer.
  4. temp.

ANSWER: C

QUES.________ is a unary operator that returns the memory address of its operand.

  1. &.
  2. ++.
  3. _ _.
  4. ||.

ANSWER: A 

QUES.________ is a stream connected to standard output.

  1. cin.
  2. gets.
  3. out.
  4. cout.

ANSWER: D

QUES.The functions that are used to access the file in non-sequential fashion _______ and _____.

  1. seekf( ) , seekp ( ).
  2. seekg( ), seekp( ).
  3. seekp( ), seekf ( ).
  4. beg( ), seekx( ).

ANSWER: B

QUES.. An exception is caught based on its ______.

  1. keyword.
  2. address.
  3. type.
  4. pointer.

ANSWER: C

QUES.The keyword _______ is used to declare a generic function.

  1. generic.
  2. template.
  3. virtual.
  4. friend.

ANSWER: B

 QUES.If an allocation request is not fulfilled ________ exception is thrown.

  1. wrong_alloc.
  2. re_alloc.
  3. malloc.
  4. bad_alloc.

ANSWER: D 

QUES.The ______ keyword brings the members of a namespace into view.

  1. view.
  2. using.
  3. additive.
  4. show.

ANSWER: B 

QUES.. ________ determines the type of an object at the runtime.

  1. Static.
  2. Dynamic.
  3. Typeid.
  4. Typedef.

ANSWER: C

QUES.. The current position of each file pointer using the functions _____ and _____.

  1. pos_type tellg( ), pos_type tellp( ).
  2. pos_type tellx( ), pos_type tellf( ).
  3. pos_type tellx( ), pos_type tellp( ).
  4. pos_type tellf( ), pos_type tellp( ).

ANSWER: A

QUES.The ______ is the function that detects the end of file.

  1. eof( ).
  2. getline( ).
  3. putline( ).
  4. clear( ).

ANSWER: A

QUES.The ___ manipulator skips leading whitespaces.

  1. sw.
  2. ws.
  3. wt.
  4. skipws.

ANSWER: B 

QUES.. The ______ is a short function that gets or sets the value of a private instance variable.

  1. inline.
  2. friend.
  3. accessor.
  4. void.

ANSWER: C

QUES.. To rethrow an exception ______ is specified.

  1. throw without a value.
  2. catch with a value.
  3. rethrow.
  4. catch without a value.

ANSWER: A

QUES.. C++ was developed by___.

  1. Dr. Bjarne stroustrup.
  2. Dennis Ritc
  3. Borland.
  4. ANSI.

ANSWER: A

QUES.. The ____ is the standard input/ouput library in C++.

  1. stdio.
  2. iostream.
  3. conio.
  4. std.

ANSWER: B

QUES.. The _____ is predefined identifier that is linked to console output

  1. out.
  2. print.
  3. cin.
  4. cout.

ANSWER: D

QUES.. A ____ is a storage location that contains data value.

  1. function.
  2. structure.
  3. variable.
  4. key word.

ANSWER: C

QUES.. _____ is the data type that can accommodate char that require more than 8-bits.

  1. char.
  2. wchar_t.
  3. w char.
  4. char_t.

ANSWER: B

QUES.. ______ object is used to print wide characters.

  1. wout.
  2. print.
  3. w_cout.
  4. cout.

ANSWER: A

QUES.Which of the following is not true about constants in c++?

  1. It is also called literals.
  2. It has not compiled place in memory.
  3. It s value cannot be changed.
  4. The address value cannot be of constant data type

QUES.The escape sequence \onn represents _______.

  1. back space.
  2. new line.
  3. octal number.
  4. hexadecimal number.

ANSWER: C

  1. Which of the following is the proper keyword to allocate memory?
  2. new.
  3. malloc.
  4. create.
  5. value 

QUES.Which of the following is the proper keyword to deallocate memory?

  1. free.
  2. delete.
  3. clear.
  4. remove.

ANSWER: A

 QUES.A variable that receives an assigned value is called an___________.

  1. l value.
  2. r value.
  3. value.
  4. assignment.

ANSWER: A

 QUES.. >> is called as __________ operator.

  1. insertion.
  2. extraction.
  3. greater than.
  4. lesser than.

ANSWER: B

 QUES.. The ____________ operation returns the remains of a divisions operation .

  1. . !.
  2. &&.
  3. %.
  4. /.

ANSWER: C

QUES.. ____________ operation inserts zero bits into low order bits of result.

  1. shift.
  2. shifting left.
  3. shifting right.
  4. append.

ANSWER: B

 QUES.. Which of the following is invalid assignment operator?

  1. -=.
  2. &=.
  3. ^=.
  4. *=.

ANSWER: C

 QUES.Which one of the following is the conditional operator?

  1. ?: .
  2. ?: =.
  3. :?.
  4. ?=.

ANSWER: A

 QUES.Which on of the following has the highest precedence?

  1. %.
  2. ( ).
  3. ||.
  4. ?:.

ANSWER: B

 QUES.. ___________ is not a type of scope in c++.

  1. global.
  2. local.
  3. file.
  4. function.

ANSWER: D

QUES.When local & global variable have same name to refer global variable_____________ operator is used.

  1. ? :
  2. :
  3. : :
  4. <<

ANSWER: C

QUES.. The result of a relational or logical expression is of type _________.

  1. integer.
  2. float.
  3. boolean.
  4. character.

ANSWER: c

QUES.. A _____________ local variable preserves its variable between function calls.

  1. extern.
  2. static.
  3. register.
  4. auto.

ANSWER: B

QUES.The ____ storage class is the only request to the compiler.

  1. xtern.
  2. static.
  3. register.
  4. auto.

ANSWER: C

QUES.. Which one of the following is correct assignment of the variable min to zero?

  1. min = = 0;
  2. min =+ 0
  3. min = 0;
  4. min ++ 0

ANSWER: C

QUES.To what device is cin linked by default?

  1. printer.
  2. keyboard.
  3. CPU.
  4. mouse.

ANSWER: B

QUES.. ____ is the output operator.

  1. >>.
  2. <.
  3. >.
  4. <<.

ANSWER: D

QUES.. Which one of the following is invalid variable name?

  1. 1count.
  2. count.
  3. counta.
  4. count_a.

ANSWER: A 

QUES.. A/An ________ integer can hold both positive and negative values.

  1. unsigned.
  2. positive.
  3. negative.
  4. signed.

ANSWER: D

QUES.. The primary difference between float and double is in the ____ of the value they hold.

  1. address.
  2. magnitude.
  3. sign.
  4. decimal point.

ANSWER: B

 QUES.The _____ type specifies a valueless expression.

  1. int.
  2. float.
  3. bool.
  4. void.

ANSWER: D

 QUES.. _____ is the escape sequence that causes a backspace.

  1. \b.
  2. \s.
  3. \bs.
  4. \ba.

ANSWER: A

QUES.The specification of the number 100 as long int is _____.

  1. L100.
  2. 100.
  3. 100L.
  4. 100I.

ANSWER: C

 

 

QUES.Which of the following concepts means determining at runtime what method to invoke?

  1. Data hiding
  2. Dynamic Typing
  3. Dynamic binding
  4. Dynamic loading

ANSWER: C

 

QUES.. The automatic conversion of all char and short int values to int is called _______.

  1. integral promotion.
  2. type promotion.
  3. value promotion.
  4. cast.

ANSWER: A

QUES.The operands converted up to the type of largest operands are called _____.

  1. integral promotion.
  2. type promotion.
  3. value promotion.
  4. cast.

ANSWER: B

QUES.. The variables in an array are called its _____.

  1. data.
  2. index.
  3. elements.
  4. subscripts.

ANSWER: C

QUES.. The elements of an array can be accessed by providing integer expression called ____.

  1. superscripts.
  2. elements.
  3. values.
  4. subscripts.

ANSWER: D

QES.. The second element of the array int zones[5]= { 43,54,56,76,78} can be accessed by ________.

  1. zones[2].
  2. zones[1].
  3. zones[3].
  4. zones[4].

ANSWER: B

QUES.The declaration of a two dimensional array called list with dimensions 4 X 9 is represented as _____.

  1. int list [4] [9].
  2. int list [9][4].
  3. int list [4,9].
  4. int list[9,4].

ANSWER: A

QUES.. In a two dimensional array called list with dimensions 4 X 9 the element 2,3 can be accessed by using the expression _____.

  1. list[3][2].
  2. list[2,3].
  3. list[2][3].
  4. list[3,2].

ANSWER: C

QUES.. The size of operator returns the size of variable or type in _____.

  1. bits.
  2. nibble.
  3. bytes.
  4. char.

ANSWER: C

QUES.. Size of operator is _______ operator.

  1. compile time.
  2. intrinsic.
  3. extraction.
  4. ternary.

ANSWER: A 

QUES.. A reference parameter is declared by proceeding with ______.

  1. *.
  2. &.
  3. &&.
  4. ~.

ANSWER: B

QUES.. When a function returns a reference it ______.

  1. returns an implicit pointer to its return value.
  2. displays that pointer.
  3. returns the value referring to it.
  4. does not return anything.

ANSWER: A

QUES.. Which of the following is not true with the reference variable?

  1. References eliminate the overhead associated with passing large data structures as parameters.
  2. It cannot be used to reduce complex notation.
  3. References eliminate pointer dereference notation.
  4. It is a copy alias for another variable.

ANSWER: B

QUES.. The ____ storage class is used to declare reference variable.

  1. register.
  2. static.
  3. extern.
  4. auto.

ANSWER: C

QUES.If and the switch statements are called as _____ statements.

  1. iteration.
  2. jump.
  3. selection.
  4. conditional.

ANSWER: C

QUES.The conditional expressions are evaluated from _____.

  1. top down.
  2. bottom up.
  3. middle.
  4. end.

ANSWER:A

QUES.______ provides multiway branching.

  1. for.
  2. if.
  3. if else.
  4. switch.

ANSWER: D

QUES.. Variables that are declared, but not initialized, contain _______.

  1. blank spaces.
  2. zeros.
  3. “garbage” values.
  4. nothing – they are empty.

ANSWER: C

QUES.The switch expression must be of type _______ or _______.

  1. char,float.
  2. float,int.
  3. int, char.
  4. char, float.

ANSWER: C

QUES.. The code and data are called ______ of the class.

  1. instances.
  2. instance variables.
  3. members.
  4. object.

ANSWER: C

QUES.The ______is contained in instance variable defined by the class.

  1. data.
  2. code.
  3. object.
  4. function.

ANSWER: A

 

QUES.. Code is contained in _____ of the class.

  1. object.
  2. template.
  3. function.
  4. array.

ANSWER: C

QUES.. ___ operator links the name of the object with the name of the member.

  1. ->
  2. .(Dot)
  3. &
  4. *

ANSWER: B

QUES.. Each object has its own copies of the class _______.

  1. data.
  2. code.
  3. function.
  4. instance variables.

ANSWER: D

QUES.____ operator links a class to a member.

  1. : :
  2. .
  3. ->.
  4. *.

ANSWER: A

 UES.. C++ programs start their execution at _______.

  1. start().
  2. begin().
  3. main().
  4. output().

ANSWER: C

 

QUES.The _____ function is a short function that gets or sets the value of a private instance variable.

  1. inline.
  2. accessor.
  3. member.
  4. recursive.

ANSWER: B

 

QUES. Inline is a ____

  1. command.
  2. statement.
  3. request.
  4. class.

ANSWER: C

QUES.The ___ functions are implementation independent.

  1. inline.
  2. accessor.
  3. member.
  4. recursive

ANSWER: A

QUES.A ___ declaration defines a new type that links code and data.

  1. class.
  2. array.
  3. pointer.
  4. variable.

ANSWER: A

QUES.. A ________ converts from an object of the type of the constructor parameter to an object of the class.

  1. conversion function.
  2. member function.
  3. class conversion.
  4. conversion constructors.

ANSWER: D

QUES.________ function converts an object of the class in which you define the function to an object of different data type.

  1. conversion function.
  2. member function.
  3. class conversion.
  4. conversion constructors.

ANSWER: C 

QUES.An _____ is an instance of class.

  1. class.
  2. object.
  3. variable.
  4. pointer.

ANSWER: B

QUES.. Public, private, protected are ______.

  1. identifiers.
  2. keywords.
  3. access specifiers.
  4. type of class.

ANSWER: C

QUES.The ______ access specifier allows functions or data to be accessible to other parts of the program.

  1. private.
  2. protected.
  3. public.
  4. inherited.

ANSWER: C

QUES.. The protected access specifier is needed only when _______ is needed.

  1. inline function.
  2. file.
  3. friend function.
  4. inheritance.

ANSWER: D

 QUES.. The __________ member variable cannot have an initializer.

  1. static.
  2. non-static.
  3. auto.
  4. register.

ANSWER: B

 QUES.A structure defines a _______ type.

  1. class.
  2. pointer.
  3. arrays.
  4. variables.

ANSWER: A

 QUES.. One of the methods to stop the execution of the function is by calling the standard ________ function.

  1. goto.
  2. jump.
  3. stop.
  4. exit.

ANSWER: D

QUES.What is a Constructor?

  1. A function called when an instance of a class is initialized.
  2. A function that is called when an instance of a class is deleted.
  3. A special function to change the value of dynamically allocated memory.
  4. A function that is called in order to change the value of a variable.

ANSWER: A

 QUES.The ______ term refers to the value that is used to call a function.

  1. parameter.
  2. argument.
  3. variable.
  4. pointer.

ANSWER: B

 QUES.. A ______ is a variable that receives the value.

  1. argument.
  2. parameter.
  3. variable.
  4. array.

ANSWER: B

QUES.. The _____ is the variables that contain the address of other variables.

  1. function.
  2. string.
  3. pointer.
  4. identifier.

ANSWER: C

QUES.. ____operator returns the address of the identifier.

  1. &.
  2. *.
  3. &&.
  4. !.

ANSWER: A

QUES.The ________ operator is used to return the value of the variable to which the pointer points.

  1. reference.
  2. dereference.
  3. dot.
  4. arrow.

ANSWER: B

 

 

QUES.A structure pointer points to an/a ________ of its structure type.

  1. variable.
  2. address.
  3. keyword.
  4. instance.

ANSWER: D

QUES.. Which of the following is the proper declaration of a pointer?

  1. int x;
  2. int &x;
  3. ptr x;
  4. int *x;

ANSWER: D

QUES.Which of the following gives the memory address of integer variable a;?

  1. *a;
  2. a;
  3. &a;
  4. address(a);

ANSWER: C

QUES.Which of the following gives the memory address of a variable pointed to a pointer a?

  1. *a;
  2. a;
  3. &a;
  4. address(a);

ANSWER: A

QUES.Which of the following gives the value stored at the address pointed to by the pointer a?

  1. a;
  2. val(a);
  3. *a;
  4. &a;

ANSWER: C

QUES.Which of the following is the proper keyword to allocate memory?

  1. New.
  2. Malloc.
  3. Create.
  4. Value.

ANSWER: B

QUES.. Which of the following is the proper keyword to deallocate memory?

  1. Free.
  2. Delete
  3. Clear.
  4. Remove.

ANSWER: A

QUES.A derived class __________.

  1. inherits data members and member functions from base class.
  2. inherits constructors and destructor.
  3. object can access protected members with the dot operator.
  4. inherits data members and member functions from base class as well as Inherits constructors and destructor.

ANSWER: D

QUES.. The _________is a relationship.

  1. polymorphism.
  2. inheritance.
  3. overloading.
  4. overriding.

ANSWER:B

QUES.The data members of ______ share the same memory.

  1. union.
  2. structure.
  3. function.
  4. class.

ANSWER: A

 QUES.For a binary member operator function, the left operand is passed through _____ .

  1. pointer.
  2. reference.
  3. this.
  4. parameter.

ANSWER: C

QUES.A ________ function is a function that has no body inside its base class.

  1. inline.
  2. friend.
  3. constructor.
  4. pure virtual.

ANSWER: D 

QUES.. A generic function is created using the keyword ______.

  1. template.
  2. generic.
  3. friend.
  4. class.

ANSWER: A

QUES.A generic function is also called as ________.

  1. friend function.
  2. template function.
  3. virtual function.
  4. special function.

ANSWER: B

QUES.. The specific version of the generic function created by the compiler is called as ______.

  1. specialization.
  2. generalization.
  3. general function.
  4. template function.

ANSWER: A

QUES.. A class that is inherited is called as _________ class.

  1. derived.
  2. child.
  3. base.
  4. abstract.

ANSWER: C

QUES.The pure virtual function represents the _______.

  1. inheritance.
  2. overloading.
  3. overriding.
  4. interface.

ANSWER: D

QUES.. Which of the following is not a correct variable type?

  1. float.
  2. real.
  3. switch.
  4. double.

ANSWER: C

QUES.Which of the following is the correct operator to compare two variables?

  1. :=.
  2. v
  3. equal.
  4. = =.

ANSWER: D

QUES.. Which of the following is the boolean operator for logical-and?

  1. &.
  2. &&.
  3. |.
  4. |&.

ANSWER: B

QUES.. The directives for the pre-processors begin with _______.

  1. ampersand symbol (&).
  2. b. two Slashes (//).
  3. C. number Sign (#).
  4. less than symbol (<).

ANSWER: C

QUES.A continue statement causes execution to skip to________.

  1. the return 0; statement.
  2. the first statement after the loop.
  3. the statement following the continue statement.
  4. the next iteration of the loop.

ANSWER: D

QUES.. Set precision requires the ________ header file.

  1. stdlib.h.
  2. iomanip.h.
  3. console.h.
  4. conio.h.

ANSWER: B 

QUES.The memory address of the first element of an array is called ______.

  1. floor address.
  2. foundation address.
  3. first address.
  4. base address.

ANSWER: D

QUES.. A variable P is called pointer if ______.

  1. P contains the address of an element in DATA.
  2. P points to the address of first element in DATA
  3. P can store only memory addresses
  4. P contain the DATA and the address of DATA

ANSWER: A

QUES.You have a variable myNum that has the value 5. You want to print your variable to the screen. How would you do it?

  1. cout<< “My number is”, myNum << endl;
  2. cout<< “My number is 5” << endl;
  3. cout<< My number is << myNum << endl;
  4. cout<< “My number is” << myNum << endl;

ANSWER:

QUES.. ________ must be predefined in the C++ compiler.

  1. Keywords.
  2. Variables.
  3. Identifiers.
  4. Operators.

ANSWER: D

QUES.The escape sequence \onn represents

  1. back space.
  2. new line.
  3. octal number.
  4. hexadecimal number.

ANSWER: C

QUES.. Find out the error in following code. If (x = 100)

  1. 100 should be enclosed in quotations.
  2. There is no semicolon at the end of first line.
  3. Equals to operator mistake.
  4. Variable x should not be inside quotation.

ANSWER: C

QUES.. Looping in a program means _________.

  1. jumping to the specified branch of program.
  2. repeat the specified lines of code.
  3. testing for the condition.
  4. jumping without checking the condition.

ANSWER: B

QUES.. Which of the following term is used for a function defined inside a class?

  1. Member Variable
  2. Member function
  3. Class function
  4. Classic function

ANSWER: B

QUES.. Which of the following is not a valid statement regarding stringstream?

  1. Stringstream is defined in the header file <sstream>.
  2. It allows string based objects treated as stream.
  3. It is especially useful to convert strings to numerical values and vice versa.
  4. none of above.

ANSWER: D

QUES.. Which of the header file must be included to use stringstream?

  1. <iostream>.
  2. <string>.
  3. <sstring>.
  4. <sstream>.

ANSWER: D

QUES.Which of the following header file does not exist?

  1. <iostream>.
  2. <string>.
  3. <sstring>.
  4. <sstream>.

ANSWER: C

QUES.Which of the following is not the member of class?

  1. Static function
  2. Friend function
  3. Const function
  4. Virtual function

ANSWER: B

QUES.Which of the following is not a reserve keyword in C++?

  1. mutable.
  2. default.
  3. readable.
  4. volatile.

ANSWER: D

QUES.. The size of following variable is not 4 bytes in 32 bit systems is _______.

  1. int.
  2. long int .
  3. short int.
  4. float.

ANSWER: C

QUES.. How many instances of an abstract class can be created?

  1. 1
  2. 13
  3. 5
  4. 0

ANSWER: D 

QUES.. Which of the following is not a valid escape code?

  1. \t.
  2. \v.
  3. \f.
  4. \w.

ANSWER: D

QUES.What is the correct value to return to the operating system upon the successful completion of a program?

  1. 2.
  2. 1.
  3. 0.
  4. programs do not return a value.

ANSWER: C

QUES.. What punctuation is used to signal the beginning and end of code blocks?

  1. { }.
  2. -> and <-.
  3. BEGIN and END.
  4. ( and ).

ANSWER: A

QUES.The file iostream includes __________.

  1. the declarations of the basic standard input-output library.
  2. the streams of includes and outputs of program effect.
  3. both of these
  4. none of these.

ANSWER: A 

QUES.. Every function in C++ is followed by ________.

  1. parameters.
  2. parenthesis.
  3. curly braces.
  4. none of these.

ANSWER: B

QUES.Which of the following is false?

  1. cout represents the standard output stream in c++.
  2. cout is declared in the iostream standard file.
  3. cout is declared within the std namespace.
  4. none of above.

ANSWER: D

QUES.Every statement in C++ program should end with a _______.

  1. full stop (.).
  2. comma (,).
  3. semicolon (;).
  4. colon (:).

ANSWER: C

QUES.Which of the following statement is true about preprocessor directives?

  1. these are lines read and processed by the pre-processor.
  2. they do not produce any code by themselves.
  3. these must be written on their own line.
  4. they end with a semicolon.

ANSWER: D

QUES.. When writing comments you can _______.

  1. use code and /* comment on the same line.
  2. use code and // comments on the same line.
  3. use code and //* comments on the same line.
  4. use code and <!- comments on the same line.

ANSWER: B

QUES.. Which of the following can not be used as identifiers?

  1. letters.
  2. digits.
  3. underscores.
  4. spaces.

ANSWER: D 

QUES.Which of the following identifiers is invalid?

  1. papername.
  2. writername.
  3. typename.
  4. printname.

ANSWER: C

QUES.Which of the following is not a looping statement in C?

  1. while.
  2. until.
  3. do.
  4. for.

ANSWER: B

 QUES.In C++, 14 % 4 = ________.

  1. 1.
  2. 2.
  3. 3.
  4. 4.

ANSWER: B

 QUES.Which of the following is not a jump statement in C++?

  1. break.
  2. goto.
  3. exit.
  4. switch.

ANSWER: D

 QUES.When using a built-in function, you must _________.

  1. include the function’s prototype.
  2. include the proper header file.
  3. include the function’s definition.
  4. specify the length of the library function.

ANSWER: D

QUES.The library function isalpha( ) requires the header file ____.

  1. <ctype.h>.
  2. <math.h>.
  3. <time.h>.
  4. <stdlib.h>.

ANSWER: A

QUES.The built-in library function isalnum( ) is testing to determine if the argument is ___.

  1. one of “all” numbers available from the keyboard.
  2. an alphabet character.
  3. an ASCII character.
  4. an alphanumeric.

ANSWER: D

QUES.The built-in library function ceil(x) requires the _______ header file.

  1. <ctype.h>.
  2. <math.h>.
  3. <stdlib.h>.
  4. <time.h>.

ANSWER: B

QUES.. To raise any number to a power, _______ is used.

  1. the exponent symbol ^.
  2. the built-in library function pow(x,y).
  3. the built-in library function pow10(x).
  4. concatenation.

ANSWER: B

QUES.. Time_t is a ____.

  1. variable used to hold a number from the computer’s internal clock.
  2. data type
  3. built-in library function which will return a value from the internal clock.
  4. header file.

ANSWER: B 

QUES.. The rand( ) built-in library function _____.

  1. is a true random number generator.
  2. returns positive double values.
  3. is a pseudo-random number generator.
  4. returns a different sequence of values each time it is run.

ANSWER: C

QUES.The purpose of the code answer = toupper(ans); is to ensure that _________.

  1. answer will be rounded to the next larger integer.
  2. the first letter in answer will be a capital letter.
  3. answer will contain all capital letters.
  4. answer will contain no numeric values.

ANSWER: C 

QUES.. Which type of data file is analogous to an audio cassette tape?

  1. random access file
  2. sequential access file
  3. binary file
  4. source code file

ANSWER: B

QUES.Which of the following header files is required for creating and reading data files?

  1. ofstream.h.
  2. fstream.h.
  3. ifstream.h.
  4. console.h.

ANSWER: B

QUES.. The continue statement _____.

  1. resumes the program if it is hanged.
  2. resumes the program if it was break was applied.
  3. skips the rest of the loop in current iteration.
  4. executes the entire iteration.

ANSWER: C

QUES.The code ifstream fin; would be used when _______.

  1. creating a file.
  2. reading a file.
  3. appending a file.
  4. removing a file.

ANSWER: B

 QUES.The conditional compilation __________.

  1. is taken care of by the compiler.
  2. is setting the compiler option conditionally.
  3. is compiling a program based on a condition.
  4. none of the above.

ANSWER: C

QUES.. Which of the following language is a subset of C++ language?

  1. C language.
  2. Java Language.
  3. C# language.
  4. B language.

ANSWER: A

QUES.. Which of the following correctly describes C++ language?

  1. Statically typed language.
  2. Dynamically typed language.
  3. Both Statically and dynamically typed language.
  4. Type-less language.

ANSWER: A 

QUES.Which of the following keyword supports dynamic method resolution?

  1. Abstract.
  2. Virtual.
  3. Dynamic.
  4. Typeid.

ANSWER: B

QUES.. Which of the following concept is not supported by C++?

  1. Exception Handling.
  2. Reflection.
  3. Operator Overloading.
  4. Namespaces.

ANSWER: B

QUES.Which of the following language feature is not an access specifier in C++?

  1. Public.
  2. Private.
  3. Protected.
  4. Internal.

ANSWER: D

QUES.What does STL stand for?

  1. Simple Template Library.
  2. Standard Template Library.
  3. Static Type Library.
  4. Single Type-based Library.

ANSWER: B

 QUES.Which of the following is the most common way of implementing C++?

  1. A. C++ programs are directly compiled into native code by a compiler.
  2. C++ programs are first compiled to intermediate code by a compiler and then executed by a virtual machine.
  3. C++ programs are interpreted by an interpreter.
  4. A C++ editor directly compiles and executes the program.

ANSWER: A

QUES.What is the implicit pointer that is passed as the first argument for non-static member functions?

  1. self pointer.
  2. std::auto_ptr pointer.
  3. Myself pointer.
  4. this pointer.

ANSWER: D

 QUES.. If X is the name of the class, what is the correct way to declare copy constructor of X?

  1. X(X arg).
  2. X(X* arg).
  3. X(const X* arg).
  4. X(const X& arg).

ANSWER: D

QUES.. Which of the following operator cannot be overloaded?

  1. = (assignment operator).
  2. == (equality operator).
  3. -> (rrow operator).
  4. :: (cope resolution operator).

ANSWER: D

QUES.Which of the following operators can be overloaded?

  1. .(dot or member access operator).
  2. & (address-of operator).
  3. sizeof operator.
  4. ?: (conditional operator).

ANSWER: B

QUES.. How do we declare an abstract class?

  1. By providing at least one pure virtual method in a class.
  2. By declaring at least one method abstract using the keyword abstract in a class.
  3. By declaring the class abstract with the keyword abstract.
  4. It is not possible to create abstract classes in C++.

ANSWER: A

 QUES.How do we declare an interface class?

  1. By making all the methods pure virtual in a class.
  2. By making all the methods abstract using the keyword abstract in a class.
  3. By declaring the class as interface with the keyword interface.
  4. It is not possible to create interface class in C++.

ANSWER: A

QUES.. How many copies of a class static member are shared between objects of the class?

  1. A copy of the static member is shared by all objects of a class.
  2. A copy is created only when at least one object is created from that class.
  3. A copy of the static member is created for each instntiation of the class.
  4. No memory is allocated for static members of a class.

ANSWER: A

QUES.. Which of the following is true about const member functions?

  1. const members can be invoked on both const as well as nonconst objects.
  2. const members can be invoked only on const objects and not on nonconst objects.
  3. nonconst members can be invoked on const objects as well as nonconst objects.
  4. none of the above.

ANSWER: A

QUES.When is std::bad_alloc exception thrown?

  1. When new operator cannot allocate memory.
  2. When alloc function fails.
  3. When type requested for new operation is considered bad, this exception is thrown.
  4. When delete operator cannot delete teh allocated (corrupted) object.

ANSWER: A 

QUES.. Which header file should we include for using std::auto_ptr?

  1. <memory>.
  2. <alloc>.
  3. <autoptr>.
  4. <smartptr>.

ANSWER: A

QUES.. Which of the following correctly describes the meaning of namespace feature in C++?

  1. Namespaces refer to the memory space allocated for names used in a program.
  2. Namespaces refer to space between the names in a program.
  3. Namespaces refer to space between the names in a program.
  4. Namespaces provide facilities for organizing the names in a program to avoid name clashes.

ANSWER: D

QUES.____________ operation inserts zero bits into low order bits of result.

  1. Shift.
  2. Shifting left.
  3. Shifting right.
  4. Append.

ANSWER: B

QUES.The eof( ) is the function used for_____.

  1. asserting no errors in a file.
  2. appending data to a file.
  3. counting the amount of data in a file.
  4. checking for end of file.

ANSWER: D

QUES.. Minimum number of temporary variable needed to swap the contents of 2 variables is ________.

  1. 1.
  2. 4.
  3. 2.
  4. 0.

ANSWER: D

QUES.. A direct access file is _______.

  1. a file in which records are arranged in a way they are inserted in a file.
  2. a file in which records are arranged in a particular order.
  3. a file which is stored on a direct access storage medium.
  4. none of the above.

ANSWER: C 

QUES.Which of the following is not an advantage of secondary memory?

  1. It is cost-effective.
  2. It has large storage capacity.
  3. It has highest speed.
  4. It is easily portable.

ANSWER: C

 QUES.How many objects can be created from an abstract class?

  1. Zero
  2. One
  3. Two
  4. As many as we want

ANSWER: A 

QUES.Which of the following is not a file operation?

  1. Repositioning.
  2. Truncating.
  3. Readable.
  4. Appending.

ANSWER: C

QUES.. Which of the following is not a component of file system?

  1. Access method.
  2. Auxiliary storage management.
  3. Free integrity mechanism.
  4. None of the above.

ANSWER: D 

QUES.. Which of the following concepts means wrapping up of data and functions together?

  1. Abstraction
  2. Encapsulation
  3. Inheritance
  4. Polymorphism

ANSWER: B

QUES.. Which of the following is correct about function overloading?

  1. The types of arguments are different.
  2. The order of argument is different.
  3. The number of argument is same.
  4. Both A and B.

ANSWER: D

QUES.Which of the following concepts means waiting until runtime to determine which function to call?

  1. Data hiding
  2. Dynamic casting
  3. Dynamic binding
  4. Dynamic loading

ANSWER: C

QUES.Which of the following is an abstract data type?

  1. int
  2. double
  3. string
  4. Class

ANSWER: D

QUES.. cout is a/an __________ .

  1. operator
  2. function
  3. object
  4. macro

ANSWER: C 

QUES.. Which of the following approach is adapted by C++?

  1. Top-down
  2. Bottom-up
  3. Right-left
  4. Left-right

ANSWER: B

QUES.. How “Late binding” is implemented in C++?

  1. Using C++ tables
  2. Using Virtual tables
  3. Using Indexed virtual tables
  4. Using polymorphic tables

ANSWER: B

 QUES.. A ______ is a variable that receives the value.

  1. datatype.
  2. parameter.
  3. variable.
  4. array.

ANSWER: B

 QUES.Value of ix+j, if i,j are integer type and ix long type would be _____.

  1. integer.
  2. float.
  3. long integer.
  4. double precision.

ANSWER: C

 QUES.. ____ is the standard input/output library in C++.

  1. stdio.
  2. iostream.
  3. conio.
  4. std.

ANSWER: B 

QUES.. ____ operator links a class to a member.

  1. : :
  2. . .
  3. ->.
  4. *.

ANSWER: A

 QUES.A _____ is an instance of class.

  1. class.
  2. object.
  3. variable.
  4. pointer.

ANSWER: B

QUES.. How many types of polymorphisms are supported by C++?

  1. 1
  2. 2
  3. 3
  4. 4

ANSWER: B

QUES.. What punctuation ends most lines of C++ code?

  1. . (dot).
  2. ; (semi-colon).
  3. : (colon).
  4. ‘ (single quote).

ANSWER: B

CLICK  HERE ON THE BELOW LINK:

FOCUSSING ON SOME MORE MCQS FOR PRACTICE

4 thoughts on “C++ Mcqs”

Leave a Comment