Generate Quiz 6A5CE494C90DC

You have 30 minutes to complete the quiz


Generate Quiz 6A5CE494C90DC

1 / 10

C

#include

int main() {

int num;

printf(“Enter a number: “);

while (scanf(“%d”, &num) != 1) {

printf(“Invalid input. Please enter a number: “);

fflush(stdin);

}

printf(“You entered: %d\n”, num);

return 0;

}

What is the purpose of the fflush(stdin) line in this code?

2 / 10

What will be the output of printf(“\Roll\No”);?

3 / 10

Find the final output of the following code:

C

int x;

printf(“%f”, x);

4 / 10

What is the output of the following code segment?

C

void main()

{

int x=10;

int y=5;

int z=x+y;

printf (“%d %d %c”, x, y, z);

}

5 / 10

What is meant by standard input & output?

6 / 10

In which format specifier is used?

7 / 10

Trace the final output of the following code:

void main ()

{

float avg = 98.20;

printf(“Average = %5.2f”‘ , avg);

}

8 / 10

What is the final output of the following code?

void main ()

{

float x = 10.7;

int i;

i = (int)x;

printf(”%d”,i);

}

9 / 10

C

#include

int main() {

int age;

printf(“Enter your age (in years): “);

if (scanf(“%d”, &age) != 1 || age <= 0) { printf("Invalid age entered.\n"); } else { int ageInDays = age * 365; printf("You are approximately %d days old.\n", ageInDays); } return 0; } What is the main improvement of this code's input handling compared to a simple scanf?

10 / 10

What is the output of the following C code?

#include

int main() {

int x = 10, y = 20;

printf(“%d %d\n”, x, y);

x = y /= x + 2;

printf(“%d %d”, x, y);

return 0;

}

Your score is

0%

PLS Academy App!

Learn Anytime, Anywhere

🔥HURRY! Big Sale 50% OFF

Protected