wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

TechZoom24-BugBash_Prelims

Total questions: 25

Worksheet time: 25mins

Name
Class
Date
1.

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

a)

float rate;

b)

int variable_count;

c)

int $main;

d)

int number;

2.

Which of the following statements best explains why C is not considered a platform-independent programming language?

a)

C does not have a standard specification.

b)

C programs cannot be compiled on different operating systems.

c)

C code is not capable of running on embedded systems.

d)

C code may rely on platform-specific features and behaviors.

3.

What is #include ?

a)

Preprocessor directive

b)

Inclusion directive

c)

File inclusion directive

d)

None of the mentioned

4.

What is meant by 'a' in the following C operation? fp = fopen("Random.txt", "a");

a)

Attach

b)

Append

c)

Apprehend

d)

Add

5.

What will be the output of the following C code?

a)

Compile time error

b)

Hello World! 34

c)

Hello World! 1000

d)

Hello World! followed by a junk value

6.

What are mandatory parts in the function declaration in c?

a)

return type, function name

b)

return type, function name, parameters

c)

parameters, function name

d)

parameters, variables

7.

Which is more effective while calling the functions?

a)

call by value

b)

call by reference

c)

call by pointer

d)

call by object

8.

What will be the output of the following C++ code?

a)

23

b)

43

c)

compile time error

d)

30

9.

What will be the output of the following C++ code?

a)

11

b)

7

c)

9

d)

8

10.

What is the scope of the variable declared in the user defined function?

a)

whole program

b)

only inside the {} block

c)

the main function

d)

header section

11.

When we define the default values for a function?

a)

When a function is defined

b)

When a function is declared

c)

When the scope of the function is over

d)

When a function is called

12.

If an argument from the parameter list of a function is defined constant then _______________

a)

It can be modified inside the function

b)

It cannot be modified inside the function

c)

Runtime Error occurs

d)

Segmentation fault

13.

What will be the output of the following C++ code?

a)

10

b)

0

c)

error

d)

segmentation fault

14.

In debugging, what does the term "breakpoint" refer to?

a)

A point where the program crashes

b)

A point where the program execution pauses for inspection

c)

A point where the program's output is displayed

d)

A point where a specific condition is met in the code

15.

What is the purpose of a stack trace in debugging?

a)

To visualize the memory layout of the program

b)

To track the execution flow of the program

c)

To display the contents of variables

d)

To identify memory leaks

16.

What is the primary purpose of debugging in software development?

a)

To add new features to the software

b)

To remove syntax errors from the code

c)

To optimize the performance of the software

d)

To ensure that the software functions correctly and as expected

17.

What does a segmentation fault error indicate in a C or C++ program?

a)

Syntax error in the code

b)

Memory access violation

c)

Logical error in the code

d)

Infinite loop

18.

What is the likely outcome of implementing recursion without a base condition in a recursive function?

a)

The program will terminate normally.

b)

The program will run with decreased efficiency

c)

The program will crash due to a stack overflow error.

d)

The program will enter an infinite loop without any output.

19.

23.What will be the output of the following Java code?

a)

0

b)

5

c)

15

d)

16

20.

What will be the value of x after executing the following C code?

a)

4

b)

5

c)

6

d)

Compilation Error

21.

What will be the output of the following C code?

a)

38

b)

39

c)

40

d)

41

22.

What is the output of the following Java code snippet?

a)

2147483648

b)

-2147483648

c)

Compilation error

d)

Runtime error

23.

What will be the output of the following C code?

a)

4

b)

18

c)

16

d)

32

24.

What will be the output of the following C++ code?

a)

16

b)

15

c)

14

d)

compilation error

25.

What will be the output of the following C code?

a)

0

b)

1

c)

2

d)

compilation error