Decision and Case Control Statements in C

Decision and Case Control Statements in C

University

35 Qs

quiz-placeholder

Similar activities

C Questions for BCA & BSc

C Questions for BCA & BSc

University - Professional Development

30 Qs

C Programming

C Programming

University - Professional Development

30 Qs

TECH - C

TECH - C

University

30 Qs

Arrays in C

Arrays in C

University

40 Qs

CodeChef (Secret Snippet)

CodeChef (Secret Snippet)

University

35 Qs

CODEZILLA 2022

CODEZILLA 2022

University

30 Qs

Arrays and Strings in C

Arrays and Strings in C

12th Grade - University

32 Qs

BUG@MASTER

BUG@MASTER

University

30 Qs

Decision and Case Control Statements in C

Decision and Case Control Statements in C

Assessment

Quiz

Computers

University

Hard

Created by

vinay agrawal

Used 177+ times

FREE Resource

35 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

#include <stdio.h>

void main()

{

int x = 5;

if (x < 1)

printf("hello");

if (x == 5)

printf("hi");

else

printf("no");

}

hi

hello

no

error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int x = 0;

if (x == 1)

if (x == 0)

printf("inside if\n");

else

printf("inside else if\n");

else

printf("inside else\n");

}

inside if

inside else if

inside else

compile time error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int x = 0;

if (x == 1)

if (x >= 0)

printf("true\n");

else

printf("false\n");

}

Depends on the compiler

No print statement

True

False

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The output of the following segment is

int k, n=20;

k=(n>5?(n<=10?100:200):500);

printf("%d",n);

100

200

300

20

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int a = 1, b = 1;

switch (a)

{

case a*b:

printf("yes ");

case a-b:

printf("no\n");

break;

}

}

yes

no

yes no

compile time error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result after execution of the following code if a is 10, b is 5, and c is 10?

if ((a > b) && (a <= c))

a = a + 1;

else

c = c+1;

a = 10, c = 10

a = 11, c = 10

a = 10, c = 11

a = 11, c = 11

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output of the following code


#include <stdio.h>

int main()

{ int i = 0;

switch (i)

{

case '0': printf("Geeks");

break;

case '1': printf("Quiz");

break;

default: printf("GeeksQuiz");

}

return 0;

}

Geeks

Quiz

GeeksQuiz

None of the above

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?