wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Codigo

Total questions: 15

Worksheet time: 11mins

Name
Class
Date
1.

What is the output of the following code?

int main()

{

int x = 10, y = 5;

printf("%d", x + y * 2);

return 0;

}


a)

30

b)

20

c)

25

d)

15

2.

What is the difference between ++i and i++ in C?


a)

Both increment the value by 1 but ++i increments before the value is used, and i++ increments after.


b)

Both increment the value by 1, but ++i increments after the value is used, and i++ increments before.


c)

++i increases by 2, and i++ increases by 1.


d)

There is no difference.

3.

What will be the value of i after the following loop?

int i;

for(i = 0; i < 10; i++) {

if (i == 5) {

break;

} }

a)

4

b)

5

c)

10

d)

9

4.

What does the static keyword do in C?

a)

 It makes a variable visible throughout the program.


b)

 It makes a function visible only within its file.


c)

It ensures that a variable retains its value between function calls.


d)

It makes a variable constant.


5.

Who is known as the father of the computer?

a)

Alan Turing

b)

Charles Babbage

c)

John Von Neumann

d)

Bill Gates

6.

Who invented the concept of the first programmable computer?

a)

John Atanasoff

b)

Charles Babbage

c)

Alan Turing

d)

Konrad Zuse

7.

Who is known for developing the first successful theory of artificial intelligence(AI)?

a)

Alan Turing

b)

John McCarthy

c)

Marvin Minsky

d)

Claude Shannon

8.

What is the difference between malloc and calloc in C?

a)

malloc initializes memory, but calloc does not.

b)

calloc allocates memory for a single object, but malloc allocates for multiple objects.

c)

malloc initializes memory with 0, but calloc does not.

d)

malloc allocates memory, but calloc allocates and initializes memory to 0.

9.

 What will be the output of this code?

int x = 5;

printf("%d %d %d", x++, ++x, x++);


a)

5 7 6

b)

6 7 6

c)

5 6 6

d)

5 7 7

10.

What are function pointers in C, and how are they used?

a)

Function pointers store the address of a function, which can be invoked later.

b)

Function pointers are used to declare multiple functions at once.

c)

Function pointers store the return value of functions.

d)

Function pointers are used for defining arrays of functions.

11.

How do you prevent a function from returning a value in C?

a)

Use the void return type.

b)

Use the null return type.

c)

Use the none return type.

d)

Use the no-return keyword.

12.

What is the purpose of the const keyword in C?

a)

It prevents the variable from being modified.

b)

It makes a variable read-only during compilation.

c)

It makes a function return only constant values.

d)

It allows you to define constant values at runtime.

13.

What will be the result of the following code?

int a = 5, b = 5;

printf("%d", a == b ? 10 : 20);


a)

20

b)

null

c)

10

d)

Error

14.

What will the following Python code output?

a = 3

b = 2

print(a ** b)


a)

6

b)

9

c)

8

d)

5

15.

What will be the output of this code?

int x = 10;

printf("%d", x & 3);

a)

10

b)

3

c)

2

d)

0