In which order do the following gets evaluated
| 1. | Relational |
| 2. | Arithmetic |
| 3. | Logical |
| 4. | Assignment |
Which of the following is the correct order of evaluation for the below expression?
z = x + y * z / 4 % 2 - 1
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}
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
}
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
}
The expression of the right hand side of || operators doesn't get evaluated if the left hand side determines the outcome.
Associativity has no role to play unless the precedence of operator is same.
Are the following two statement same?
| 1. | a <=? (b = 30): (c = 30); |
| 2. | (a <=? b : (c = 30); |
Which of the following correctly shows the hierarchy of arithmetic operations in C?
What will be the output of the program?
#include<stdio.h>
int main()
{
int i= printf("%d, %d\n", ++i, ++i);
return}
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
}
Assuming, integer is 2 byte, What will be the output of the program?
#include<stdio.h>
int main()
{
printf("%x\n", -2<<2);
return}
Two different operators would always have different Associativity.
Which of the following is the correct usage of conditional operators used in C?
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}
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}
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
}
In the expression a=b=5 the order of Assignment is NOT decided by Associativity of operators
Will the expression *p = p be disallowed by the compiler?
Which of the following is the correct order if calling functions in the below code?
a = f1(* f2(12/+ f3();