Search Header Logo

MPMNJ C Training (Control Statements Quiz)

Authored by ROCK GOWTHAM

Computers

University

Used 2+ times

MPMNJ C Training (Control Statements Quiz)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 2 pts

What is the output of the following C code?

#include <stdio.h>

int main() {

int a = 1;

if (a==1) a=2;

if (a==2) a=3;

printf("%d", a);

return 0;

}

1

2

3

0

2.

MULTIPLE CHOICE QUESTION

2 mins • 2 pts

#include <stdio.h>

int main() {

if (0 == 0)

printf("True");

else

printf("False");

return 0;

}

True

False

None

Error

3.

MULTIPLE CHOICE QUESTION

2 mins • 2 pts

#include <stdio.h>

int main() {

if (0, 1)

printf("True");

else

printf("False");

return 0;

}

True

False

Error

None

4.

MULTIPLE CHOICE QUESTION

2 mins • 2 pts

#include <stdio.h>

int main() {

int x = 1, y = 0;

if (x && y)

printf("A");

else if (x || y)

printf("B");

else

printf("C");

return 0;

}

A

B

C

Error

5.

MULTIPLE CHOICE QUESTION

2 mins • 2 pts

#include <stdio.h>

int main() {

int x = 5;

(x > 5) ? (x = 10) : (x = 0);

printf("%d", x);

return 0;

}

0

5

10

Error

6.

MULTIPLE CHOICE QUESTION

2 mins • 2 pts

#include <stdio.h>

int main() {

int x = 5, y = 10;

printf("%d", (x > y) ? x : y);

return 0;

}

5

10

0

1

7.

MULTIPLE CHOICE QUESTION

2 mins • 2 pts

#include <stdio.h>

int main() {

int a = 5;

printf("%s", (a % 2 == 0) ? "Even" : "Odd");

return 0;

}

Even

Odd

Error

None

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?