1.  What will be the final value of the digit ?
void main()
{
int digit = 0;
for( ; digit <= 9; )
digit++;
digit *= 2;
--digit;
}

-1
17
19
16

```Answer

Report

2.  Assume that i,j and k are integer variables and their values are 8, 5 and 0 respectively. What will be the values of variables i and k after executing the following expression ?
k=(j>5)?(i<5)?i-j:j-i:k-j;
i-=(k)?(i)?(j)?:(i):(k);
What will be the result of execution ?

-3 and 3
3 and -5
3 and -3
-5 and 3

```Answer

Answer: Option  D Explanation:Given that the values of i,j and k are 8, 5 and 0 respectively. The first statement j>5 is not executed
because j=5 and i<5 is also not executed. So the program evaluate k-j, which is, 0-5=-5.
So after execution of first expression the values are 8, 5 and -5 respectively.
In the second statement the values of k, i are non zero. so it is true for both. So the values of i, j
and k are 3, 5 and -5
```

Report

3.  The body of the following for loop
for( putchar( 'a' ); putchar (0); putchar (' c ') ) putchar ( 'b') ;
will be executed

0 times
1 times
infinitely many times
will not be executed because of syntax error

```Answer

Answer: Option  A Explanation:The condition is putchar (0) . This returns a value 0 which is a false condition.
So, the loop will not be executed even once. ```

Report

4.  What will be the value of sum after the following program is executed?
void main()
{
int sum=1, index = 9;
do{
index = index – 1;
sum *= 2;
}while( index > 9 );
}

1
2
9
0.5

```Answer

Report

5.  What is the output of this C code ?
int main()
{
printf(‘’%d ‘’, 1);
goto l1;
printf(‘’%d ‘’, 2);
}
void foo()
{
l1: printf(‘’3 ‘’, 3);
}

1 2 3
1 3
1 3 2
Compile time error

```Answer