wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Computer Science Webxam

Total questions: 74

Worksheet time: 15hrs 8mins

Name
Class
Date
1.

Which of the following is NOT an input device?

a)

mouse

b)

printer

c)

scanner

d)

microphone

2.

Which of the following is true about main and secondary memory?

a)

Secondary memory is lost when the device's power is turned off.

b)

Main memory is short term memory used by the CPU in processing commands, secondary memory is more permanent and used for storage.

c)

Main memory is more permanent and used for storage, secondary memory is short term memory is used by the CPU in processing commands

d)

Main memory is used for storage

3.

Which of the following controls computer memory?

a)

applications

b)

compiler

c)

operating system

d)

Python

4.

What is the correct order for the steps the compiler uses in translating code?

a)

Translate commands to machine language, Check for mistakes, Run the commands

b)

Run the commands, Translate commands to machine language, Check for mistakes

c)

Check for mistakes, Translate commands to machine language, Run the commands

d)

Run the commands, Check for mistakes, Translate commands to machine language

5.

What is input?

a)

Displaying information on the screen.

b)

Storing data in main memory.

c)

Putting information into the computer

d)

Converting code to machine language.

6.

Which of the following is a legal variable name?

a)

1test

b)

52

c)

#data

d)

temperatureAM

7.

What command is used to change a string into a number?

a)

dec

b)

chr

c)

int

d)

str

8.

What is output by the following?


print("Twinkle, \ttwinkle, \tlittle star")

a)
b)

Twinkle,

twinkle,

little star

c)

Twinkle, \ttwinkle, \tlittle star

d)

Twinkle, twinkle, little star

9.

What is output by the following? Assume the user enters 5 and 4

x = input("Enter a number: ")

y = input("Enter a number: ")

print("Values: " + x + y)

a)

Values: 9

b)

9

c)

Values: 54

d)

54

10.

Consider the following code:


x = "apple"

y = x

z = "banana"

print(x + " " + y + "\n" + z)

What is output?

a)
b)

apple banana

c)

apple apple banana

d)

apple apple

banana

11.

Which of the following correctly inputs two numbers and print the sum?

a)

n1 = input("Enter a number: ")

n2 = input("Enter a number: ")

print("The answer is: " + int(n1+n2))

b)

n1 = input("Enter a number: ")

n2 = input("Enter a number: ")

print("The answer is: " + str(n1+n2))

c)

n1 = int(input("Enter a number: "))

n2 = int(input("Enter a number: "))

print("The answer is: " + int(n1+n2))

d)

n1 = int(input("Enter a number: "))

n2 = int(input("Enter a number: "))

print("The answer is: " + str(n1+n2))

12.

Consider the following code:

x = input("What year is it?")

print(x)

The value stored in x is:

a)

a String

b)

a number

c)

stored in secondary memory

d)

a comment

13.

Consider the following code:

print("computer" + "science")

What is output?

a)

computer

science

b)

computer science

c)

computerscience

d)

Nothing, there is an error - you cannot add words.

14.

What is one downside of converting analog information to a digital format?

a)

When the power is turned off the information is lost

b)

Limits the technology available

c)

Some information may be lost when it is converted

d)

It takes up too much space in memory

15.

The symbol used to create a comment is:

a)

=

b)

#

c)

+

d)

%

16.

Which of the following will correctly output:


I know there's a proverb which that says

"To err is human,"

but

a human error is nothing to what a computer

can do if it tries.


― Agatha Christie

Note: This is a direct quote from Agatha Christie's novel, Hallowe'en Party. The grammar shown here is as it is written in the novel.

a)

quote = "\"To err is human,\""

print("I know there's a proverb which that says \t"+ quote + "\tbut")

print("a human error is nothing to what a computer")

print("can do if it tries.\t\t― Agatha Christie")

b)

quote = "To err is human,"

print("I know there's a proverb which that says \n"+ quote + "\nbut")

print("a human error is nothing to what a computer")

print("can do if it tries.\n\n- Agatha Christie")

c)

quote = "\"To err is human,\""

print("I know there's a proverb which that says \n"+ quote + "\nbut")

print("a human error is nothing to what a computer")

print("can do if it tries.\n\n- Agatha Christie")

d)

quote = "\"To err is human,\""

print("I know there's a proverb which that says \n + quote + \nbut")

print("a human error is nothing to what a computer")

print("can do if it tries.\n\n- Agatha Christie")

17.

When do we use numbers instead of strings?

a)

To input large amounts of data

