Languages [3i Infotech Placement]: Sample Questions 279 - 281 of 546

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 279

Edit

Write in Short

Short Answer▾
  1. main ()
  2. {
  3.     printf ( “%x” -14);
  4. }

Explanation

  • In a program They are asking to print ( “% x” -1 << 4) ;
  • let՚s take this answer given written the 1 in 16 bits

    0000 0000 0000 0001

  • -1 can be written in 2՚s complement no system as

    1111 1111 1111 1111

  • “<<” this operator is called Binary Left Shift Operator, so we have to left shift four times the least significant 4 bits are filled with 0՚s

    1111 1111 1111 0000

  • Here (1111 = F, 1111 = F, 1111, F0000 = 0)
  • So the Answer is FFF0

Question 280

Edit

Write in Short

Short Answer▾

What do the functions atoi () , itoa () and gevt () do?

Explanation

  • atoi ()
    • A macro that converts integer to character.
    • itoa ()
    • It converts an integer to string
    • gcvt ()
  • It converts a floating-point number to string.

Question 281

Edit

Describe in Detail

Essay▾

What is the output of the following program?

  1. main ()
  2. {
  3.     inti =3;
  4.     for(;i++=0;)
  5.     printf(“%d”, i);
  6. }

Explanation

Compiler Error: Lvalue required.

In the program

Table Shows the Program
int i = 3;
  • Given the integer variable i = 3
for (; i ++ = 0;)
  • Increment operators return rvalues and hence it can՚t appear on the left hand side of an assignment operation.
Shows the Example of Lvalue and Rvalue

Developed by: