C++ Important Questions
001.Q> Who is the developer of C++
- James Gosling
- Bjarne Stroustrup
- Mark
- None
002.Q> C++ is a ___ Language
- Assembly
- Procedural
- OPP
- All of Above
003.Q> C++ programs are converted into machine language with the help of —
- Interpreter
- Assembler
- Linker
- Compiler
004.Q> Pre-processor commands starts with ____
- *
- &
- #
- %
005.Q> How many key words in C++ ?
- 32
- 48
- 63
- None
006.Q> In C++, Const is a ___
- Keyword
- variable
- function
- datatype
007.Q> In C++ every statements ends with _____
- colon (:)
- comma (,)
- dot (.)
- Semicolon (;)
008.Q> You can never use address of ________ variable?
- global
- static
- auto
- register
009.Q> The default storage for local variable is _____
- auto
- static
- extern
- register
010.Q> How many loops are in C++
- 0
- 3 (for,dowhile, while)
- 1
- 2
011.Q> In c++, we used for Input/output —
- input/output
- printf/scanf
- in/out
- cin /cout (Console input /output)
012.Q> C++ is am extension to _____ programming language
- pascal
- java
- C (Super set of c Language)
- B
013.Q> In C++ programming endl is used for ________
- Form feed
- Line brake
- vertical tab
- none
014.Q> C++ programming is used to develop _______
- Games
- Desktop apps
- OS
- All of above
015.Q> Which of the following is a abstract Datatype?
- Int
- float
- string
- class
016.Q> Which operator is overloaded for a cout object?
- <<
- >>
- <
- >
017.Q> Which Datatype is best suited to represent logical values?
- int
- char
- Boolean
- float
018.Q> Identify the User defined types___
- enumeration
- classes
- Both a & b
- int
019.Q> While loop is a _______ controlled loop
- count
- exit
- entry
- none
020.Q> do-while is a _______ controlled loop
- count
- exit
- entry
- none
021.Q> for loop is a ___ controlled loop
- count
- exit
- entry
- none
022.Q> C++ is a __ programming language
- platform dependent (its runs only on the specified system where program is written)
- platform independent
- os
- none
023.Q> In which year, C++ was developed?
- 1980’s (1979)
- 1972
- 1998
- 2000
024.Q> In C++ ‘&’ is called___
- Value
- Address of operator
- And operator
- none
025.Q> In C++ ‘&&” called ___
- Logical AND
- Logical OR
- Logical Not
- none
026.Q> How many character are specified in the ASCII scheme?
- 64
- 128
- 256
- none
027.Q> How many types of comments are there in C++?
- one
- two
- three
- four
028.Q> What is the default return value of functions?
- int
- char
- void
- float
029.Q> Function overloading is also similar to___
- operator overloading
- constructor overloading
- Destructor overloading
- none
030.Q> Which keyword is used to define the macros in C++?
- macro
- define
- #define
- #typedef
031.Q> How many types of macros are there in C++?
- one
- two
- three
- four
032.Q> How many types of Exception Handling in C++?
- one
- two
- three
- four
033.Q> Which of the following is logical NOT operator?
- &&
- ||
- !
- not
034.Q> How many logical operator are their in C++?
- 0
- 1
- 2
- 3
035.Q> “?:” called _______
- Arithmetic operator
- Conditional /Ternary
- Assignment Operator
- none
036.Q> In C++ programming : called____
- colon
- comma
- semicolon
- dot
037.Q> What is the name of : : in C++?
- Scope resolution Operator
- colon
- comma
- none
038.Q> Which of the following approach is adapted by C++
- Top-Down
- Bottom-up (Takes bottom class takes the uper class properties
- Right-left
- Left-Right
039.Q> Which loop executes at once even the given condition is false.
- while
- do-while
- for
- for-each
040.Q> In C++ programming array index is always starts
- 0
- 1
- 2
- 3
041.Q> Array is a collection of ____ value
- Dis-similar
- Similar
- Hetrogenous
- None
042.Q> Which of the following is not a jumping statement?
- Break
- Continue
- goto
- cout
043.Q> The use of break statement in a switch statement is ___
- optional
- compulsory
- to check an error
- none
044.Q> In c++ programming “\v” is used for____
- Form feed
- Line brake
- Vertical tab
- Alarm
045.Q> In C++ comma(,) is a ____
- separator
- loop
- operator
- none
046.Q> If an array is declared as int arr[2][2], how many elements can it store?
- 0
- 2
- 4
- 8
047.Q> int arr[3], what is the name of [ ]?
- Increment operator
- Logical operator
- subscript operator
- None
048.Q> The size of int arr[5] is ___
- 10 bytes
- 5 bytes
- 2 bytes
- none
049.Q> Which is the following is the valid array declaration?
- int a[0];
- int a[5]={1,2,3,4,5,6,7};
- int a[ ];
- int a[0] =3;
050.Q> Array is the example of ___
- Linear data structure
- dynamic
- non linear data structure
- none
051.Q> Pointer variables holds ___
- address = another variable
- value
- address
- all
052.Q> What is the right way to initialize array
- int a[5]={1,2,3}; [memory waste – only 3 values are given]
- int a[5]={1,2,3,4,5};
- int a[2]=3;
- All of the above
053.Q> Array elements are always stored in ________ memory location
- Sequential
- Random
- Dynamic
- None
054.Q> String always ends with ___
- null character
- semicolon
- colon
- comma
055.Q> In C++ programming strlen ( ) function is used for ___
- find string length
- concat two string
- Copy string
- None
056.Q> Which of the following is string copy function?
- strcpy()
- strrev()
- strcat()
- strlen()
057.Q> Which function concat two string?
- strcpy()
- strrev()
- strcat()
- strlen()
058.Q> The keyword used to define a structure is
- stru
- st-struct
- structure
- struct
059.Q> The structure definition ends by a ________
- :
- ;
- ::
- none
060.Q> Which operator connects the structure name to its member name ?
- _
- ,
- .
- ;
061.Q> The size of a union is determined by the size of the ____
- First member
- Biggest member
- last member
- none
062.Q> How many union members accessed at a time?
- only one
- all members
- two
- all of the above
063.Q> Pointer always work with _____operator
- &
- *
- both a & b
- none
064.Q> Which of the following is not a features of C++?
- OOP
- DMA
- Simple
- Platform Independent
065.Q> A token is _____________
- keyword
- An Identifier
- Smallest Unit of program
- operator
066.Q> ____functions can’t use recursion
- parameterized
- inline
- overloaded
- friend
067.Q> Which of the following is allowed in a C++ arithmetic –
- { }
- [ ]
- ( )
- None
068.Q> While loop checks the condition on ____
- Top
- Bottom
- Middle
- None
069.Q> cout is a /an ____
- operator
- object
- function
- Macro
070.Q> A keyword is ___
- An identifier
- In lower case instructions only
- Reserved word
- none
071.Q> A member function can be declared static if it does not access ____ members
- private
- public
- non – static
- None
072.Q> A character variable can at a time store ____
- 1 character
- 8 character
- 256 character
- none
073.Q> Header files have the file extension____
- .h
- .cu
- .cpps
- .head
074.Q> Scope resolution operator is ___
- :
- ,
- .
- ::
075.Q> I want to read data from the file, which stream I have to use?
- ifstream
- ofstream
- stream
- Both A & B
076.Q> A set of arithmatic operators are —
- &&, ||, !
- ==, !=, >, <, >=, <=
- +. -, *, /, %
- All of above
077.Q> Which operator has the lowest precedence?
- size of
- unary
- assignment
- comma
078.Q> Every function in C++ is followed by_____
- { }
- ( )
- [ ]
- none
079.Q> ______ is a way of combining data with function into an object.
- Object
- Encapsulation
- Overload
- Polymorphism
080.Q> The minimum value that an integer constant can have is _____
- 32767
- 32768
- -32767
- -32768
081.Q> What is the range of integer datatype?
- -32768 to 32767
- 0 to 255
- -127 to 128
- -32767 to 32768
082.Q> Which of the following mode declaration is used in c++ to open a file for input?
- ios::ap
- in::ios
- ios::in
- ios::file
083.Q> The order of evaluation of following expression A+B-C*D/E will be–
- *, /, -, +
- +, -, *, /
- *, /, +, –
- All of these
084.Q> Assignment operator is —
- =
- ++
- <<
- ==
085.Q> A set of relational operator is —-
- +, -, *, /, %
- ==, !=, <, >, <=, >=
- &&, ||, !
- =
086.Q> A set of conditional/ternary operator is ______
- <<
- ::
- ? :
- >>
087.Q> Which of the following is known as insertion operator —
- ^
- v
- <<
- >>
088.Q> Which of the following is extraction opearator?
- ^
- v
- <<
- >>
089.Q> Which one is not a valid relational operator?
- ==
- =>
- >=
- <=
090.Q> Which symbol represent for logical AND.
- ||
- !
- &
- &&
091.Q> Which of the following is output statement in C++?
- cin
- cout
- output
- result
092.Q> To calculate remainder in C++, we use _____
- /
- &
- %
- =>
093.Q> To increase the value of ‘a’ by one which of the following statement is wrong?
- a++
- a=a+1
- a+=1
- a+1=>a
094.Q> What will be the output of the following condition statement?
int a=15>=15?15:16
- 16
- 15
- 31
- none
095.Q> Which of the following is input statement in c++?
- cin
- cout
- input
- get
096.Q> A floating point variable contains___
- Both integral and fractional part
- double
- only fractional
- none
097.Q> A function which calls itself called___
- friend
- inline
- recursive
- main
098.Q> A data structure which contains different datatypes values is called____
- Array
- string
- union
- structure
099.Q> In which LAB was developed C++?
- Bell Lab
- ANSI
- SDLC
- IBM
100.Q> What was the name of C++ earlier?
- C with classes
- cpp
- c++
- ++c
101.Q> OOP stands for___
- object oriented programming system
- object object programming
- OOP
- none
102.Q> what is the size of int datatype in C++?
- 2
- 4
- Both A & B
- None
103.Q> ASCII value of ‘\0’ (null character) is __
- 0
- 128
- 255
- -128
104.Q> In C++, Range of signed char?
- 0 to 255
- -128 to 127
- 127 to -128
- 0 to 127
105.Q> In C++, Range of un-signed char?
- 0 to 255
- -128 to 127
- 127 to -128
- 0 to 127
106.Q> Example of pre-increment operator –
- +a
- a++
- –a
- ++a
107.Q> Which of the following will not return the value?
- empty
- null
- int
- void
108.Q> The execution & endling of C++ program begin from ___
- start
- new( )
- main( )
- sqrt( )
109.Q> Correct syntax to create a single line comment
- //comment
- /comment
- comment//
- none
110.Q> Comments are used to —-
- make the program faster
- make error free program
- To help other’s read nad understand the program
- None
111.Q> How many way we can apply comment in C++?
- 0
- 1
- 2
- 3
112.Q> Which of the following storage class have global visibility
- auto
- break
- return
- extern
113.Q> main () is a / an ____
- keyword
- function
- object
- all
114.Q> cin and cout represents ________ header file
- math.h
- stdlib.h
- iostream.h
- string.h
115.Q> How many types of macro in C++
- 0
- 1
- 2 (object/function macro)
- 3
116.Q> Which of the following is the example of function macro?
- #define_m1(r) (3.14)
- #define
- #define A 14
- none
117.Q> which of the following is the example of object macro?
- #define_m1(r) (3.14)
- #define
- #define A 14
- none
118.Q> Which block should be placed after try block?
- catch
- throw
- either catch or throw
- none
119.Q> How many parameters does the throw expression can have?
- 1
- 2
- 3
- 4
120.Q> Which is used to check the error in the block in exception handling?
- try
- catch
- throw
- handler
121.Q> Where are the strings stored?
- stack
- heap
- Both a & b
- block
122.Q> Which is used to create a pure virtual function?
- $
- %
- !
- =0
123.Q> What is meant by polymorphism?
- Class having many forms
- Class having only single form
- Class having two forms
- Class having empty
124.Q> What does derived class doesn’t inherit from base class?
- constructor
- destructor
- friends
- All of above
125.Q> How to declare a template?
- temp
- tem
- Template<>
- Template()
126.Q> How many types of templates in C++
- one
- two
- three
- Both a & c
127.Q> Which is used to define a reference variable?
- &
- $
- #
- *
128.Q> What does the reference provide?
- Alternate name for the class
- Alternate name for the function
- Alternate name for the variable
- Alternate name for the pointer
129.Q> What is the difference between references and pointers?
- Both are similar
- References are an alias for a variable where as pointer stores the address of variable.
- References stores address of variables where as pointer points to variable
- Both b & c
130.Q> Which of the following function must used reference?
- Default constructor
- Parameterized constructor
- Copy Constructor
- destructor
131.Q> Exceptions are also called____
- compile time error
- Runtime error
- Logical Error
- Syntax Error
132.Q> How many types of constructor are their in C++?
- 1
- 2
- 3
- 4
133.Q> How many parameters does required default constructor ?
- 0
- 1
- 2
- 3
134.Q> C++ class holds ____
- data
- functions
- Both A & B
- none
135.Q> Which of the following is not a type of constructor?
- operator overloading
- default
- parametrized
- copy
136.Q> Which of the following is a valid class declaration?
- class A{ }
- class B { } ;
- class { }
- class A [ ];
137.Q> The data member & member functions of a class are by default____
- protected
- public
- private
- struct
138.Q> Which of the following item is used for a function defined inside a class?
- member variable
- member function
- class function
- none
139.Q> Inline function are invoked at the time of ___?
- runtime
- compile time
- both
- none
140.Q> A member function that is automatically invoked at the time of object declaration is called___
- initializer
- object creator
- constructor
- All of above
141.Q> Which of the following concepts determining at runtime what method to invoke?
- Data hiding
- Dynamic typing
- Dynamic binding
- Dynamic loading
142.Q> If class X inherits from class Y, then Y is called ___
- super class
- sub class
- abstract
- none
143.Q> An instance of a class is called_____
- private
- object
- public
- none
144.Q> Destructor has the same name as the constructor and it is preceded by___
- !
- @
- #
- ~A []
145.Q> In protected inheritance, A public data member of the class will be treated as a ___
- public
- private
- protected
- none
146.Q> Base class is ____
- Parent class
- Derived Class
- Child Class
- Nested Class
147.Q> Which of following operator can’s be overloaded?
- ::
- size of
- ?:
- All of these
148.Q> Which of the following type of class allows only one object of it created?
- Virtual Class
- Singleton class
- friend class
- none
149.Q> A class which contain at least one pure virtual function called____
- Abstract class
- base class
- derived class
- singleton class
150.Q> Which of the following not a member of class ?
- inline function
- virtual function
- constructor
- friend function
151.Q> Which of the following can’t be inherited from the base class?
- constructor
- Friend
- Both A & B
- None
152.Q> Destructor is a ___
- Member function
- overloaded
- Constructor
- none
153.Q> Which of the following provides code reusability
- inheritance
- abstraction
- encapsulation
- polymorphism
154.Q> In c++ features of oops are ___
- inheritance
- encapsulation
- polymorphism
- All of these
155.Q> How many ways to perform polymorphism?
- 0
- 1
- 2
- 3
156.Q> Destructor has the same name as constructor and it is preceded by____
- !
- ~
- #
- ?
157.Q> Wrapping data & function is a single unit is known as___
- Abstraction
- Encapsulation
- Polymorphism
- none
158.Q> Which of the following class allows only to create single object?
- Friend class
- Abstract class
- Singleton class
- virtual class
159.Q> What is the other name used for functions inside a class?
- Member variable
- Member function
- Class function
- Data Member
160.Q> How run time polymorphism are implemented in C++?
- Using inheritance
- Using Virtual function
- Using templates
- Both a & b
161.Q> In OOP abstraction refers to____
- Hiding the details
- Showing only essential info of the application
- Both a & b
- Reuse once written code again and again
162.Q> How many types of templates in C++
- 0
- 1
- 2
- 3
163.Q> Which of the following is the valid declaration of class template
- template class A {}
- template {}
- Template class A{…..}
- none
164.Q> In base class & derived class function with same signature is called____
- overloading
- overriding
- data hiding
- none
I really treasure your piece of work, Great post.
Thanks a lot