C++ Language INTERVIEW QUESTION & ANSWERS
56. |
What are the advantages of pointer? |
|
The pointer has the following advantages. - It allows to pass variables, arrays, functions, strings and structures as function arguments.
- A pointer allows to return structured variables from functions.
- It provides functions which can modify their calling arguments.
- It supports dynamic allocation and deallocation of memory segments.
- With the help of a pointer, variables can be swapped without physically moving them.
- It allows to establish links between data elements or objects for some complex data structures such as linked lists, stacks, queues, binary trees and graphs.
- A pointer improves the efficiency of certain routines.
|
57. |
What is pointer operator? |
|
A pointer operator can be represented by a combination of * (asterisk) with a variable. |
58. |
What is meant by conditional expression? |
|
The conditional expressions are mainly used for decision making. In the subsequent sections, the various structures of the control statements and their expressions are explained. The following statements are used to perform the task of the conditional operations.- if statement
- if else statement
- switch case statement
|
59. |
What are the types of comments? |
|
C++ allows us to add two types of comments are : - Single line comments
- Multi line comments
|
60. |
What is the difference between single line and multiple line comments? |
|
A single line comment starts with the character sequence ("//"), i.e. the two forward slashes and ends with a newline character.
A multi line comment starts with the character sequence ("/*"), i.e. a forward slash followed by an asterisk and ends with the character sequence ("*/"), i.e. an asterisk followed by a forward slash. |