wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python and Linux Review

Total questions: 20

Worksheet time: 18mins

Name
Class
Date
1.

What does the command mkdir do?

a)

creates a file

b)

creates a directory

c)

creates a virus

d)

None of the above

2.

Which of the following is an example of an int?

a)

17.56

b)

"This is an announcement!"

c)

45

d)

[2, "dogs", "cats", 4.75]

3.

Which Linux keyword do we use to start the Python command prompt?

a)

python

b)

python3

c)

snake314

d)

None of the above

4.

Which of the following is a string?

a)

'45'

b)

"This is the one you've been looking for! Basil! Basil! Just great deals!"

c)

" "

d)

All of the above

5.

True or false: You can have a list inside another list.

a)

TRUE

b)

FALSE

6.

Consider the piece of code in the problem. What is the value of sum if we have python display it?

a)

51

b)

61

c)

None

d)

None of the above

7.

What is wrong with the following code?

a)

no problems

b)

name was not declared

c)

second was not declared

d)

word was not declared

8.

What is a boolean?

a)

a variable that is an integer

b)

a variable that has a decimal point value

c)

a true or false value

9.

A float is the same thing as an int.

a)

TRUE

b)

FALSE

10.

An int is the same thing as a float.

a)

TRUE

b)

FALSE

11.

Consider the code above. If we declare a new variable as other = "Rudolph" and another as whole_lyric to put everything together, what should whole_lyric be?

a)

whole_lyric = other + song + song_two

b)

whole_lyric = song + song_two + other

c)

whole_lyric = song + other + song_two

d)

None of the above

12.

If we have Python display the value of result, what would it be? Hint: You can use the calculator on your computer to check your work.

a)

95

b)

314

c)

276

d)

951

13.

What kind of result would we get if we typed in Python...

"12" in "Twelve Days of Christmas"

a)

TRUE

b)

FALSE

14.

What would the result be if we typed into Python:

"Malrey" in "We are Marley and Marley! Whoa!"

a)

TRUE

b)

FALSE

15.

EXTRA:

Kermit the Frog played Bob Cratchit on Muppet Christmas Carol

a)

YES

b)

NO

16.

If we declared a variable muppet_full_name, which expression would make the most sense in declaring it?

a)

muppet_full_name = None

b)

muppet_full_name = muppet_last_name + muppet

c)

muppet_full_name = muppet + muppet_last_name

d)

muppet_full_name = muppet

17.

What is the function we use in Python to call for the user's input?

a)

raw_input()

b)

say_something()

c)

input()

d)

None of the above

18.

What is the difference between rm and rmdir

a)

No difference

b)

rm removes files and rmdir removes directories

c)

rm removes directories and rmdir removes files

d)

None of the above

19.

What kind of values does a boolean variable have

a)

characters and spaces

b)

True and False

c)

int

d)

None of the above

20.

What does hostname -I do in Linux?

a)

displays the computer's hostname

b)

displays the IP address

c)

reboots the computer

d)

None of the above