Intro to Computing Final
What operator means not equal to?
!=
What symbol is not a Boolean expression?
#
Which string definition results in an error?
'It's 10am'
If you were writing your source code in the JavaScript programming language, what file extension would you like to save your file?
.js
How would you fix the following code to return the remainder of 1,000 divided by 300?
1000 % 300
print (5%3)
2
Which is an example of a syntax error?
2 (4+2)
Which expression evaluates to 2?
5 % 3
print (2**3)
8
number = 3**2 number = 2**3 print(number)
9
Which is not a relational operator?
=
Which statement is true regarding Python on a Mac?
A Mac comes with a version of Python already installed.
number = 10 if number % 4 == 0: print(number, "is divisible by 4") print ("All done")
All done
Which language does not use a hybrid compiler/interpreter approach?
C++
Why doesn't a Python file execute when you double-click it?
Double-clicking does not run the Python interpreter on the source code.
3 != 3
False
What data type in Python represents a number with a decimal point?
Float
IDEs stands for
Integrated Development Environments
What is the output of the following Python code? first_name = "Jeff" #first_name = "Sara" print(first_name)
Jeff
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
This if-else statement is written in _____ if "apples" == "apples" puts "You're comparing the same thing" end
Ruby
Errors Categories:
Syntax - language rules broken Runtime - unable to execute Semantic - unexpected output
What is the issue with the following code? number = input("Enter a number: ") if number == 10: print ("The number is greater than 10.") else: print ("The number is less than 10.")
The conditional statement is checking for equality
Why do computer instructions need to be sequential?
The order in which these instructions are executed is important.
In programming, a crash is when your program stops early or freezes because something unexpected happen.
True
To get Python code suggestions, you need to tell VS code which Python interpreter to use.
True
With if-else statements, we will always execute one of the code blocks depending on the result of the condition test.
True
age = 15 age_to_drive = 15 print (age_to_drive)
True
If you were developing an application for an iPhone, which IDE would you use?
XCode
Which statement is true regarding Python support in VS Code?
You need to install a VS Code extension to support Python.
Which variable name is vaid in Python?
account_balance
Multiple statements grouped together are called a
block
Which code can you use to print if a test score is a pass or fail?
if (score>=60) : print("passed") else: print("failed)
Which data type is a whole number?
int
An example of a runtime error?
name = "It's me!" print("Hello.", Name)
Relational operators
operand1 (operator) operand2 => True/False
When would a removal of white space be problematic?
removing the space after the "if" in if x==1
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
Although Python ignores empty lines, one place where whitespace does make a difference is inside of
special keywords.
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
JavaScript is used for
web applications and some non-web applications
Conditional or Boolean expression
Any expression that breaks down to either true or false
When working with the Terminal inside of VSCode, 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 IDE feature allows you to get code suggestions while you are typing?
IntelliSense
Which language is considered an interpreted language?
JavaScript
Which Mac application allows you to run commands and execute scripts in a interface?
Terminal
Syntax
The rules of programming language
Which tool is used to write source code?
a text editor
Any expression that breaks down to either true or false is called a conditional, or
boolean expression.
What operator do you use to assign a value to a variable?
equals (=)
Programming can be defined as: converting ideas into _____ that a computer can understand.
instructions
Which if-else statement will not produce this output? Is divisible by 3 _____ if num % 3 == 0: print ("is divisible by 3") else: print ("is not divisible by 3")
num = 16
Equality operator
operator1 == operator2 => True/False
You have Python 3 installed. How will you run the Python code in the file "process.py" on the command-line prompt?
python 3 process.py
Which variable name is valid in Python?
speed_limit
variable = "12" print(type(variable))
str
if (num>=0) : print(num) else : print(-1 * num)
the absolute value of num
Why does VS Code need a Python interpreter to be specified?
to provide code suggestions
Python is used for
web apps, internal company tools, scientific analysis, and games.
Which character starts a comment in Python?
#
In the Python what would this output be? Print (18/(3**2))
2.0
if 5>6: print ("5 is greater than 6. Weird!") else: print ("5 is not greater than 6.") print ("7 is greater than both numbers")
5 is not greater than 6 7 is greater than both numbers