wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PRETEST CP1 2.1

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

C++ was developed by __________.

a)

Charles

b)

Bjarne Stroustrup

c)

Pascal

d)

Dennis

2.

C++ is a ________ language.

a)

Office-oriented procedure

b)

Office-oriented programming

c)

Object-oriented procedure

d)

Object-oriented programming

3.

________ are the smallest individual units of a program and their meaning and usage unchanged.

a)

Tokens

b)

Information

c)

Data

d)

Letter

4.

Which of the following are the C++ tokens?

a)

Variables

b)

Operators

c)

Keywords

d)

All

5.

Keywords are also called as ________.

a)

Reserved words

b)

Same words

c)

Individual words

d)

Special words

6.

________ are names given to different entries such as variables, structures, and functions.

a)

Keywords

b)

Constants

c)

Identifiers

d)

Operators

7.

______ are like a variable, except that their value never changes during execution once defined.

a)

Operators

b)

Variables

c)

Keywords

d)

Constants

8.

A ______ is a meaningful name of data storage location in computer memory.

a)

constant

b)

keyword

c)

operator

d)

variable

9.

C++ ______ is a symbol that is used to perform mathematical or logical manipulations.

a)

operator

b)

variable

c)

constant

d)

keyword

10.

Which symbols are called as arithmetic operators?

a)

< > <= >= == !=

b)

&& || !

c)

+ - * / %

d)

=+ =- =* =/ =%

11.

In Object-Oriented Programming (OOP), what is a class primarily known as?


a)

A blueprint or template for creating objects


b)

A variable declaration


c)

A runtime object


d)

A method or function


12.

Which keyword is used to create a new instance of a class?


a)

make

b)

new

c)

instantiate

d)

answer

13.

What keyword is used when declaring a method that belongs to the class itself, rather than to an instance of the class?


a)

public

b)

instance

c)

this

d)

static

14.

When defining a method, what part specifies the type of value the method will return?


a)

The parameter list


b)

The return type


c)

The method body


d)

The method name


15.

In a switch statement, which case acts as a catch-all for values that do not match any explicit case?


a)

default

b)

catch

c)

else

d)

if-else

16.

Which loop is typically best suited for iterating over elements in a collection (like an array) without needing to manage an explicit index variable?


a)

do-while

b)

while

c)

foreach

d)

for

17.

What keyword is used to exit a loop or a switch statement immediately?


a)

exit

b)

return

c)

continue

d)

break

18.

Which loop is guaranteed to execute its body at least once?


a)

do-while

b)

foreach

c)

while

d)

for

19.

Which statement is used for making a decision based on a Boolean condition?


a)

try-catch

b)

if-else

c)

switch

d)

while

20.

Which logical operator represents the 'OR' condition?


a)

&&

b)

||

c)

!

d)

&!

21.

What is the compound assignment operator to add 5 to a variable x?


a)

x += 5;


b)

x =+ 5;


c)

x + 5;


d)

x = x + 5;


22.

Which operator is used for checking if two values are not equal?


a)

<>

b)

!=

c)

==

d)

!==

23.

What is the modulus operator in C#, used to find the remainder of a division?


a)

/

b)

%

c)

^

d)

**

24.

Which of the following is a reference type in C#?


a)

double

b)

struct

c)

Array

d)

enum

25.

What is the term for converting a value type to a reference type (e.g., int to object)?


a)

Parsing

b)

Casting

c)

Boxing

d)

Unboxing

26.

Which keyword is used for implicitly typed local variables, allowing the compiler to deduce the type from the initialization expression?


a)

var

b)

type

c)

auto

d)

let

27.

What is the default size for a standard int type in C#?


a)

32 bits

b)

16 bits

c)

8 bits

d)

64 bits

28.

In C#, which data type is used to store a sequence of characters?


a)

Text

b)

string

c)

char[]

d)

long

29.

Which keyword is used for declaring a variable that can store whole numbers?


a)

char

b)

int

c)

bool

d)

float

30.

Which of the following is a value type in C#?


a)

string

b)

class

c)

int

d)

Array