C++ Important Questions

C++ Important Questions

001.Q> Who is the developer of C++
  1. James Gosling
  2. Bjarne Stroustrup
  3. Mark
  4. None
002.Q> C++ is a ___ Language
  1. Assembly
  2. Procedural
  3. OPP
  4. All of Above
003.Q> C++ programs are converted into machine language with the help of —  
  1. Interpreter
  2. Assembler
  3. Linker
  4. Compiler
004.Q> Pre-processor commands starts with ____
  1. *
  2. &
  3. #
  4. %
005.Q> How many key words in C++ ?
  1. 32
  2. 48
  3. 63
  4. None
006.Q> In C++, Const is a ___
  1. Keyword
  2. variable
  3. function
  4. datatype
007.Q> In C++ every statements ends with _____
  1. colon (:)
  2. comma (,)
  3. dot (.)
  4. Semicolon (;)
008.Q> You can never use address of ________ variable?
  1. global
  2. static
  3. auto
  4. register
009.Q> The default storage for local variable is _____
  1. auto
  2. static
  3. extern
  4. register
010.Q> How many loops are in C++
  1. 0
  2. 3 (for,dowhile, while)
  3. 1
  4. 2
011.Q> In c++, we used for Input/output —
  1. input/output
  2. printf/scanf
  3. in/out
  4. cin /cout (Console input /output)
012.Q> C++ is am extension to _____ programming language
  1. pascal
  2. java
  3. C (Super set of c Language)
  4. B
013.Q> In C++ programming endl is used for ________
  1. Form feed
  2. Line brake
  3. vertical tab
  4. none
014.Q> C++ programming is used to develop _______
  1. Games
  2. Desktop apps
  3. OS
  4. All of above
015.Q> Which of the following is a abstract Datatype?
  1. Int
  2. float
  3. string
  4. class
016.Q> Which operator is overloaded for a cout object?
  1. <<
  2. >> 
017.Q> Which Datatype is best suited to represent logical values?
  1. int
  2. char
  3. Boolean
  4. float
018.Q> Identify the User defined types___
  1. enumeration
  2. classes
  3. Both a & b
  4. int
019.Q> While loop is a _______ controlled loop
  1. count
  2. exit
  3. entry
  4. none
020.Q> do-while is a _______ controlled loop
  1. count
  2. exit
  3. entry
  4. none
021.Q> for loop is a ___ controlled loop
  1. count
  2. exit
  3. entry
  4. none
022.Q> C++ is a __ programming language
  1. platform dependent (its runs only on the specified system where program is written)
  2. platform independent
  3. os
  4. none
023.Q> In which year, C++ was developed?
  1. 1980’s                                 (1979)                  
  2. 1972
  3. 1998
  4. 2000
024.Q> In C++ ‘&’ is called___
  1. Value
  2. Address of operator
  3. And operator
  4. none
025.Q> In C++ ‘&&” called ___
  1. Logical AND
  2. Logical OR
  3. Logical Not
  4. none
026.Q> How many character are  specified in the ASCII scheme?
  1. 64
  2. 128
  3. 256
  4. none
027.Q> How many types of comments are there in C++?
  1. one
  2. two
  3. three
  4. four
028.Q> What is the default return value of functions?
  1. int
  2. char
  3. void
  4. float
029.Q> Function overloading is also similar to___
  1. operator overloading
  2. constructor overloading
  3. Destructor overloading
  4. none
030.Q> Which keyword is used to define the macros in C++?
  1. macro
  2. define
  3. #define
  4. #typedef
031.Q> How many types of macros are there in C++?
  1. one
  2. two
  3. three
  4. four
032.Q> How many types of Exception Handling in C++?
  1. one
  2. two
  3. three
  4. four
033.Q> Which of the following is logical NOT operator?
  1. &&
  2. ||
  3. !
  4. not
034.Q> How many logical operator are their in C++?
  1. 0
  2. 1
  3. 2
  4. 3
035.Q> “?:” called _______
  1. Arithmetic operator
  2. Conditional /Ternary
  3. Assignment Operator
  4. none
