C Programming Quiz

C Programming Quiz

University

20 Qs

quiz-placeholder

Similar activities

Bridge course with C

Bridge course with C

University

20 Qs

Programming Round 1

Programming Round 1

12th Grade - University

21 Qs

C - Structures

C - Structures

University

20 Qs

Pointers

Pointers

University

20 Qs

Playing with C

Playing with C

University

20 Qs

C programming

C programming

University

15 Qs

C - Flow Control

C - Flow Control

University

20 Qs

C-Extended

C-Extended

University

16 Qs

C Programming Quiz

C Programming Quiz

Assessment

Quiz

Computers

University

Hard

Created by

Atharv Sonawane

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

#include<stdio.h> int main() { static int i; for(i = 1;;++i) { if(i == 5) break; printf("%d ",i++); } }

1 3

1 2 3 4

1 2 3

1 2 3 4 5

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

#include<stdio.h> int main() { char a = 10,b = 20; printf("%d\n",scanf("%d %*d",&a,&b)); // Assume input to be : 123 456 printf("a = %d\n",a); printf("b = %d",b); }

1 a = 10 b = 456

1 a = 123 b = 20

2 a = 123 b = 456

2 a = 123 b = 20

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

#include<stdio.h> int foo() { static int i; return ++i*2; } int main() { printf("%d",foo()*foo()*foo()); }

48

16

64

24

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

#include <stdio.h> int main() { int arr[] = {10, 20, 30, 40}; int *ptr = arr; printf("%d ",*ptr++); printf("%d",*++ptr); }

10 30

10 20

20 30

20 40

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

#include<stdio.h> int fun(int n) { if(n <= 1) return 1; return n + fun(n--); } int main() { printf("%d",fun(5)); }

15

16

Infinite loop / Stack overflow

Compilation error

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

#include<stdio.h> struct A { char a; int b; char c; }; struct B { float a; int b; int c; }; int main() { if(sizeof(struct A) == sizeof(struct B)) printf("Equal"); else printf("Not Equal"); }

Equal

Not Equal

Compilation Error

Runtime Error

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

#include<stdio.h> int main() { int x = 8; printf("%d",(x & 1) ? x >> 1 : x << 1); }

0

4

16

Compilation Error

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?