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 :

Click on Discuss to view users comments.

Write your comments here:



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.

Click on Discuss to view users comments.

Write your comments here:



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 :

Click on Discuss to view users comments.

Write your comments here:



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 :

Click on Discuss to view users comments.

Write your comments here:



30:  

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

prints

A.

2

B.

5

C.

1

D.

6

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Write your comments here: