C Operator Questions 3

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
Select the operator with is not a logical operator.

 

&&

&&

|

|

||

||

!

!

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What will the the output of the following code ?

#include <stdio.h> int main() { int i = 0; for(;i<5;) { printf("Prepster ",i); i=i++; } return 0; }

Prepster Prepster Prepster Prepster Prepster

Prepster Prepster Prepster Prepster Prepster

Prepster Prepster Prepster Prepster

Prepster Prepster Prepster Prepster

Compilation error

Compilation error

Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster ..... infinite loop

Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster Prepster ..... infinite loop

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Choose the expected output of the C program.

#include<stdio.h> int main() { int a = 12; int b = 10; b = a++ + a++; printf("%d %d",a,b); return 0; }

13 24

13 24

14 26

14 26

13 14

13 14

14 25

14 25

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What will be printed after the execution of the following program ?

#include <stdio.h> int main() { printf("%d", 1 << 1 + 5 << 4); return 0; }

1

1

16

16

1024

1024

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is the correct output of this code ?

#include <stdio.h> #define VAL 32 int main() { char arr[] = "prepster"; *(arr + 0) &= ~VAL; *(arr + 4) &= ~VAL; printf("%s", arr); return 0; }

ster

ster

prepster

prepster

PrepSter

PrepSter

32rep32ter

32rep32ter

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Select the output given by the code below.

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

16 4

16 4

15 4

15 4

15 15

15 15

Compilation error.

Compilation error.

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

Please login to submit your explanation

Start

Question 7

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

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

10 11

10 11

13 12

13 12

13 10

13 10

Compilation error

Compilation error

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Choose the correct option for the output of the code below.

# include <stdio.h> int main() { int x = 10; int y = 30; x += y += 10; printf (" %d %d", x, y); return 0; }

40 30

40 30

40 40

40 40

50 30

50 30

50 40

50 40

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Which operator respectively can be used to set and reset a given integer bitwise ?

| and &

| and &

|| and &

|| and &

& and |

& and |

&& and ||

&& and ||

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
What will the correct output be for the code given below ?

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

13 12

13 12

12 10

12 10

12 11

12 11

13 10

13 10

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!"]