Q.1

In which order do the following gets evaluated

1. Relational
2. Arithmetic
3. Logical
4. Assignment
  • 2134
  • 1234
  • 4321
  • 3214
Q.2

Which of the following is the correct order of evaluation for the below expression?
z = x + y * z / 4 % 2 - 1

  • * / % + - =
  • = * / % + -
  • / * % - + =
  • * % / - + =
Q.3

What will be the output of the program?

#include<stdio.h>
int main()
{
    int x=    printf("%d, %d, %d\n", x<=x=x>=10);
    return}
  • 1, 40, 1
  • 1, 55, 1
  • 1, 55, 0
  • 1, 1, 1
Q.4

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=j=-k=w, x, y, z;
    w = i || j || k;
    x = i && j && k;
    y = i || j &&k;
    z = i && j || k;
    printf("%d, %d, %d, %d\n", w, x, y, z);
    return
}
  • 1, 1, 1, 1
  • 1, 1, 0, 1
  • 1, 0, 0, 1
  • 1, 0, 1, 1
Q.5

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=-j=k=m;
    m = ++i && ++j && ++k;
    printf("%d, %d, %d, %d\n", i, j, k, m);
    return
}
  • -2, 3, 1, 1
  • 2, 3, 1, 2
  • 1, 2, 3, 1
  • 3, 3, 1, 2
Q.6

The expression of the right hand side of || operators doesn't get evaluated if the left hand side determines the outcome.

  • True
  • False
Q.7

Associativity has no role to play unless the precedence of operator is same.

  • True
  • False
Q.8

Are the following two statement same?

1. a <=? (b = 30): (c = 30);
2. (a <=? b : (c = 30);
  • Yes
  • No
Q.9

Which of the following correctly shows the hierarchy of arithmetic operations in C?

  • / + * -
  • * - / +
  • + - / *
  • / * + -
Q.10

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=    printf("%d, %d\n", ++i, ++i);
    return}
  • 3, 4
  • 4, 3
  • 4, 4
  • Output may vary from compiler to compiler
Q.11

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=-j=k=m;
    m = ++i && ++j || ++k;
    printf("%d, %d, %d, %d\n", i, j, k, m);
    return
}
  • 1, 2, 0, 1
  • -3, 2, 0, 1
  • -2, 3, 0, 1
  • 2, 3, 1, 1
Q.12

Assuming, integer is 2 byte, What will be the output of the program?

#include<stdio.h>

int main()
{
    printf("%x\n", -2<<2);
    return}
  • ffff
  • 0  
  • fff8
  • Error
Q.13

Two different operators would always have different Associativity.

  • Yes
  • No
Q.14

Which of the following is the correct usage of conditional operators used in C?

  • a>b ? c=30 : c=40;
  • a>b ? c=30;
  • max = a>b ? a>c?a:c:b>c?b:c
  • return (a>b)?(a:b)
Q.15

What will be the output of the program?

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

What will be the output of the program?

#include<stdio.h>
int main()
{
    int x=y, z;
    y = --x;
    z = x--;
    printf("%d, %d, %d\n", x, y, z);
    return}
  • 4, 3, 3
  • 4, 3, 2
  • 3, 3, 2
  • 2, 3, 3
Q.17

What will be the output of the program?

#include<stdio.h>
int main()
{
    int i=-j=k=m;
    m = ++i || ++j && ++k;
    printf("%d, %d, %d, %d\n", i, j, k, m);
    return
}
  • 2, 2, 0, 1
  • 1, 2, 1, 0
  • -2, 2, 0, 0
  • -2, 2, 0, 1
Q.18

In the expression a=b=5 the order of Assignment is NOT decided by Associativity of operators

  • True
  • False
Q.19

Will the expression *p = p be disallowed by the compiler?

  • Yes
  • No
Q.20

Which of the following is the correct order if calling functions in the below code?
a = f1(* f2(12/+ f3();

  • f1, f2, f3
  • f3, f2, f1
  • Order may vary from compiler to compiler
  • None of above
0 h : 0 m : 1 s