Q.1

How many times the while loop will get executed if a short int is 2 byte wide?

#include<stdio.h>
int main()
{
    int j=
    while(j <=
    {
        printf("%c %d\n", j, j);
        j++;
    }
    return
}
  • Infinite times
  • 255 times
  • 256 times
  • 254 times
Q.2

Which of the following sentences are correct about a for loop in a C program?

1: for loop works faster than a while loop.
2: All things that can be done using a for loop can also be done using a while loop.
3: for(;;); implements an infinite loop.
4: for loop can be used if we want statements in a loop get executed at least once.
  • 1
  • 1, 2
  • 2, 3
  • 2, 3, 4
Q.3

What will be the output of the program?

#include<stdio.h>
int main()
{
    char str[]="C-program";
    int a =    printf(a >10?"Ps\n":"%s\n", str);
    return}
  • C-program
  • Ps
  • Error
  • None of above
Q.4

Which of the following is not logical operator?

  • &
  • &&
  • ||
  • !
Q.5

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

#include<stdio.h>
int main()
{
    int n =y =    y == 1 ? n=0 : n=    if(n)
        printf("Yes\n");
    else
        printf("No\n");
    return}
  • Error: Declaration terminated incorrectly
  • Error: Syntax error
  • Error: Lvalue required
  • None of above
Q.6

What will be the output of the program?

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

In mathematics and computer programming, which is the correct order of mathematical operators ?

  • Addition, Subtraction, Multiplication, Division
  • Division, Multiplication, Addition, Subtraction
  • Multiplication, Addition, Division, Subtraction
  • Addition, Division, Modulus, Subtraction
Q.8

Which of the following sentences are correct about a switch loop in a C program?

1: switch is useful when we wish to check the value of variable against a particular set of values.
2: switch is useful when we wish to check whether a value falls in different ranges.
3: Compiler implements a jump table for cases used in switch.
4: It is not necessary to use a break in every switch statement.
  • 1,2
  • 1,3,4
  • 2,4
  • 2
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 cannot be checked in a switch-case statement?

  • Character
  • Integer
  • Float
  • enum
Q.11

What will be the output of the program?

#include<stdio.h>
int main()
{
    int x =    float y = 3.    if(x == y)
        printf("x and y are equal");
    else
        printf("x and y are not equal");
    return}
  • x and y are equal
  • x and y are not equal
  • Unpredictable
  • No output
0 h : 0 m : 1 s