Pages
About Me
Entertainment
Technologies
Practice Programs
VB Art Gallery
Contact Me
Test6
What will be the output of the following nested if-else statement?
#include<stdio.h>
void main(){
int x=0;
If(x++){
printf("TRUE");
}
else if(x == 1){
printf("FALSE");
}
}
Undefined Behaviour
FALSE
Compile time error
TRUE
Select the correct output for the below C code?
#include <stdio.h>
static int i = 10;
int main() {
i = 5;
for(i = 0; i < 5; i++) {
static int a = 10;
printf("%d ", a++);
}
return 0;
}
0 1 2 3 4
10 11 12 13 14
10 10 10 10 10
11 12 13 14 15
What is the output of the code given below?
#include<stdio.h>
void main() {
int i = 0;
do {
i++ = ++i;
printf("Hello CodeMarathon");
} while (i < 0);
}
Compile time error
It does not print anything
Hello CodeMarathon Hello CodeMarathon
Hello CodeMarathon
Select the correct output for the below C code?
#include <stdio.h>
char* myfunc(char *ptr) {
ptr += 4;
return(ptr);
}
void main() {
char *x, *y;
x = "CodeMarathon";
y = myfunc(x);
printf("%s", y);
}
CodeMarathon
deMarathon
eMarathon
Marathon
What is the output of the code given below?
#include <stdio.h>
void main() {
int b = 15, c = 5, d = 8, e = 8, result;
result = b > c ? c > d ? 12 : d > e ? 13 : 14 : 15;
printf("%d\n", result);
}
12
13
14
15
What will be the output of the following C code?
#include <stdio.h>
int i = 40;
extern int i;
int main() {
do{
printf("%d", i++);
}while (5,4,3,2,1,0);
return 0;
}
40 41 42 43 44
40
5 4 3 2 1
Compilation error
Select the correct output for the below C code?
#include <stdio.h>
struct point {
int x;
int y;
} p[] = {1, 2, 3, 4, 5};
void display(struct point p[]) {
printf("%d %d\n", p->x, p[2].y);
}
void main() {
display(p);
}
1 0
1 5
Compile-time error
1 Garbagevalue
What is the output of the code given below?
#include <stdio.h>
void main() {
int x = 10;
printf("%d %d %d\n", x <= 10, x == 40, x >= 10);
}
0 1 0
1 0 1
1 40 1
0 40 1
What will be the output of the below C code.
main() {
char ptr[] = "CQuestions";
printf("%d", -3[ptr]);
}
-300
99
-101
Error
What is the output of the code given below?
#include <stdio.h>
void main() {
int a = 10, b = 20, c = 30;
(c > b > a) ? printf("TRUE") : printf("FALSE");
}
Compilation error
TRUE
FALSE
Unknown result
Submit Test
Newer Post
Older Post
Home