C Programming Quiz

C Programming Quiz

University

25 Qs

quiz-placeholder

Similar activities

Operators in C

Operators in C

University

24 Qs

Beginning C Programming

Beginning C Programming

University

23 Qs

Operator in C

Operator in C

University

20 Qs

CSI Coding Quiz

CSI Coding Quiz

University

20 Qs

9.4.25 Mentoring quiz

9.4.25 Mentoring quiz

University

20 Qs

C Programming (Unit- 1) Quiz

C Programming (Unit- 1) Quiz

University

20 Qs

Curse Breakers Quiz

Curse Breakers Quiz

University

25 Qs

Apuntadores en C

Apuntadores en C

University

20 Qs

C Programming Quiz

C Programming Quiz

Assessment

Quiz

Computers

University

Medium

Created by

Ms. 16458

Used 3+ times

FREE Resource

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? #include int main() { int a = 10; if (a = 5) { printf("True\n"); } else { printf("False\n"); } return 0; }

True

False

Compile-time error

Undefined behavior

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between malloc() and calloc() in C?

malloc() initializes allocated memory, calloc() does not

calloc() initializes allocated memory, malloc() does not

malloc() is used for static allocation, calloc() for dynamic allocation

Both are identical

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following function declarations is correct in C?

int function(int x, y);

int function(int x, int y) { return x + y; }

int function(int x, int y);

function(int x, int y) -> int;

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the size of an integer on a 64-bit system using GCC (typically)?

4 bytes

8 bytes

2 bytes

Depends on the compiler

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of this program? #include void swap(int *x, int *y) { int temp = *x; *x = *y; *y = temp; } int main() { int a = 5, b = 10; swap(&a, &b); printf("%d %d\n", a, b); return 0; }

10 5

5 10

Compile-time error

Undefined behavior

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the sizeof operator return?

The size of a pointer

The size of a variable or type in bits

The size of a variable or type in bytes

None of the above

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of this program? #include int main() { int arr[] = {10, 20, 30, 40}; printf("%d\n", *(arr + 2)); return 0; }

10

20

30

40

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?