Michael Jardine
Quiz by , created more than 1 year ago

Week 02: Variables, Expressions Lecture 04: Expressions and command-line arguments - Using the command-line: getting information in to your program - Expressions: how to do calculations

3
0
0
Michael Jardine
Created by Michael Jardine almost 6 years ago
Close

INFO L04 (w02-2) - Expressions and command-line Arguments

Question 1 of 5

1

If trying to import a command-line argument when none was entered ("something = sys.argv[1]"), the error produced will be:

Select one of the following:

  • NameError

  • SyntaxError

  • IndexError

Explanation

Question 2 of 5

1

If trying to import a command-line argument when "import sys" hasn't been entered, the error produced will be:

Select one of the following:

  • NameError

  • SyntaxError

  • IndexError

Explanation

Question 3 of 5

1

When running “python3 working.py 12.8”, sys.argv[1] is which of the following?

Select one of the following:

  • "12.8"

  • "working.py"

  • 12.8

Explanation

Question 4 of 5

1

What will be the output of the following code: x = 3 y = x x = 5 print(y)

Select one of the following:

  • 3

  • 5

  • an Error of some sort

  • y

Explanation

Question 5 of 5

1

What will be the output of the following code: x = 3 y = x x = 5 print('y')

Select one of the following:

  • 3

  • 5

  • An Error of some sort

  • y

Explanation