b)

To store data like phone numbers and street addresses

c)

When you need to do calculations

d)

To hold both words and integers

18.

Which of the following about computers is NOT true?

a)

Computing devices are electronic

b)

The CPU processes commands.

c)

The memory uses binary numbers

d)

Computing devices translate digital to analog information in order to process the information.

19.

Which line of code outputs the decimal portion of a float stored in the variable x?

a)

print (x / 1000)

b)

print (x - int(x))

c)

print (x)

d)

print (x % 1000)

20.

Which of the following is NOT a data type in Python?

a)

float

b)

string

c)

decimal

d)

integer

21.

Three of the following values could be stored as strings. When would you NOT use a string command?

a)

To store a list of colors

b)

To store decimal values

c)

To store a word

d)

To store values NOT used for calculations,

22.

Which of the following numbers might this code generate: random.randint(1,9)?

a)

10

b)

1

c)

11

d)

0

23.

What is NOT a built-in function in python?

a)

sqrt()

b)

string()

c)

fabs()

d)

print()

24.

To generate numbers between and including -10 to 10 you would use:

a)

random.random()*20 + -10

b)

randint(-10, 10)

c)

random.random(-10, 10)

d)

random.randint(-10, 10)

25.

Consider the following code:

a = 3 b = 2

print (a ** b)

What is output?

a)

1

b)

6

c)

8

d)

9

26.

What is output?

print (12 % 5)

a)

0

b)

1

c)

2

d)

5

27.

Consider the following code:

x = 9

y = -2

z = 2

print (x + y * z)

a)

5

b)

9

c)

12

d)

14

28.

You need to find the square root of a value. Which of the following functions would you use?

a)

int

b)

sqrt

c)

fabs

d)

pow

29.

You need to make sure a number the user types in is non-negative. Which of the following functions would you use?

a)

abs

b)

fabs

c)

pos

d)

int

30.

Consider the following code:

x = 5

x = x * 3

print (x)

What is output?

a)

5

b)

15

c)

27

d)

75

31.

The following code is intended to find the average of three numbers entered from the keyboard. What is wrong with the code?

print ("Enter 3 numbers: ")

n1 = float(input ("Enter a number: "))

n2 = float(input ("Enter a number: "))

n3 = float(input ("Enter a number: "))

print (n1 + n2 + n3 /3)

a)

n1, n2, and n3 should use the str command

b)

The code is missing parentheses around n1 + n2 + n3 in the last line

c)

Nothing, it correctly finds the average of the numbers

d)

Nothing, it correctly finds the sum of the numbers.

32.

What is the output for the following?

x = 7

print ("The number is: " + x * 2)

a)

14

b)

The number is: 14

c)

The number is: x

d)

None, there is an error

33.

Which of the following calculates to 10?

a)

3 * 6 + 2 /2

b)

(3 * 6) + 2 /2

c)

(3 * 6 + 2) /2

d)

3 * (6 + 2 /2)

34.

Which of the following would be the best variable name to store the value of your English letter grade?

a)

g

b)

LG

c)

1grade

d)

letter_Grade

35.

Why can it be helpful to perform mathematical calculations using programming? Choose the best answer.

a)

Because is an important skill.

b)

Because computers can quickly do calculations much larger and complex than humans.

c)

Because the values stored in variables cannot change

d)

Because computers are used to store digital data, not analog

36.

Consider the following code:

x = 19 y = 5

print (x % y)

What is output?

a)

2

b)

3

c)

4

d)

3.8

37.

Consider the following code:

print (min("whom", "carton", "landform", "composite", "apron", "deposit", "become"))

What is output?

a)

apron

b)

become

c)

carton

d)

whom

38.

5%2

a)

3

b)

5

c)

2

d)

1

39.

42%6

a)

7

b)

1

c)

0

d)

2

40.

81%2

a)

0

b)

3

c)

1

d)

9

41.

55%10

a)

0

b)

5

c)

50

d)

5.5

42.

18%4

a)

2

b)

0

c)

1

d)

3

43.

What is output by the following?

print ("she sells \nseashells")

print ("by the seashore")

a)

she sells seashells by the seashore

b)

she sells

seashells by the seashore

c)

she sells

seashells

by the seashore

d)

she sells seashells

by the seashore

44.

What is output by the following?

print ("/\\")

print ("\\/")

a)

/\

\/

b)

/\\

\\/

c)

/\\/

d)

/\\\\/

45.

What is output by the following? Assume the user enters Sally and John.

