Variable Naming MCQ : True or False Questions (Multiple Choice)
Question 1 |
Guess the output of the following program ?
#include<stdio.h> int main() { int i = 10, j = -1, k = 0, 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 0; }
1, 0, 1, 0 | |
1, 1, 1, 1 | |
1, 0, 0, 1 | |
1, 0, 1, 1 |
Question 2 |
What will be the value of Z ?
#include<stdio.h> int main() { int x=100, y=10, z; z = x!=50 || y == 5; printf("z = %d\n", z); return 0; }
2 | |
0 | |
1 | |
Compile Error |
Question 2 Explanation:
z = x != 50 || y == 5; = True || y == 5; = True || False; = True = 1
Question 3 |
Guess the output of the following program ?
#include<stdio.h> int main() { int x = 10, y, z; y = ++x; z = x++; printf("%d, %d, %d\n", x, y, z); return 0; }
12, 11, 10 | |
12, 11, 11 | |
12, 10, 10 | |
12, 10, 11 |
Question 3 Explanation:
y = ++x; // Value of x is Incremented and then Assigned z = x++; // Value of x is Assigned and then Incremented
There are 3 questions to complete.