036.Q> In C++ programming : called____
  1. colon
  2. comma
  3. semicolon
  4. dot
037.Q> What is the name of  : : in C++?
  1. Scope resolution Operator
  2. colon
  3. comma
  4. none
038.Q> Which of the following approach is adapted by C++
  1. Top-Down
  2. Bottom-up (Takes bottom class takes the uper class properties
  3. Right-left
  4. Left-Right
039.Q> Which loop executes at once even the given condition is false.
  1. while
  2. do-while
  3. for
  4. for-each
040.Q> In C++ programming array index is always starts
  1. 0
  2. 1
  3. 2
  4. 3
041.Q> Array is a collection of ____ value
  1. Dis-similar
  2. Similar
  3. Hetrogenous
  4. None
042.Q> Which of the following is not a jumping statement?
  1. Break
  2. Continue
  3. goto
  4. cout
043.Q> The use of break statement in a switch statement is ___
  1. optional
  2. compulsory
  3. to check an error
  4. none
044.Q> In c++ programming “\v” is used for____
  1. Form feed
  2. Line brake
  3. Vertical tab
  4. Alarm
045.Q> In C++ comma(,) is a ____
  1. separator
  2. loop
  3. operator
  4. none
046.Q> If an array is declared as int arr[2][2], how many elements can it store?
  1. 0
  2. 2
  3. 4
  4. 8
047.Q> int arr[3], what is the name of  [ ]?
  1. Increment operator
  2. Logical operator
  3. subscript operator
  4. None
048.Q> The size of int arr[5] is ___
  1. 10 bytes
  2. 5 bytes
  3. 2 bytes
  4. none
049.Q> Which is the following is the valid array declaration?
  1. int a[0];
  2. int a[5]={1,2,3,4,5,6,7};
  3. int a[ ];
  4. int a[0] =3;
050.Q> Array is the example of ___
  1. Linear data structure
  2. dynamic
  3. non linear data structure
  4. none
051.Q> Pointer variables holds ___
  1. address = another variable
  2. value
  3. address
  4. all
052.Q> What is the right way to initialize array
  1. int a[5]={1,2,3}; [memory waste – only 3 values are given]
  2. int a[5]={1,2,3,4,5};
  3. int a[2]=3;
  4. All of the above
053.Q> Array elements are always stored in ________ memory location
  1. Sequential
  2. Random
  3. Dynamic
  4. None
054.Q> String always ends with ___
  1. null character
  2. semicolon
  3. colon
  4. comma
055.Q> In C++ programming strlen ( ) function is used for ___
  1. find string length
  2. concat two string
  3. Copy string
  4. None
056.Q> Which of the following is string copy function?
  1. strcpy()
  2. strrev()
  3. strcat()
  4. strlen()
057.Q> Which function concat two string?
  1. strcpy()
  2. strrev()
  3. strcat()
  4. strlen()
058.Q> The keyword used to define a structure is
  1. stru
  2. st-struct
  3. structure
  4. struct
059.Q> The structure definition ends by a ________
  1. :
  2. ;
  3. ::
  4. none
060.Q> Which operator connects the structure name to its member name ?
  1. _
  2. ,
  3. .
  4. ;
061.Q> The size of a union is determined by the size of the ____
  1. First member
  2. Biggest member
  3. last member
  4. none
062.Q> How many union members accessed at a time?
  1. only one
  2. all members
  3. two
  4. all of the above
063.Q> Pointer always work with _____operator
  1. &
  2. *
  3. both a & b
  4. none
064.Q> Which of the following is not a features of C++?
  1. OOP
  2. DMA
  3. Simple
  4. Platform Independent
065.Q> A token is _____________
  1. keyword
  2. An Identifier
  3. Smallest Unit of program
  4. operator
066.Q> ____functions can’t use recursion
  1. parameterized
  2. inline
  3. overloaded
  4. friend
067.Q> Which of the following is allowed in a C++ arithmetic –
  1. { }
  2. [ ]
  3. ( )
  4. None
068.Q> While loop checks the condition on ____
  1. Top
  2. Bottom
  3. Middle
  4. None
069.Q> cout is a /an ____
  1. operator
  2. object
  3. function
  4. Macro
070.Q> A keyword is ___
  1. An identifier
  2. In lower case instructions only
  3. Reserved word
  4. none
071.Q> A member function can be declared static if it does not access ____ members
  1. private
  2. public
  3. non – static
  4. None
072.Q> A character variable can at a time store ____
  1. 1 character
  2. 8 character
  3. 256 character
  4. none
073.Q> Header files have the file extension____
  1. .h
  2. .cu
  3. .cpps
  4. .head
074.Q> Scope resolution operator is ___
  1. :
  2. ,
  3. .
  4. ::
075.Q> I want to read data from the file, which stream I have to use?
  1. ifstream
  2. ofstream
  3. stream
  4. Both A & B
076.Q> A set of arithmatic operators are —
  1. &&, ||, !
  2. ==, !=, >, <, >=, <=
  3. +. -, *, /, %
  4. All of above
077.Q> Which operator has the lowest precedence?
  1. size of
  2. unary
  3. assignment
  4. comma
078.Q> Every function in C++ is followed by_____
  1. { }
  2. ( )
  3. [ ]
  4. none
079.Q> ______ is a way of combining data with function into an object.
  1. Object
  2. Encapsulation
  3. Overload
  4. Polymorphism
080.Q> The minimum value that an integer constant can have is _____
  1. 32767
  2. 32768
  3. -32767
  4. -32768
081.Q> What is the range of integer datatype?
  1. -32768 to 32767
  2. 0 to 255
  3. -127 to 128
  4. -32767 to 32768
082.Q> Which of the following mode declaration is used in c++ to open a file for input?
  1. ios::ap
  2. in::ios
  3. ios::in
  4. ios::file                                
083.Q> The order of evaluation of following expression A+B-C*D/E will be–
  1. *, /, -, +
  2. +, -, *, /
  3. *, /, +, –
  4. All of these
084.Q> Assignment operator is —
  1. =
  2. ++
  3. << 
  4. ==
085.Q> A set of relational operator is —-
  1. +, -, *, /, %
  2. ==, !=, <, >, <=, >=
  3. &&, ||, !
  4. =
086.Q> A set of conditional/ternary  operator is ______
  1. << 
  2. ::
  3. ? :
  4. >> 
087.Q> Which of the following is known as insertion operator —
  1. ^
  2. v
  3. <<
  4. >> 
088.Q> Which of the following is extraction opearator?
  1. ^
  2. v
  3. << 
  4. >>
089.Q> Which one is not a valid relational operator?
  1. ==
  2. =>
  3. >=
  4. <=
090.Q> Which symbol represent for logical AND.
  1. ||
  2. !
  3. &
  4. &&
091.Q> Which of the following is output statement in C++?
  1. cin
  2. cout
  3. output
  4. result
092.Q> To calculate remainder in C++, we use _____
  1. /
  2. &
  3. %
  4. =>
093.Q> To increase the value of ‘a’ by one which of the following statement is wrong?
  1. a++
  2. a=a+1
  3. a+=1
  4. a+1=>a
094.Q> What will be the output of the following condition statement?

int a=15>=15?15:16

  1. 16
  2. 15
  3. 31
  4. none
095.Q> Which of the following is input statement in c++?
  1. cin
  2. cout
  3. input
  4. get
096.Q> A floating point variable contains___
  1. Both integral and fractional part
  2. double
  3. only fractional
  4. none
097.Q> A function which calls itself called___
  1. friend
  2. inline
  3. recursive
  4. main
098.Q> A data structure which contains different datatypes values is called____
  1. Array
  2. string
  3. union
  4. structure
099.Q> In which LAB was developed C++?
  1. Bell Lab
  2. ANSI
  3. SDLC
  4. IBM
100.Q> What was the name of C++ earlier?
  1. C with classes
  2. cpp
  3. c++
  4. ++c
101.Q> OOP stands for___
  1. object oriented programming system
  2. object object programming
  3. OOP
  4. none
102.Q> what is the size of int datatype in C++?
  1. 2
  2. 4
  3. Both A & B
  4. None
103.Q> ASCII value of ‘\0’ (null character) is __
  1. 0
  2. 128
  3. 255
  4. -128
104.Q> In C++, Range of signed char?
  1. 0 to 255
  2. -128 to 127
  3. 127 to -128
  4. 0 to 127
105.Q> In C++, Range of un-signed char?
  1. 0 to 255
  2. -128 to 127
  3. 127 to -128
  4. 0 to 127
106.Q> Example of pre-increment operator –
  1. +a
  2. a++
  3. –a
  4. ++a
107.Q> Which of the following will not return the value?
  1. empty
  2. null
  3. int
  4. void
108.Q> The execution & endling of C++ program begin from ___
  1. start
  2. new( )
  3. main( )
  4. sqrt( )
109.Q> Correct syntax to create a single line comment
  1. //comment
  2. /comment
  3. comment//
  4. none
110.Q> Comments are used to —-
  1. make the program faster
  2. make error free program
  3. To help other’s read nad understand the program
  4. None
111.Q> How many way we can apply comment in C++?
  1. 0
  2. 1
  3. 2
  4. 3
112.Q> Which of the following storage class have global visibility
  1. auto
  2. break
  3. return
  4. extern
113.Q> main () is a / an ____
  1. keyword
  2. function
  3. object
  4. all
114.Q> cin and cout represents ________ header file
  1. math.h
  2. stdlib.h
  3. iostream.h
  4. string.h
115.Q> How many types of macro in C++
  1. 0
  2. 1
  3. 2 (object/function macro)
  4. 3
116.Q> Which of the following is the example of function macro?
  1. #define_m1(r) (3.14)
  2. #define
  3. #define A 14
  4. none
117.Q> which of the following is the example of object macro?
  1. #define_m1(r) (3.14)
  2. #define
  3. #define A 14
  4. none
118.Q> Which block should be placed after try block?
  1. catch
  2. throw
  3. either catch or throw
  4. none
119.Q> How many parameters does the throw expression can have?
  1. 1
  2. 2
  3. 3
  4. 4
120.Q> Which is used to check the error in the block in exception handling?
  1. try
  2. catch
  3. throw
  4. handler
121.Q> Where are the strings stored?
  1. stack
  2. heap
  3. Both a & b
  4. block
122.Q> Which is used to create a pure virtual function?
  1. $
  2. %
  3. !
  4. =0
123.Q> What is meant by polymorphism?
  1. Class having many forms
  2. Class having only single form
  3. Class having two forms
  4. Class having empty
124.Q> What does derived class doesn’t inherit from base class?
  1. constructor
  2. destructor
  3. friends
  4. All of above
125.Q> How to declare a template?
  1. temp
  2. tem
  3. Template<>
  4. Template()
126.Q> How many types of templates in C++
  1. one
  2. two
  3. three
  4. Both a & c
127.Q> Which is used to define a reference variable?
  1. &
  2. $
  3. #
  4. *
128.Q> What does the reference provide?
  1. Alternate name for the class
  2. Alternate name for the function
  3. Alternate name for the variable
  4. Alternate name for the pointer
129.Q> What is the difference between references and pointers?
  1. Both are similar
  2. References are an alias for a variable where as pointer stores the address of variable.
  3. References stores address of variables where as pointer points to variable
  4. Both b & c
130.Q> Which of the following function must used reference?
  1. Default constructor
  2. Parameterized constructor
  3. Copy Constructor
  4. destructor
131.Q> Exceptions are also called____
  1. compile time error
  2. Runtime error
  3. Logical Error
  4. Syntax Error
132.Q> How many types of constructor are their in C++?
  1. 1
  2. 2
  3. 3
  4. 4
133.Q> How many parameters does required default constructor ?
  1. 0
  2. 1
  3. 2
  4. 3
134.Q> C++ class holds ____
  1. data
  2. functions
  3. Both A & B
  4. none
135.Q> Which of the following is not a type of constructor?
  1. operator overloading
  2. default
  3. parametrized
  4. copy
136.Q> Which of the following is a valid class declaration?
  1. class A{ }
  2. class B { } ;
  3. class { }
  4. class A [ ];
137.Q> The data member & member functions of a class are by default____
  1. protected
  2. public
  3. private
  4. struct
138.Q> Which of the following item is used for a function defined inside a class?
  1. member variable
  2. member function
  3. class function
  4. none
139.Q> Inline function are invoked at the time of ___?
  1. runtime
  2. compile time
  3. both
  4. none
140.Q> A member function that is automatically invoked at the time of object declaration is called___
  1. initializer
  2. object creator
  3. constructor
  4. All of above
141.Q> Which of the following concepts determining at runtime what method to invoke?
  1. Data hiding
  2. Dynamic typing
  3. Dynamic binding
  4. Dynamic loading
142.Q> If class X inherits from class Y, then Y is called ___
  1. super class
  2. sub class
  3. abstract
  4. none
143.Q> An instance of a class is called_____
  1. private
  2. object
  3. public
  4. none
144.Q> Destructor has the same name as the constructor and it is preceded by___
  1. !
  2. @
  3. #
  4. ~A []
145.Q> In protected inheritance, A public data member of the class will be treated as a ___
  1. public
  2. private
  3. protected
  4. none
146.Q> Base class is ____
  1. Parent class
  2. Derived Class
  3. Child Class
  4. Nested Class
147.Q> Which of following operator can’s be overloaded?
  1. ::
  2. size of
  3. ?:
  4. All of these
148.Q> Which of the following type of class allows only one object of it created?
  1. Virtual Class
  2. Singleton class
  3. friend class
  4. none
149.Q> A class which contain at least one pure virtual function called____
  1. Abstract class
  2. base class
  3. derived class
  4. singleton class
150.Q> Which of the following not a member of class ?
  1. inline function
  2. virtual function
  3. constructor
  4. friend function
151.Q> Which of the following can’t be inherited from the base class?
  1. constructor
  2. Friend
  3. Both A & B
  4. None
152.Q> Destructor is a ___
  1. Member function
  2. overloaded
  3. Constructor
  4. none
153.Q> Which of the following provides code reusability
  1. inheritance
  2. abstraction
  3. encapsulation
  4. polymorphism
154.Q> In c++ features of oops are ___
  1. inheritance
  2. encapsulation
  3. polymorphism
  4. All of these
155.Q> How many ways to perform polymorphism?
  1. 0
  2. 1
  3. 2
  4. 3
156.Q> Destructor has the same name as constructor and it is preceded by____
  1. !
  2. ~
  3. #
  4. ?
157.Q> Wrapping data & function is a single unit is known as___
  1. Abstraction
  2. Encapsulation
  3. Polymorphism
  4. none
158.Q> Which of the following class allows only to create single object?
  1. Friend class
  2. Abstract class
  3. Singleton class
  4. virtual class
159.Q> What is the other name used for functions inside a class?
  1. Member variable
  2. Member function
  3. Class function
  4. Data Member
160.Q> How run time polymorphism are implemented in C++?
  1. Using inheritance
  2. Using Virtual function
  3. Using templates
  4. Both a & b
161.Q> In OOP abstraction refers to____
  1. Hiding the details
  2. Showing only essential info of the application
  3. Both a & b
  4. Reuse once written code again and again
162.Q> How many types of templates in C++
  1. 0
  2. 1
  3. 2
  4. 3
163.Q> Which of the following is the valid declaration of class template
  1. template class A {}
  2. template {}
  3. Template  class A{…..}
  4. none
164.Q> In base class & derived class function with same signature is called____
  1. overloading
  2. overriding
  3. data hiding
  4. none

2 thoughts on “C++ Important Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

'
WhatsApp us