Time Left - 10:00 mins

Campus Recruitment Tech Quiz- 37

Attempt now to get your rank among 155 students!

Question 1

What will be the output of following code-

#include <stdio.h>

int main()

{

int x = 3;

if (x == 2); x = 0;

if (x == 3) x++;

else x += 2;

printf("x = %d", x);

return 0;

}

Question 2

How many times Gradeup is printed?

#include<stdio.h>

int main()

{

int i = -5;

while (i <= 5)

{

if (i >= 0)

break;

else

{

i++;

continue;

}

printf("Gradeup");

}

return 0;

}

Question 3

Which of the following is correct regarding the below C-code?

int main()

{

int n;

for (n = 9; n != 0; n--)

printf("%d", n--);

}

Question 4

What is the output of following C code-

int main()

{

int a[] = { 1, 2, 3, 4, 5} ;

int *ptr;

ptr = a;

printf(" %d ", *( ptr + 1) );

return 0;

}

Question 5

What is the output of below program?

#include <stdio.h>

int foo(int* a, int* b)

{

int sum = *a + *b;

*b = *a;

return *a = sum - *b;

}

int main()

{

int i = 0, j = 1, k = 2, l;

l = i++ || foo(&j, &k);

printf("%d %d %d %d", i, j, k, l);

return 0;

}

  • 155 attempts
  • 0 upvotes
  • 5 comments
Jul 8GATE & PSU CS