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

Description

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
Michael Jardine
Quiz by Michael Jardine, updated more than 1 year ago
Michael Jardine
Created by Michael Jardine almost 6 years ago
3
0

Resource summary

Question 1

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

Question 2

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

Question 3

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

Question 4

Question
What will be the output of the following code: x = 3 y = x x = 5 print(y)
Answer
  • 3
  • 5
  • an Error of some sort
  • y

Question 5

Question
What will be the output of the following code: x = 3 y = x x = 5 print('y')
Answer
  • 3
  • 5
  • An Error of some sort
  • y
Show full summary Hide full summary

Similar

INFO L03 (w02-1) - Variables and Expressions
Michael Jardine
INFO L02 (w01-2) - Programming basics
Michael Jardine
INFO L06 (w03-2) - Control Flow - WHILE
Michael Jardine
GEGE2001 Quiz 2
Michael Jardine
GEGE2001 Quiz 4
Michael Jardine
GEGE2001 Quiz 1
Michael Jardine
GEGE2001 Quiz 3
Michael Jardine
TDAH (TRASTORNO POR DEFICIT DE ATENCION CON HIPERACTIVIDAD)
leo garavito
Aplicaciones Automatas
Diego Zerkk
Adobe InDesign
Nicole Gentle
Tipos de computadoras por estructura interna y capacidad de procesamiento
hebby.mena403