Python quiz
What is the file extension for javascript?
.js
5 * 2 + 1
11
>>> 3 + 5 * 2
13
Which is an example of a syntax error?
2 (4*2)
Why doesn't a Python file execute when you double-click it?
Double-clicking does not run the Python Interpreter on the source code.
Source code is written in rich text.
False
What IDE feature allows you to get suggestions as you type?
IntelliSense
What is the IDE used for ios apps?
Xcode
Which command exits from the Python command-line prompt?
exit()
Python treats all numbers the same, regardless of numerical value.
false
Which of these is NOT a reason why we chose Python as the language for the course?
highly performant
Which command will start the Python prompt on your computer?
python3
Why are there many programming languages?
to address many different computing needs
In programming, a crash is when your program stops early or freezes because something unexpected happened.
true
To get Python code suggestions, you need to tell VS Code which Python interpreter to use.
true
Which language does not use a hybrid compiler/interpreter approach?
C++
Which language is considered an interpreted language?
C++
Which concern could be considered a disadvantage of Python under certain circumstances?
Python is a general-purpose language.
Why does VS Code need a Python interpreter to be specified?
to provide code suggestions
Which expression evaluates to 20?
(2 + 3) * 4
3 + 2 * 5
13
Which Mac application allows you to run commands and execute scripts in a command-line interface?
Terminal
When would a removal of white space be problematic?
removing the space after the "if" in if x==1
Although Python ignores empty lines, one place where whitespace does make a difference is inside of _____.
strings
Which character starts a comment in Python?
#
Which string definition results in an error?
'hello'
Which statement is true regarding Python on a Mac?
A Mac comes with a version of Python already installed.
Which is an example of a runtime error?
name = "It's me!" print("Hello.", Name)
How would you write the "Hello, world!" program in Python?
print("Hello, world!")
Programming can be defined as: converting ideas into _____ that a computer can understand.
instructions
What tool is used to write source code?
Text editor
Why do computer instructions need to be sequential?
The order in which these instructions are executed is important.
You have Python 3 installed. How will you run the Python code in the file "process.py" on the command-line prompt?
python3 process.py
When working with the Terminal inside of VSCode, how can you expand the pane?
Click the up arrow.
Whats the file extension for python?
.py
Which of these will not output:
print('I'm learning a lot!')
The code below, which is supposed to print the value of the variable x, is not working. Which category does the error fall under? x = 5 print("x")
semantic
Typing "What is 2 plus 2?" into the Python prompt causes a _____.
syntax error
2 * 3 + 2 * 5
16
Which expression evaluates to 2?
5 % 3
Which statement is true regarding Python support in VS Code?
You need to install a VS Code extension to support Python.