python exam 2
which statement definition results in an error? 'It is 10am' "It's 10am" 'It's 10am' "It is 10am"
'It's 10am'
which expression evaluates to 20?
(2 + 3) * 4
if you were writing your source code in the JavaScript programming language, what file extension would you use to save your file?
.js
What is the standard extension to use for a python code file?
.py
in the python terminal, what is printed when running the following line? 5 * 2 + 1
11
what does this expression evaluate to? 3 + 2 * 5
13
which expression evaluates to 2? 5 // 3 5 % 3 2 / 4
5 % 3
which language does not use a hybrid compiler/interpreter approach?
C++
When working with the Terminal inside of VS Code, how can you expand the pane?
Click the up arrow
python treats all numbers the same, regardless of numerical value.
FALSE
source code is written in rich text
FALSE
which language is considered an interpreted language?
JavaScript
In programming, a crash is when your program stops early or freezes because something unexpected happened.
TRUE
if you were developing an application for an iPhone, which IDE would you use?
XCode
which statement is true regarding python on a mac?
a mac comes with a version of python already installed
which tool is used to write source code?
a text editor
programming can be defined as: converting ideas into ________ that a computer can understand.
instructions
How would you write the "Hello, world!" program in python?
print("Hello, world!")
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
Typing "What is 2 plus 2?" into the python prompt causes a
syntax error
Why are there so many programming languages?
to address many different computing needs
Which statement is true regarding python support in VS Code?
you need to install a VS Code extension to support python.
Which IDE feature allows you to get code suggestions while you are typing?
IntelliSense
to get python code suggestions, you need to tell VS Code which python interpreter to use.
TRUE
which mac application allows you to run commands and execute scripts in a command-line interface?
Terminal
why doesn't a python file execute when you double-click it?
double-clicking does not run the python interpreter on the source code
which command exits from the python command-line prompt?
exit( )
which of these is NOT a reason why we chose python as the language for the course? highly performant beginner-friendly relevant popular
highly performant
Which of the following will not output: I'm learning a lot!
message = "I'm learning a lot!" print(message)
which is an example of a runtime error?
name = "It's me!" print("Hello.",Name)
which concern could be considered a disadvantage of python under certain circumstances?
python is a general-purpose language.
Which command will start the python prompt on your computer?
python3
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
why do computer instructions need to be sequential?
the order in which these instructions are executed is important
Why does VS Code need a python interpreter to be specified?
to provide code suggestions
if you execute the following expression, what is the output? <<< 3 + 5 * 2
13
what does this expression evaluate to? 2 * 3 + 2 * 5
16
which is an example of a syntax error? 2 (4*2) 2 + (4/0) 2 + (4*2)
2 (4*2)