Top 50 Interview question based on C++ Programming language


1. C++ is a ______________ programming language.

a. middle-level
b. low-level
c. high-level
d. none

Ans: a.

C++ is a middle programming language because it consists of features of both high-level and low-level language.

2. C++ was developed by ________________.

a. Bjarne Stroustrup
b. Mark henry.
c. Martin
d. none

Ans: a

3. C++ was developed in _________

a. 1979
b. 1981
c. 1982
d. none

Ans: a

4. C++ is a ____________ of C.

a. subset
b. superset
c. set
d. none

Ans: b

Any legal C program is a legal C++ program.

5. C++ consists __________ pillars of object-oriented development:

a. Three
b. Four
c. Two
d. none

Ans: b

Four pillars are as follows:
1encapsulation
2. data-hiding
3. inheritance
4. polymorphism.

6. The ___________ giving a rich set of methods manipulating data structures.

a. Standard template library
b. library
c. data
d.none

Ans: a.

It contain the detail informations about the method.

7. C++ is being highly used to write __________.

a. device drivers
b. bus drivers
c. data drivers
d. none

Ans: a

8. _________is the command to check whether GCC is installed on your system.

a. g++ -v
b. g-- -v
c. g+- -v
d. none

Ans: a

9. _________ have states and behaviors.

a. functions
b. object
c. class
d. none

Ans: b

Example : Dog

State: color
Behaviors: barking

10. A _________ can contain many methods

a. methods
b. class
c. objects
d. none

Ans: b

Click on below link to explore more on C++:

https://amzn.to/36oYiPj


11. A ________ is basically a behavior.

a. methods
b. data
c. class
d.none

Ans: a

12. Each _______ has its unique set of instance variables.

a. object
b. data
c. class
d. none

Ans: a

13. How to compile a hello.cpp ?

a. g++ hello.cpp
b. g+- hello.cpp
c. g hello.cpp
d. none

Ans: a

After running g++ hello.cpp it generates a.out file.

14. The ________ is a statement terminator.

a. semicolon
b. colon
c. date
d. none

Ans: a

15. A ______ is a set of logically connected statements that are surrounded by opening and closing
braces.

a. block
b. bullock
c. code
d. none

Ans: a


16. C++ is a ______ programming language.

a. case sensitive
b.data sensitive
c. sensitive
d. none

Ans: a

man and MAN are two different identifiers.

17. Reserved words may not be used as ________

a. constant
b. functions
c. methods
d. none

Ans: a.

18. The trigraph sequence always starts with ______ question marks.

a. two
b. three
c. four
d.none

Ans: a

Example: ??=

19 All the compilers do not support __________

a. bigraph
b. tetragraph
c. trigraphs
d. none

Ans: c

Trigraphs have confusing nature.

20. A line containing only whitespace, possibly with a comment, is known as a _______

a. dash line
b. blank line
c. dot line
d. none

Ans. a

21. ____________ is the term used in c++ to describe blanks, tabs, newline characters and comments.

a.blackspace
b. whitespace
c. space
d. none

Ans: b

22. ____________ supports single-line and multi-line comments.

a. C--
b. C++
c. D++
d. none

Ans: b

23. Variables reserved memory locations to store __________.

a. values
b. data
c. functions
d. none

Ans: a

24. C++ have _________ basic data types:

a. six
b. four
c. seven
d. none

Ans: c

C++ have seven basic data types

1. Boolean
2. Character
3. Integer
4. Floating point
5. Double Floating point.
6. Valueless (void)
7. Wide character

25. _________________ operator is used to get size of various data types.

a. dataof
b. sizeof
c. value
d. none

Ans: b

Example:

sizeof(char)

26. _________ which inserts a new-line character after every line.

a. sendl
b. endl
c. datal
d. none

Ans: b

27. ____________ operator is being used to pass multiple values out to the screen.

a. <<
b. <
c. >>
d. none

Ans: a

28. We can use _______ to create a new name for an existing type.

a. typedef
b. data
c. int
d. none

Ans: a

Example: typedef int feet;

29. ___________ is a constant whose type is the enumeration.

a. denominator
b. numerator
c. enumerator
d. none

Ans: c

30. Creating an enumeration requires the use of the keyword _______.

a. enum
b. ddum
c. fnum
d. none

Ans: a

Example:

enum enum-name {list of names} var-list;

31. The name of a ________ can be composed letters, digits and the underscore character.

a. variable
b. value
c. address
d. none

Ans: a

32. ____________stores either value true or false.

a. bool
b. pool
c. tool
d. none

Ans: a

33. A ___________ tells the compiler where and how much storage to create for the variable.

a. function definition
b. variable definition
c. data
d. none

Ans: b

34. variables are _________ and so may appear on the left-hand side of an assignment.

a. lvalues
b. rvalues
c. data
d. none

Ans: a

35. Numeric literals are ______

a. rvalues
b. lvalues
c. data
d. none

Ans: a


36. What are the three places where variables can be declared ?

a. local, global variables and formal parameters.
b. data, address and memory
c. value
d. none

Ans: a

37. ______ can be divided into integer numerals,floating-point numerals,characters, strings and
boolean values.

a. function
b. constants
c. values
d. none

Ans: b

constants are treated like regular variables.

38. An __________ can be a decimal , octal or hexadecimal constant.

a. integer literal
b data literal
c. function literal
d. none

Ans: a

39. A _______________ has an integer part, a decimal point, a fractional part and an exponent part.

a. floating-point literal
b. decimal literal
c. integer literal
d. none

Ans: a

40. Characters literals are enclosed in __________ quotes

a. double
b. single
c. triple
d. none

Ans: b





41. String literals are enclosed in ___________ quotes.

a. single
b. double
c. triple
d. none

Ans: b

42. #define preprocessor and const keyword are two simple ways in C++ to define _______.

a. functions
b. constants
c. data
d. none

Ans: b

Example:

const type variable = value;

43. There are _______ types of modifiers

a. four
b. three
c. two
d. none

Ans: a

signed , unsigned , long and short are four types of modifiers in C++.

44. There are _______ types of qualifiers in C++.

a. Two
b. Three
c. Four
d. none

Ans: b

Three types of qualifiers in C++ are as follows:

1. const
2. volatile
3. restrict

45. A ___________ defines the scope and life-time of variables within a C++ program.



a. class
b. data
c. integer
d. none

Ans: a

46. The _______ storage class is the default storage class for all local variables.

a. auto
b. zeto
c. ceto
d. none

Ans: a

auto can only be used within functions

47. The _________ storage class is used to define local variables that should be stored in a register.

a. register
b. memory
c. data
d. none

Ans: a

variable has a maximum size equal to the register size.

48. The __________ storage class instructs the compiler to keep a local variable in existence during

the lifetime of the program.

a. static
b. ctatic
c. auto
d. none

Ans: a

static allows them to maintain their values between function calls.

49. The _______________ storage class is used to give a reference of a global variable that is visible to all the program files.

a. extern
b. external
c. data
d. none

Ans: a

50. The _________ specifier applies only to class objects.

a. mutable
b. inmutable
c. data
d. none

Ans: a


mutable member can be modified by a const member function.



Click on below link to explore more on C++:

https://amzn.to/36oYiPj


Comments

Popular posts from this blog

Python & Shell Scripting Real Time Course Book & Videos

Top Five Devops Technical Interview QA Books

Linux-Command Hands-On (DF)