Tag: programming languages

Questions Related to programming languages

  1. The snippet is illegal

  2. It loops forever

  3. It is ignored by compiler, but it is not illegal

  4. None of the Above


Correct Option: B

C++

  1. Constructor

  2. Destructor

  3. Constitutor

  4. None of the Above


Correct Option: A

What does 7/9*9 equal (in C and C++)?

  1. 1

  2. 0.08642

  3. 0

  4. None of the Above


Correct Option: C

AI Explanation

To evaluate the expression 7/9 * 9 in C and C++, we need to consider the data types involved.

By default, when dividing two integers in C and C++, the result will be an integer, which means the decimal part will be truncated.

Let's evaluate the expression step by step:

7/9 = 0 (since both 7 and 9 are integers, the result will be an integer and the decimal part is truncated)

0 * 9 = 0 (0 multiplied by any number is 0)

Therefore, the result of the expression 7/9 * 9 in C and C++ is 0.

Hence, the correct answer is option C.

Which of the following is evaluated first:

  1. &&

  2. ||

  3. !

  4. None of the Above


Correct Option: C

Which is not an ANSI C++ function?

  1. sin()

  2. kbhit()

  3. tmpnam()

  4. None of the Above


Correct Option: B

True or false: If you continuously increment a variable, it will become negative?

  1. True

  2. False

  3. It depends on the variable type

  4. None of the Above


Correct Option: C

Which of the following functions initalizes the variables contained in a class:

  1. Constructor

  2. Destructor

  3. Constitutor

  4. None of the Above


Correct Option: A

Is C++ case sensitive?

  1. No

  2. Case sensitivity is compiler-determined

  3. Yes

  4. None of the Above


Correct Option: C