Classical

C Programming MCQ - I/O Operations

26:  

 int i = 5;

is a statement in a C program.Which of the following are true?

A.

during execution, value of i may change but not its address

B.

during execution both the affress and value may change

C.

repeated execution may result in different addresses for i

D.

i may not have an assosiated address

 
 

Option: C

Explanation :


27:  

The following program

main ()
{
  float a = .5, b = .7;
  if (b < .7)

{
     if (a < .5)

          printf("TELO");
     else
          printf("LTTE");

}
   else printf("JKLF");
}


outputs

A.

LTTE

B.

TELO

C.

JKLF

D.

PLO

 
 

Option: A

Explanation :

It will print 'LTTE' as a and b are of float type.


28:  

 What is the output of the following program segment?

void max { int x, int  y, int m)
{
if (x > 5) m = x;
   else m = y;
}
 int main()
{
int i = 20, j = 5, k = 0;
   max(i,  j,  k ); printf("%d", k) ;
}

A.

5

B.

20

C.

0

D.

none of above

 
 

Option: C

Explanation :


29:  

Consider the program
main( )

    int y = 1;
    printf ("%d", (*(char *)&x)) :
}

If the machine in which this program is executed is little-endian (meaning, the lower signifi-cant digits occupy lower addresses), then the output will he

A.

0

B.

99999999

C.

1

D.

unpredictable

 
 

Option: C

Explanation :


30:  

 The program
main()
{
int i = 5;
i = (++i) / (i++);
printf ("%d", i);

prints

A.

2

B.

5

C.

1

D.

6

 
 

Option: A

Explanation :




Suggest an improvement