x = input ("What is your name? ")

y = input ("What is your friend's name? ")

print ("Hi " + x + " and " + y)

a)

Hi x and y

b)

Hi Sally and John

c)

Hi + x + and + y

d)

Hi + Sally + and + John

46.

The print command in Python can be written as PRINT or print

a)

True

b)

False

47.

What is wrong with the following line of code?

print(Hello World)

a)

print should be PRINT

b)

It cannot print words

c)

It needs " around Hello World

d)

It needs # around Hello World

48.

What is the Python command that can be used to display text and numbers on the screen?

a)

print

b)

hello

c)

+

d)

python

49.

What is output by the following line of code?

print ("I\tLove Python")

a)

I Love Python

b)

I Love Python

c)

I Love Python

d)

I\tLove Python

50.

What is output by the following line of code?

print (5 + 9*2)

a)

23

b)

592

c)

518

d)

28

51.

What would be output by the following code?

print("Hello", end="")

print(" Jackson")

a)

Hello, end="" Jackson

b)

Hello Jackson

c)

HelloJackson

d)

Hello

Jackson

52.

What is output by the following lines of code if we input the name "Sally"?

n = input("What is your name?")

print("Hello there " + n)

a)

There is an error since the input command needs a str

b)

Hello there Sally

c)

Hello there 0

d)

Hello there n

53.

This code accepts a word as input, and then prints that word to the screen.

w = input("Enter a word: ")

print(w)

a)

The number is printed.

b)

Nothing is printed.

c)

Nothing, there is an error.

54.

Assume the user types in 7 and 10. What is output by the following?

num1 = input ("Enter a number: ")

num2 = input ("Enter a number: ")

print (num1 + num2)

a)

17

b)

71

c)

No output, there is an error.

d)

710

55.

What is wrong with the following code?

num1 = int (input("Enter a number: "))

num2 = int (input("Enter a number: "))

num3 = int (input("Enter a number: "))

print ("The average is: " + (num1 + num2 + num3)/3)

a)

The variables should be 1num, 2num, 3num

b)

It needs a int() command

c)

The last line should be print ("The average is: (num1 + num2 + num/3 ))

d)

It needs a str() command

56.

What is output?

a = 10

b = 23

print (a + b * a)

a)

150

b)

235

c)

33

d)

240

57.

What does the % find?

a)

The product

b)

The mean

c)

The remainder

d)

The quotient

58.
Data and information in the real world.
a)
analog
b)
binary
c)
digital
d)
program
e)
escape characters
59.
Notes in computer code for the programmer - the computer ignores them. Marked in Python with a #.
a)
comment
b)
secondary memory
c)
main memory
d)
software
e)
escape characters
60.
Translates code to machine language.
a)
compiler
b)
comment
c)
variable
d)
main memory
e)
program
61.
A number system based on ten, the number system we normally use.
a)
decimal
b)
binary
c)
analog
d)
digital
e)
software
62.
Special characters marked with the \
a)
escape characters
b)
binary
c)
analog
d)
int
e)
variable
63.
The user sends information to the computer.
a)
input
b)
comment
c)
compiler
d)
program
e)
software
64.

Short term memory; temporary; power off = all information is lost.

a)

main memory

b)

secondary memory

c)

compiler

d)

software

e)

CPU

65.

Tells Python to handle the value in the ( ) as a String, not as a number.

a)

str

b)

Str

c)

int

d)

integer

e)

String

66.
A name for a spot in the computer's memory.
a)
variable
b)
comment
c)
main memory
d)
String
e)
secondary memory
67.

The process of storing a value in a variable.

a)

Assignment

b)

Function

c)

Max

d)

Module

68.

Command that pulls in code to add functions to your code

a)

Operator

b)

Module

c)

Function

d)

Import

69.

A symbol that defines a math operation.

a)

Function

b)

Operator

c)

Assignment

d)

Import

70.
Numeric data stored in a computing device.
a)
digital
b)
analog
c)
binary
d)
decimal
e)
escape characters
71.

The process of using technology to solve human problems.

a)

Computer Science

b)

Computer

c)

CPU

d)

Program

72.

A command that displays text and numbers on the screen.

a)

print( )

b)

str( )

c)

input()

d)

int( )

73.

A program that translates written code into machine language.

a)

String

b)

Operating System

c)

Compiler

d)

Program

74.

An electronic device consisting of hardware and software.

a)

Escape Characters

b)

String

c)

Computer

d)

Integrated Development Environment (IDE)