C Operator Questions 2

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
Which is the right output of the given code?

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

 

1 1

1 1

1 5

1 5

4 100

4 100

4 5

4 5

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

Please login to submit your explanation

Start

Question 2

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

#include <stdio.h> int main() { printf("%d", sizeof(printf("PrepInsta"))); return 0; }

PrepInsta9

PrepInsta9

9PrepInsta

9PrepInsta

PrepInsta4

PrepInsta4

4

4

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 correct option for the output of the following program

#include <stdio.h> int f1() { printf ("Prep"); return 1;} int f2() { printf ("Insta"); return 1;} int main() { int p = f1() + f2(); return 0; }

11

11

PrepInsta

PrepInsta

Prep+Insta

Prep+Insta

Compilation error

Compilation error

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 option for the output of the following C code below.

#include <stdio.h> int main() { int a = 1; int b = 1; int c = a || (b=b+7); int d = a-- && --b; printf("%d,%d,%d,%d", a, b, c, d); return 0; }

0,8,1,1

0,8,1,1

1,8,1,1

1,8,1,1

0,0,1,0

0,0,1,0

1,7,1,0

1,7,1,0

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Given an input 12 24 will be the output of the C code below ?

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

0 1

0 1

1 2

1 2

24 12

24 12

0 1

0 1

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Which of the following the correct option for the output of the program given below ?

#include <stdio.h> int main() { int a = 13, b = 37, c = 50; if (c > b > a) printf("TRUE"); else printf("FALSE"); return 0; }

TRUE

TRUE

FALSE

FALSE

Incorrect use of operators

Incorrect use of operators

Compiler dependent

Compiler dependent

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Select the correct output of the given program.

#include<stdio.h> int main() { char *st[] = { "Prep","Insta","PVT"}; char **po; po = st; printf("%s ", ++*po); printf("%s ", *po++); printf("%s ", ++*po); return 0; }

Insta Insta Prep

Insta Insta Prep

Prep nsta T

Prep nsta T

rep rep nsta

rep rep nsta

Insta PVT Prep

Insta PVT Prep

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Which is the operators have different meaning in different situation ?

*

*

&

&

both

both

They both are specific in their meanings

They both are specific in their meanings

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What is the minimum number of variable needed to swap two number in c ?

1

1

2

2

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 following statement do >

x=x | 1<<n:

Sets (n+1)th bit of x

Sets (n+1)th bit of x

Toggles (n+1)th bit of x

Toggles (n+1)th bit of x

Sets x as 2n

Sets x as 2n

Unsets (n+1)th bit of x

Unsets (n+1)th bit of x

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+