wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Technical Quiz 2022-23

Total questions: 50

Worksheet time: 38mins

Name
Class
Date
1.

What is the syntax to declare a variable in C?

a)

var x;

b)

int x;

c)

declare x;

d)

define x;

2.

Which of the following is not a valid C data type?

a)

int

b)

float

c)

char

d)

string

3.

What is the size of the 'int' data type in C on most systems?

a)

4 bytes

b)

8 bytes

c)

2 bytes

d)

1 byte

4.

Which operator is used for pointer-to-member access in C?

a)

.

b)

->

c)

::

d)

[]

5.

How is a single-line comment written in C?

a)

// Comment

b)

/* Comment */

c)

# Comment

d)

' Comment

6.

Which function is used to allocate memory dynamically in C?

a)

alloc()

b)

malloc()

c)

new()

d)

allocate()

7.

What is the escape sequence for a newline character in C?

a)

\n

b)

\r

c)

\t

d)

\b

8.

What is the result of the expression 5 + 3 * 2 in C?

a)

10

b)

16

c)

11

d)

13

9.

How can you check if two strings are equal in C?

a)

strcmp(str1, str2) == 0

b)

str1 == str2

c)

str1 = str2

d)

str1.equals(str2)

10.

Which library should be included to use the "printf" and "scanf" functions in C?

a)

stdio.h

b)

conio.h

c)

math.h

d)

string.h

11.

What does the "sizeof" operator in C return?

a)

Memory address

b)

Value of the variable

c)

Size of the data type

d)

Index of the element

12.

How do you declare a constant in C?

a)

const int x;

b)

int constant x;

c)

final int x;

d)

#define x 5

13.

Which of the following is not a storage class in C?

a)

auto

b)

static

c)

constant

d)

register

14.

What does the "break" statement do in a loop in C?

a)

Exits the loop and continues with the next iteration.

b)

Exits the loop and terminates the program.

c)

Skips the current iteration and continues with the next one.

d)

Jumps to a labeled statement.

15.

Which header file is used for input and output operations in C?

a)

stdlib.h

b)

conio.h

c)

iostream.h

d)

stdio.h

16.

How do you define a macro in C?

a)

#macro MY_MACRO

b)

define MY_MACRO

c)

#define MY_MACRO

d)

macro MY_MACRO

17.

What is the result of the expression 10 / 3 in C?

a)

3

b)

3.33

c)

3.0

d)

3.3333

18.

What does the "getchar()" function do in C?

a)

Reads a character from the standard input.

b)

Returns the character 'g'.

c)

Gets a random character.

d)

Returns the next character in a file.

19.

How do you include a header file in your C program?

a)

#include "myheader.h"

b)

include "myheader.h"

c)

header "myheader.h"

d)

<myheader.h>

20.

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

a)

function myFunction() {}

b)

void myFunction() {}

c)

def myFunction() {}

d)

function void myFunction() {}

21.

How do you declare a multi-dimensional array in C?

a)

int myArray[];

b)

int myArray[][];

c)

int myArray[][];

d)

int myArray[3][3];

22.

What does the "NULL" pointer represent in C?

a)

A pointer to the address 0x0000

b)

A pointer to the end of memory

c)

An uninitialized pointer

d)

A pointer to the last allocated memory

23.

What is the primary purpose of the "if" statement in C?

a)

Loop control

b)

Function definition

c)

Conditional execution

d)

Variable declaration

24.

Which of the following is an example of a post-increment operator in C?

a)

x++

b)

++x

c)

x--

d)

--x

25.

What is the purpose of the "return" statement in a function in C?

a)

Print a value to the console

b)

Exit the program

c)

Terminate the current function and return a value

d)

Define a new function

26.

Which C function is used to open a file for reading?

a)

open()

b)

fopen()

c)

read()

d)

getfile()

27.

What is the correct syntax for a "for" loop in C?

a)

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

b)

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

c)

for (int i = 0; i < 10)

d)

for (i < 10; int i++)

28.

How do you access the first element of an array in C?

a)

array[0]

b)

array.first()

c)

array[1]

29.

What is the purpose of the "do...while" loop in C?

a)

Execute a block of code repeatedly as long as a condition is true.

b)

Execute a block of code repeatedly a specific number of times.

c)

Execute a block of code once and then check a condition

d)

Execute a block of code only if a condition is true.

30.

Which operator is used to access the value pointed to by a pointer in C?

a)

*

b)

&

c)

->

d)

.

31.

How can you check if a character is a digit in C?

a)

isdigit(char)

b)

char.isDigit()

c)

isNumeric(char)

d)

isnumber(char)

32.

What is the purpose of the "continue" statement in a loop in C?

a)

Exits the loop.

b)

Skips the current iteration and continues with the next one

c)

Continues with the next statement outside the loop.

d)

Halts the program.

33.

Which operator is used for logical AND in C?

a)

&

b)

&&

c)

|

d)

||

34.

What is the result of the expression 5 == 3 in C?

a)

1 (true)

b)

0 (false)

c)

5

d)

3

35.

What is the purpose of the "typedef" keyword in C?

a)

Define a new data type.

b)

Declare a variable.

c)

Create a macro.

d)

Include a header file.

36.

Which function is used to free the memory allocated by "malloc" in C?

a)

free()

b)

clear()

c)

dealloc()

d)

release()

37.

What is the purpose of the "switch" statement in C?

a)

Execute a block of code repeatedly.

b)

Make decisions based on multiple conditions

c)

Create a function.

d)

Define a variable.

38.

Which of the following is an example of a preprocessor directive in C?

a)

int main() {}

b)

#include <stdio.h>

c)

void printHello() {}

d)

int x = 5;

39.

How do you define a constant string in C?

a)

"Hello, World!"

b)

const char message[] = "Hello, World!";

c)

string message = "Hello, World!";

d)

constant char[] message = "Hello, World!";

40.

What is the purpose of the "goto" statement in C?

a)

Jump to a specified label within a function.

b)

Exit a loop.

c)

Define a new function.

d)

Return a value from a function.

41.

Which header file is used for mathematical functions in C?

a)

math.h

b)

stdio.h

c)

string.h

d)

conio.h

42.

How do you declare an array of integers in C with 10 elements?

a)

int array[10];

b)

int array = [10];

c)

int array(10);

d)

array array(10);

43.

What is the purpose of the "break" statement in a "switch" statement in C?

a)

Exits the "switch" statement

b)

Exits the program.

c)

Exits the current iteration of the loop.

d)

Skips the current case and continues with the next one.

44.

How do you get the address of a variable in C?

a)

&x

b)

*x

c)

@x

d)

#x

45.

What is the result of the expression 2 << 2 in C?

a)

8

b)

4

c)

2

d)

6

46.

What is the purpose of the "union" in C?

a)

To define a new data type.

b)

To group variables of different data types into a single memory location.

c)

To perform mathematical operations.

d)

To declare a structure.

47.

How do you pass an array to a function in C?

a)

void myFunction(array)

b)

void myFunction(int array[])

c)

void myFunction(array[])

d)

void myFunction(int[] array)

48.

What is the result of the expression "sizeof(int)" in C?

a)

1

b)

4

c)

2

d)

8

49.

What is the purpose of the "volatile" keyword in C?

a)

To define a constant variable.

b)

To optimize code for faster execution.

c)

To indicate that a variable may be changed outside the program.

d)

To specify a storage class.

50.

How do you define a multi-line comment in C?

a)

// This is a comment

b)

/* This is a comment */

c)

# This is a comment #

d)

' This is a comment '