Search Header Logo

C Language MCQs

Authored by SImranjeet Kaur

Computers

University

Used 3+ times

C Language MCQs
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code output? #include void main() { int x = 5, y = 10; printf("%d", x + y); }

5

10

15

Compilation error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which header file is required to use the printf() function in C?

stdio.h

stdlib.h

math.h

string.h

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to declare a pointer in C?

int *ptr;

int ptr*;

int& ptr;

ptr int*;

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? #include void main() { int arr[] = {1, 2, 3, 4}; printf("%d", arr[2]); }

1

2

3

Compilation error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements about for loops is true?

The loop executes at least once even if the condition is false.

The loop continues until the condition becomes false.

The loop must have a break statement.

The loop cannot be nested.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the size of an int in C (on most platforms)?

1 byte

2 bytes

4 bytes

Depends on the compiler and platform

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid variable name in C?

123abc

_value

float

@data

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers