wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming

Total questions: 45

Worksheet time: 45mins

Name
Class
Date
1.

Programmers make use of what type of program in order to translate higher-level language statements into machine code?

a)

A compiler

b)

A command prompt

c)

An IDE

d)

A JIT

2.

A program's execution of various statements and procedures in a correct order to produce desired results is referred to as what defining characteristic?

a)

The methods of the program

b)

The program's GUI

c)

The attributes utilized by the program

d)

The program's logic

3.

What is the process of removing all syntax and logical errors from a program in order to create a working program that accomplishes all intended tasks known as?

a)

commenting out

b)

debugging

c)

executing

d)

compiling

4.

What is an object in relation to a defined class in a programming language?

a)

It is a property of the class

b)

It is an instance of the class

c)

It defines the class state

d)

It is an interface to the class.

5.

What technique involves the packaging of an object's attributes and methods into a cohesive unit that can be used as an undivided entity?

a)

Polymorphism

b)

Inheritance

c)

Interface

d)

Encapsulation

6.

What can be used to extend an existing class so as to create a more specific class?

a)

Inheritance

b)

Abstraction

c)

Encapsulation

d)

Polymorphism

7.

What information must be supplied when utilizing a method that requires additional information in order to operate?

a)

Primitive data

b)

Arguments

c)

Complex data

d)

Literal strings

8.

The use of "void" and "static" are both examples of what predefined C# language component?

a)

attributes

b)

objects

c)

classes

d)

keywords

9.

What are nonexecuting statements that you can use to document or add notes to assist in the use of the program?

a)

Whitespaces

b)

Namespaces

c)

Aliases

d)

Program comments

10.

What must be done once a C# program has been finished before it can be used?

a)

It must be compiled into intermediate language.

b)

It must be stripped of all comments before it can run.

c)

It must be passed through a garbage collector to reduce unnecessary instructions.

d)

It must be fed to a runtime interpreter.

11.

What is NOT considered a keyword by the C# language?

a)

global

b)

implicit

c)

static

d)

catch

12.

What is the term for a named location in computer memory that can hold different values at different points in time?

a)

constant

b)

alias

c)

literal constant

d)

variable

13.

An assignment that is made when a variable is declared is known as what?

a)

An allocation of the variable

b)

An initialization of the variable

c)

A definition of the variable

d)

An assignment to the variable

14.

What type of number can be described as having varying numbers of significant digits, which contains decimal positions?

a)

integer

b)

whole

c)

floating-point

d)

int

15.

What type of arithmetic operator has one argument to the left and another argument to the right of the operator?

a)

binary

b)

unary

c)

composite

d)

complex

16.

In C#, += adds the operand on the right to the operand on the left and assigns it to the operand on the left in one step. What is the name for this operator?

a)

add and assign

b)

prefix increment

c)

increment and assign

d)

postfix increment

17.

How is a Boolean variable declared in a program?

a)

A bool type variable must be declared, followed by the bool value.

b)

A boolean type variable must be declared, followed by the bool value.

c)

A char type variable must be declared, followed by the bool value.

d)

An int type variable must be declared, followed by the bool value.

18.

You are performing an arithmetic operation and have placed the desired result type in parentheses followed by a variable to be cast with the result. What is this an example of?

a)

implicit casting

b)

intrinsic casting

c)

automatic casting

d)

explicit casting

19.

What type of program specifically allows and accepts user input?

a)

static program

b)

procedural program

c)

interactive program

d)

constant program

20.

What method can be used to accept user input from the keyboard on the console?

a)

Input()

b)

Next()

c)

NextLine()

d)

ReadLine()

21.

What method from the Convert class can be used to convert a specified value to an 8-bit unsigned integer?

a)

ToByte()

b)

ToDecimal()

c)

ToSingle()

d)

ToInt16()

22.

What happens when "string1" is added to "string2" using the + sign in the C# programming language?

a)

A type error occurs, and the program is halted.

b)

The strings are converted to integer equivalents and then added together.

c)

The strings are concatenated together.

d)

The result is returned as a boolean integer.

23.

What type of structure involves choosing between alternative courses of action based on some value within a program?

a)

literal

b)

sequence

c)

fixed

d)

decision

24.

What type of statement can be used to make a single-alternative decision?

a)

switch

b)

fork

c)

if

d)

if-else

25.

What should you use if you wish to execute two or more statements conditionally?

a)

A switch statement.

b)

A block enclosed within a pair of curly braces.

c)

A defined sequence structure.

d)

A declared decision structure.

26.

What conditional operator can be used to create a compound Boolean expression as an alternative to if statements?

a)

NOT

b)

XOR

c)

AND

d)

OR

27.

What character(s) do you use to make a conditional AND operator within a C# program?

a)

||

b)

|

c)

&

d)

&&

28.

When using a switch structure to make decisions within a program, what keyword is used to begin the structure?

a)

If

b)

Break

c)

case

d)

switch

29.

What keyword can you use to specify an action to take in the event that a test expression does not match any case?

a)

switch

b)

break

c)

else

d)

default

30.

What character(s) serve as the NOT operator in the C# programming language?

a)

<>

b)

&&

c)

&

d)

!

31.

What are the block of statements that are executed in a loop considered to be part of?

a)

the loop block

b)

an iteration block

c)

a loop body

d)

the loop header

32.

What is any single execution of a loop referred to as?

a)

A path through the loop.

b)

A lap of the loop.

c)

A round in the loop

d)

An iteration of the loop

33.

Many loop control variable values rely on an added value through each loop. What type of loop control variable is this?

a)

A reducing loop control variable.

b)

An expanding loop control variable

c)

An incrementing loop control variable

d)

A comparing loop control variable.

34.

A loop for which the number of iterations is predetermined is known as what type of loop?

a)

infinite

b)

definite

c)

indefinite

d)

counted

35.

A loop that is controlled by user input rather than altered by arithmetic is known as what type of loop?

a)

definite

b)

indefinite

c)

infinite

d)

sentinel

36.

What type of loop allows you to indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place?

a)

do

b)

while

c)

for

d)

repeat

37.

What type of loop checks a Boolean expression at the "top" of the loop before the body has a chance to execute?

a)

while

b)

do

c)

repeat

d)

switch

38.

What type of loop checks a Boolean expression at the "bottom" of the loop after each repetition has occurred?

a)

do

b)

for

c)

switch

d)

while

39.

Both the while loop and for loops are considered to be in what category of loops?

a)

posttest loops

b)

pretest loops

c)

for-test loops

d)

intest loops

40.

What type of loop is one in which the loop control variable is tested after the loop body executes?

a)

fortest

b)

pretest

c)

posttest

d)

intest

41.

Totals that are summed one at a time in a loop are known as what type of totals?

a)

accumulated

b)

derived

c)

incremented

d)

decremented

42.

What should an accumulator variable be set to before it is used to accumulate a total?

a)

0

b)

1

c)

True

d)

False

43.

A value such as a 'Y' or 'N' that must be supplied in order to stop a loop is known as what type of value?

a)

sentinel value

b)

stop value

c)

control value

d)

switch value

44.

You are writing a program that defines a variable within a loop, and then tries to use that variable outside the loop. However, the program does not run as intended. What is the issue?

a)

The variable is being overwritten inside the loop.

b)

The variable is limited to the scope of the loop.

c)

The variable is declared with an incorrect type

d)

The variable name conflicts with a built in keyword.

45.

The program you are creating must output information onto the screen, and then position the cursor on the next line in preparation for additional output. What method should you use?

a)

PrintLine()

b)

Println()

c)

Write()

d)

WriteLine()