Search Header Logo

Sample

Authored by Gunjan Verma

Computers

University

Used 2+ times

Sample
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What does the following declaration mean?

int (*ptr)[5];

ptr is a pointer to an array of 5 integers.
ptr is a pointer to an array of 10 integers.
ptr is a pointer to a single integer.
ptr is an array of 5 integers.

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of the following can be checked in a switch statement?

Integer values

Character values

Both a and b

Floating-point values

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Identify the error in the code:

for (int i = 0; i < 5; i--) {

printf("%d", i);

}

Infinite loop

Syntax Error

i is undeclared

Logical error

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the correct syntax for declaring a function that does not return a value?

a) int func();

b) void func();

c) func();

d) function func();

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which type of variables can retain their values between function calls?

a) auto

b) register

c) static

d) extern

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of the following is an incorrect function prototype?

a) int func(int a, int b);

b) float func(int, float);

c) double func(double);

d) int func(a, b);

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

int arr[] = {1, 2, 3, 4};

printf("%d", *(arr + 2));

a) 1

b) 2

c) 3

d) 4

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