C Loops control Questions 4

Hello PrepSter,

If you find any errors in the quiz below kindly comment in the comment section and we will make it our priority to fix it.

Also if you have a better of the solution to the questions, please do comment them below and if we find it better than ours, we will post it in our website.

Question 1

Time: 00:00:00
What is the expected output of the following program ?

#include<stdio.h> int main() { int i; goto step; for (i = 0 ; i < 10 ; i++) { printf("PrepSter "); step: printf("PrepInsta "); break; } return 0; }

PrepSter will be printed 10 times.

PrepSter will be printed 10 times.

PrepInsta will be printed one time.

PrepInsta will be printed one time.

PrepSter PrepInsta will be printed 10 times.

PrepSter PrepInsta will be printed 10 times.

PrepSter will be printed one time.

PrepSter will be printed one time.

Compilation error because goto label can not exist in another loop.

Compilation error because goto label can not exist in another loop.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Which of the following can be called as jump statement in C ?

 

goto

goto

break

break

continue

continue

return

return

All of the above

All of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What will be the output of the C code give below ?

#include<stdio.h> int main() { unsigned int num = 12800; while (num++ != 0); printf("%d", num); return 0; }

Run time error.

Run time error.

Infinite loop.

Infinite loop.

1

1

0

0

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Select the correct output of the following code.

#include<stdio.h> int main() { int val; for ( val=0; val<5; val++ ) { int val = 15; printf ( "%d ", val ); val++; } return 0; }

15 15 15 15 15

15 15 15 15 15

0 1 2 3 4

0 1 2 3 4

15 16 17 18 19

15 16 17 18 19

Compilation error due to multiple initialization.

Compilation error due to multiple initialization.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Choose the correct output of the program below.

#include <stdio.h> int main() { int i; for (i=0; i<10; ++i) printf("%d", i&1); return 0; }

0000000000

0000000000

0111111111

0111111111

1111111111

1111111111

0101010101

0101010101

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Hey ! Follow us on G+