Q.1

The way the break is used to take control out of switch and continue to take control of the beginning of the switch?

  • Yes
  • No
Q.2

Can we use a switch statement to switch on strings?

  • Yes
  • No
Q.3

We want to test whether a value lies in the range 2 to 4 or 5 toCan we do this using a switch?

  • Yes
  • No
Q.4

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

#include<stdio.h>
int main()
{
    int i=    for(;;)
    {
        printf("%d\n", i++);
        if(i>           break;
    }
    return}
  • There should be a condition in the for loop
  • The two semicolons should be dropped
  • The for loop should be replaced with while loop.
  • No error
Q.5

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

#include<stdio.h>
int main()
{
    int i =j =    if(i =&& if(j =        printf("Have a nice day");
    return}
  • Output: Have a nice day
  • No output
  • Error: Expression syntax
  • Error: Undeclared identifier if
Q.6

A short integer is at leastbits wide and a long integer is at leastbits wide.

  • True
  • False
Q.7

By default, the data type of a constant without a decimal point is int, whereas the one with a decimal point is a double.

  • Yes
  • No
Q.8

Point out the error, if any in the program.

#include<stdio.h>
int main()
{
    int a =    switch(a)
    {
    }
    printf("This is c program.");
	return}
  • Error: No case statement specified
  • Error: No default specified
  • No Error
  • Error: infinite loop occurs
Q.9

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

#include<stdio.h>
int main()
{
    int i =j =    if(i % 2 = j %        printf("IndiaBIX\n");
    return}
  • Error: Expression syntax
  • Error: Lvalue required
  • Error: Rvalue required
  • The Code runs successfully
Q.10

If scanf() is used to store a value in a char variable then along with the value a carriage return(\r) also gets stored it.

  • True
  • False
Q.11

Point out the error, if any in the program.

#include<stdio.h>
int main()
{
    int P =
    switch(P)
    {
       case
       printf("Case 1");

       case
       printf("Case 2");
       break;

       case P:
       printf("Case 2");
       break;
    }
    return
}
  • Error: No default value is specified
  • Error: Constant expression required at line case P:
  • Error: There is no break statement in each case.
  • No error will be reported.
Q.12

Point out the error, if any in the program.

#include<stdio.h>
int main()
{
    int i =    switch(i)
    {
        printf("This is c program.");
        case            printf("Case1");
            break;
        case            printf("Case2");
            break;
    }
return}
  • Error: No default specified
  • Error: Invalid printf statement after switch statement
  • No Error and prints "Case1"
  • None of above
Q.13

What will be the output of the program?

#include<stdio.h>
int main()
{
    int x =y =    if(!(!x) && x)
        printf("x = %d\n", x);
    else
        printf("y = %d\n", y);
    return}
  • y =20
  • x = 0
  • x = 10
  • x = 1
Q.14

What will be the output of the program?

#include<stdio.h>
int main()
{
    int k, num =    k = (num <?:    printf("%d\n", num);
    return}
  • 200
  • 30
  • 100
  • 500
Q.15

What will be the output of the program, if a short int is 2 bytes wide?

#include<stdio.h>
int main()
{
    short int i =
    for(i<=5 && i>=-++i; i>
        printf("%u,", i);
    return
}
  • 1 ... 65535
  • Expression syntax error
  • No output
  • 0, 1, 2, 3, 4, 5
Q.16

Which of the following statements are correct about the program?

#include<stdio.h>
int main()
{
    int x =y =    if(x == y)
        printf("x is equal to y\n");

    else if(x > y)
        printf("x is greater than y\n");

    else if(x < y)
        printf("x is less than y\n")
    return}
  • Error: Statement missing
  • Error: Expression syntax
  • Error: Lvalue required
  • Error: Rvalue required
Q.17

The modulus operator cannot be used with a long double.

  • True
  • False
Q.18

Point out the error, if any in the program.

#include<stdio.h>
int main()
{
    int i =
    switch(i)
    {
        case
           printf("Case1");
           break;
        case 1*2+
           printf("Case2");
           break;
    }
return
}
  • Error: in case 1*2+4 statement
  • Error: No default specified
  • Error: in switch statement
  • No Error
Q.19

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

#include<stdio.h>
int main()
{
    int i=
    while()
    {
        printf("%d\n", i++);
        if(i>
           break;
    }
    return
}
  • There should be a condition in the while loop
  • There should be at least a semicolon in the while
  • The while loop should be replaced with for loop.
  • No error
Q.20

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=    switch(i)
    {
        default:
           printf("This is default\n");
        case           printf("This is case 1\n");
           break;
        case           printf("This is case 2\n");
           break;
        case           printf("This is case 3\n");
    }
    return}
  • This is default
    This is case 1
  • This is case 3
    This is default
  • This is case 1
    This is case 3
  • This is default
0 h : 0 m : 1 s