Q.1

What will be the output of the program?

#include<stdio.h>
int main()
{
    int a =b, c;
    if(a >=
        b =
    c =
    printf("%d, %d, %d\n", a, b, c);
    return
}
  • 300, 300, 200
  • Garbage, 300, 200
  • 300, Garbage, 200
  • 300, 300, Garbage
Q.2

What will be the output of the program?

#include<stdio.h>
int main()
{
    char ch;
    if(ch = printf(""))
        printf("It matters\n");
    else
        printf("It doesn't matters\n");
    return}
  • It matters
  • It doesn't matters
  • matters
  • No output
Q.3

Which of the following statements are correct about an if-else statements in a C-program?

1: Every if-else statement can be replaced by an equivalent statements using   ?: operators
2: Nested if-else statements are allowed.
3: Multiple statements in an if block are allowed.
4: Multiple statements in an else block are allowed.
  • 1 and 2
  • 2 and 3
  • 1, 2 and 4
  • 2, 3, 4
Q.4

A char variable can store either an ASCII character or a Unicode character.

  • True
  • False
Q.5

Point out the error, if any in the while loop.

#include<stdio.h>
int main()
{
    void fun();
    int i =    while(i <=    {
        printf("%d\n", i);
        if(i>            goto here;
    }
return}
void fun()
{
    here:
    printf("It works");
}
  • No Error: prints "It works"
  • Error: fun() cannot be accessed
  • Error: goto cannot takeover control to other function
  • No error
Q.6

Which of the following errors would be reported by the compiler on compiling the program given below?

#include<stdio.h>
int main()
{
    int a =
    switch(a)
    {
	case
	printf("First");

	case
	printf("Second");

	case 3 +
	printf("Third");

	case
	printf("Final");
	break;

    }
    return
}
  • There is no break statement in each case.
  • Expression as in case 3 + 2 is not allowed.
  • Duplicate case case 5:
  • No error will be reported.
Q.7

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i =    switch(i)
    {
        printf("Hello\n");
        case            printf("Hi\n");
            break;
        case            printf("\nBye\n");
            break;
    }
    return}
  • Hello
    Hi
  • Hello
    Bye
  • Hi
  • Bye
Q.8

What will be the output of the program?

#include<stdio.h>
int main()
{
    int x=y=
    for(; y; printf("%d %d\n", x, y))
    {
        y = x++ <=
    }
    printf("\n");
    return
}
  • 2 1
    3 1
    4 1
    5 1
    6 1
    7 0
  • 2 1
    3 1
    4 1
    5 1
    6 1
  • 2 1
    3 1
    4 1
    5 1
  • 2 2
    3 3
    4 4
    5 5
Q.9

What will be the output of the program?

#include<stdio.h>
int main()
{
    unsigned int i =/* Assume 2 byte integer*/
    while(i !=        printf("%d",++i);
    printf("\n");
    return}
  • Infinite loop
  • 0 1 2 ... 65535
  • 0 1 2 ... 32767 - 32766 -32765 -1 0
  • No output
Q.10

Which of the following statements are correct about the below program?

#include<stdio.h>
int main()
{
    int i =    i++;
    if(i <=    {
        printf("IndiaBIX\n");
        exit(0);
        main();
    }
    return}
  • The program prints 'IndiaBIX' 5 times
  • The program prints 'IndiaBIX' one time
  • The call to main() after exit() doesn't materialize.
  • The compiler reports an error since main() cannot call itself.
Q.11

Point out the error, if any in the program.

#include<stdio.h> 
int main()
{
    int a =b;
    a >=5 ? b=b=    printf("%d\n", b);
    return}
  • 100
  • 200
  • Error: L value required for b
  • Garbage value
Q.12

What will be the output of the program?

#include<stdio.h>
int main()
{
    char j=
    while(j <
    {
        printf("%d, ", j);
        j = j+
    }
    printf("\n");
    return
}
  • 1 2 3 ... 127
  • 1 2 3 ... 255
  • 1 2 3 ... 127 128 0 1 2 3 ... infinite times
  • 1, 2, 3, 4
Q.13

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i =
    while(i-- >=
        printf("%d,", i);
    i =
    printf("\n");
    while(i-- >=
        printf("%i,", i);
    while(i-- >=
        printf("%d,", i);
    return
}
  • 4, 3, 2, 1, 0, -1
    4, 3, 2, 1, 0, -1
  • 5, 4, 3, 2, 1, 0
    5, 4, 3, 2, 1, 0
  • Error
  • 5, 4, 3, 2, 1, 0
    5, 4, 3, 2, 1, 0
    5, 4, 3, 2, 1, 0
Q.14

What will be the output of the program?

#include<stdio.h>
int main()
{
    float a = 0.
    if(0.7 > a)
        printf("Hi\n");
    else
        printf("Hello\n");
    return
}
  • Hi
  • Hello
  • Hi Hello
  • None of above
Q.15

What will be the output of the program?

#include<stdio.h>
int main()
{
    int x, y, z;
    x=y=z=    z = ++x || ++y && ++z;
    printf("x=%d, y=%d, z=%d\n", x, y, z);
    return}
  • x=2, y=1, z=1
  • x=2, y=2, z=1
  • x=2, y=2, z=2
  • x=1, y=2, z=1
Q.16

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=
    switch(i)
    {
        case
            printf("Hello\n");
        case
            printf("Hi\n");
        case
            continue;
        default:
            printf("Bye\n");
    }
    return
}
  • Error: Misplaced continue
  • Bye
  • No output
  • Hello Hi
Q.17

What will be the output of the program?

#include<stdio.h>
int main()
{
    int a=b=c=
    *((a) ? &b : &a) = a ? b : c;
    printf("%d, %d, %d\n", a, b, c);
    return
}
  • 0, 1, 3
  • 1, 2, 3
  • 3, 1, 3
  • 1, 3, 1
Q.18

How many times "IndiaBIX" is get printed?

#include<stdio.h>
int main()
{
    int x;
    for(x=-x<=x++)
    {
        if(x <            continue;
        else
            break;
        printf("IndiaBIX");
    }
    return}
  • Infinite times
  • 11 times
  • 0 times
  • 10 times
Q.19

Which of the following statements are correct about the below C-program?

#include<stdio.h>
int main()
{
    int x =y = 100%i;
    for(i=i<i++)
    if(x != y);
        printf("x = %d y = %d\n", x, y);
    return}
1 : The printf() function is calledtimes.
2 : The program will produce the output x =y = 10
3 : The ; after the if(x!=y) will NOT produce an error.
4 : The program will not produce output.
  • 1
  • 2, 3
  • 3, 4
  • 4
Q.20

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=    for(; i<=i++);
        printf("%d", i);
    return}
  • 0, 1, 2, 3, 4, 5
  • 5
  • 1, 2, 3, 4
  • 6
0 h : 0 m : 1 s