C++ interview questions and answers- Technobs.

DEALS OF THE WEEK

 

With these questions and answers, I got my dream job.

This is a continuation of our previous article on 525 programming job interview questions and answers. In the previous article, emphasis was laid on the general programming questions and answers you need to know as a programmer. If you have not taken time to read it, see the link below.


READ: 525 programming job interview questions and answers.


Programming job really pays. If you have really taken time to learn the C++ language, it is time to put it into a great use by working with it. There are various programming job updates everyday and they all need applicants. However, a lot of people have applied for programming jobs but were not shortlisted for the interviews, while some were shortlisted for the interview but they couldn’t get the job. This might be because they didn’t take time to go through important questions that they ought to know in order to get their dream job.

C++ PROGRAMMING LANGUAGE INTERVIEW QUESTIONS AND ANSWERS.




Now let’s get to work. The questions and answers below are very important. You need to know them because they can be asked in an interview. However, if you have been using the C++ language, you will know most of them.

Take time to read the questions below, if you have any further questions, or any adjustments you want to make, you can use the comment box.

38. Who designed C++?

Answer: Bjarne Stroustrop.

39. List the IDEs for C++.

Answer: code blocks, Dev C++, Visual C++.

40. Analyze the codes below:

//project1.cpp: defines the entry point for the console application.

//my second C++ program.

 

What does the symbol // show?

Answer: It shows that the remainder of the lines are comments.

41. What does a single line comment begin with?

Answer: A single line comment begins with the symbol //

 


READ: Websites to learn programming for free this year.


 

42. What does a multiple line comment begin with?

Answer: A multiple line comment begins with the symbol /*

43. What does a multiple line comment end with?

 

Answer: A multiple line comment ends with the symbol */

44. Analyze the code below.

Int main ( )

 

What does the parenthesis indicate? Note: parenthesis means the symbol ( ).

Answer: it indicates that main is a function.

45. Where does the execution of every program start from?

Answer: Main.

46. from the code in number 44 above, what does the ‘int’ mean?

Answer: It means that the main will return an integer value

 

Analyze the code below:

{

Cout<< “hello! Welcome to the world of C++”,

Return 0;

}

47. What is the function of the left brace { ?

Answer: the left brace begins every function body.

48. What is the function of the right brace?

Answer: it ends every function body.

 




 

49. What does cout stand for?

Answer: it means console output.

50. What is console output?

Answer: Console output is an output stream object.


READ: I really suck at designing things, i don’t think that front-end is good for me


 

51. What does the symbol << stand for?

Answer: it is an insertion operator used to insert string of characters or values into the output stream object cout.

52. What does the semi colon stand for?

Answer: It marks the end of the statement.

53. What does the 0 after return stand for?

Answer: it shows that the program ended successfully.

 

54. What are the set of characters that are recognized in C++ programming language?

Answer: alphabets, numbers, special characters, formatting characters.

55. List three punctuators you know and their functions.

  • Braces { }: Opening and closing braces indicate the start and end of a compound statement.
  • Parenthesis ( ): Opening and parenthesis indicate functions calls; function parameters for grouping expressions.
  • Brackets [ ] : this indicates the start and end of a compound statement.

It will be an added advantage if you know many of them. So as a good man, I will list more of them *winks*

  • Comma , : this punctuator is used as a separator in a function argument list.
  • Semicolon : it is used as a statement terminator.
  • Colon ; : It indicates a labeled statement or conditional operator symbol.
  • Asterisk * : this punctuator is used in pointer declaration or as multiplication operator.
  • Equal sign = : it is used as an assignment operator.
  • Hash sign # : it is used as pre-processor directive.

 

56. Observe this:

The%y

 

Can it serve as an identifier for a variable?

Answer: No, this is because it contains a special character.

57. List operators that you know and their examples:

  • Arithmetic operators: +, -, /, *, %
  • Unary operators: ++, – -, !
  • Assignment operator: =
  • Increment and decrement operators: + + (increment) and – – (decrement).
  • Relational operators: <, <=, >. >=, ==, !=

58. In a compound statement, what does individual statements end with?

Answer: semi colon ( ; ).

59. When only a single semi colon is written, it represents ____

Answer: null-statement.

 

60. Analyze the code below: what will the line of code yield?

Cout<< “ C++ the best” << “programming language” ;

Answer: it will yield: C++ the bestprogramming language

Notice that there is no space between best and programming. In order to give a space between them, the code that will be written is:

Cout<<” C++ the best” << “ programming language” ;

Notice the space between <<” and programming.

 

61. What is the importance of setting precision?

Answer: precision is used to control the number of digits to the right of the decimal point.

62. If x= 1234.56789, write a code showing the precision.

Answer:

cout<< set precision (9);

63. In order to give 1234.568, write the code showing the precision.

Answer: cout<< set precision (7);

64. If the precision is written as cout<< x; what will it yield?

Answer: 1234.56 this is because, the minimum number of digits displayed for a number by default is 6.




 

65. What is the full meaning of UML?

Answer: Unified modelling language.

66. What are the statements for implementing the selections control structure in c++?

Answer: if, if else, nested if, switch.

67. What is VTable?

Answer: VTable is a table of function pointers. It is maintained per class.

68. What is VPTR?

Answer: VPTR is a pointer to VTable.

69. What is a class?

Answer: A class is a blue print which reflects the entities attributes and actions.

70. What is an object?

Answer: This can be defined as an instance of the class.

71. What is a protected access specifier?

Answer: It protects a class member.

72. Futher explain the role of a protected access specifier.

Answer: if a class member is protected, then it is accessible in the inherited class. however, outside the both, the private and protected members are not accessible.\




 

73. What is abstraction?

Answer: This means hiding the internal implementation and exhibiting only the necessary details.

 

74. What is inheritance:

Answer: This is the process of acquiring the properties of the existing class into the new one.

75. What is an array?

Answer: An array is a collection of data elements of same data type placed in contigous memory locations.

76. what is another name for an existing class.

Answer: base/parent class.

77. What is another name for inherited class?

Answer: derived/child class.

 

78. What is the function of an array?

Answer:  with an array, there is no need to declare different variables of the same type if we are to process them together.

79. Observe the code below:

int i = 5;

int j = i++;

what will i and j equal after the code above is executed?

Answer: i will equal 6 and i will equal 5.

80. Differentiate between a class and a struct.

Answer: The only difference between a class and a struct is the class modifiers . Struct members are public by default while class members are private.

81. which punctuator is used to initialize an array?

Answer: [ ].

82. Describe this array.

int age [5]= {11, 3, 4, 5, 7} ;

The statement declares an array of five integers elements called age.




83. What is a structure?

Answer:  A structure is a group of data elements grouped together under one name.

84. What is a function?

Answer:  A function is a block of statements called by name to carry out a specific task.

85. What is the function that initiates execution of the C++ program?

Answer: main ( )

86. What is a function prototype?

Answer:  It is a declaration that informs the compiler about the functions to be used in a program, the argument they take and the type of value they return.

 

For now, these are the questions and answers the technobs team could compile, we will be compiling more and be updating them regularly. stay in touch.

The next section will be Java interview questions and answers, keep visiting technobs to follow the trend.

 

TECHNOBS

Hi, I am frank, an inspired tech. blogger, web developer and a computer hardware technician. Catch up with tutorials, tech news, programming tips and lots more!

 

 

Share this...
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someoneShare on Reddit

GAMING

Be the first to comment

Leave a Reply

Your email address will not be published.