1/60
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which of the following are true of expressions? check all that apply
a. every expression will evaluate to a value
b. every expression evaluates to a specific type
c. anywhere you can write an expression that evaluates to one type, you could write another expression in its place as long as it evaluates to the same type and still have a validly types program
all is true
In the following expressions which operator would be evaluated first using standard order of operations?
1 + 2 / 4 * 5 - 6
/
which operator is used to raise on number to the power of another
**
which operator is used for integer division and results in an int typed value
//
which operator is used to find the remainder of an integer division calculation and results in an int typed value
%
which of the following boolean expressions results in a value of False? check all that apply
a. 1 > 0
b. 1 > 1
c. 1 > 2
d. 1 >= 0
e. 1 >= 1
f. 1 >= 2
b, c, f
what is the result of evaluating the expression "A" > "b"
False
True or False: Comparing two string values using relational operators always works the way you would expect it to in the English language
False
which relational operators tests whether two values are equal to one another?
==
what does the final variable access expression evaluate to in this sequence of statements?
>>> x: int = 1
>>> x = x + 1
>>> x
2
what does the final type function call evaluate to In this sequence of statements?
>>> course: str = "110"
>>> type(int(course))
int
>>> from random import random
>>> random( )
what type does a call to the random function evaluate to?
>>> from random import choice
>>> choice("wxyz")
what type does a call to the choice function evaluate to in this example
how many different patterns can be formed with 16 bits?
2^16
in the following function call expression, which symbol is an argument?
int(0b01000001)
0b01000001
what is the type of True
boolean
what is the evaluation of
1_000 + 1_000_000
1001000
what is the evaluation of
10 / 2
5.0
what is the evaluation of "U" + "N" + "C"
'UNC'
given the string "12345" what is the evaluation of "12345"[0]
'1'
what is the evaluation of
"spooky season"[2 + 2]
'k'
what is the evaluation of "spooky"[len("spooky")]
error: string index out of range
what are the valid bool values in Python
True and False
when will you commonly use bool values in your program?
a. when performing computations
b. when working with textual data
c. when making logical decisions
d. bool values are uncommonly used in programs
c. when making logical decisions
true of false: a program is a sequence of steps
true
true or false: an algorithm is a set of instructions that is fixed in length and can only process a fixed amount of data
false
true or false: a low-level program is one whose format is primarily intended for humans to read and right
false
true or false: programming languages are designed by and for humans
true
what word describes the meaning implied by punctuation, spacing, words, rules, and names in your program?
semantics
true or false: the purpose of the interpreter is to read and evaluate the instructions we write in an interpreted language, such as python, so that our central processing unit can carry out our instructions
true
does syntax errors occur during the reading step or the evaluation step of the interpreter?
during the reading step of the interpreter
true or false: if your program has correct syntax it will not have any bugs
false
is the reading step or the evaluation step of the interpreter responsible for carrying out your instructions?
the evaluation step of the interpreter
where are the names of everything (identifiers, functions, class, etc.) defined the a process bound?
call stack
true or false: a built-in is a function whose name is bound an defined before the code of your program begins
True
true or false: the names you define in your code exist in the globals area
true
what layer of the computing system will the programs you write exist?
user space processes
which of the following is a "program in motion"?
a. CPU
b. Process
c. memory
d. storage
b process
what layer of the computing systems purpose is to make it easy for you as the user to start, control, and stop the processes running on a computing system
shell
which of the following kinds of shells exist? select all that apply
a. graphic user interface
b. textual (command-line interface)
a and b
what is the name of the program or VSCode pane that you use to run a textual shell?
terminal
what is the primary purpose of the operating system kernel?
a. to fairly share the resources of your machine
b. protects processes from each other
c. it is the layer of the system where your program exist
a and b
what are the three primary components of hardware were concerned with in this course
a. operating system
b. CPU
c. memory (ephemeral, fast)
d. storage (persistent, slower)
b, c, d
what part of the system is responsible for controlling what resources are available to processes?
OS kernel
true or false: when your program is running as a process, the process keeps track of what step of the instructions it is currently working on or needs to do next
true
true or false: when your program is running as a process, the process knows what memory it has available to it
true
which of the following int expressions could you use as an index to access the third character (c) of the string "abcdef". select all that apply
a. 0
b. 1
c. 2
d. 3
e. len("abcdef") - 1
f. len("abcdef") - 3
g. len("abcdef") - 4
c
g
what operation is taking place when the + operator is evaluated in the following expression
"100" + "10.0"
concatenation
true or false: there are no differences between float values and decimal values because floats are decimals
false
in the following expression, which operator will evaluate first?
(1 - 2) / 3 + 4 * 5 6
-
which of the following is a str literal?
a. fifty_percent
b. "0"
c. two
d. '3.14'
e. 1_100
f. "the quiz brown fox"
b, c, f
which of the following are float literals?
a. fifty_percent
b. 0
c. 0.0
d. "0"
e. 1
f. "3.14"
g. 110.0
c, g
what two kinds of expressions are demonstrated in the complex expression below? select both
sqrt(110)
a. literal
b. operators
c. variable access
d. function call
e. method call
true or false: the following two statements are equivalent to one another
a = b
vs.
b = a
false
the following expressions evaluates to what
"Zayn" > "harry"
False
true or false: the central processing unit of your computer is able to directly understand and follow the high-level python code you write
false
true or false: every bit pattern has a single, unique interpretation in all contexts
false
when you open your terminal in VSCode and type a command such as python, what kind of software are you most directly interacting with in order to start a new python process?
a. User Space programs
b. Shell
c. Operating Systems
d. Hardware
b
true or false: the expressions you write in a program evaluate as you are typing them into a .py file
false
which of the following data types is subscription ("indexing") syntax valid with? select all that apply
a. bool
b. str
c. int
d. float
b
true or false: 0101 is an int literal
false
int literals can be 0 or a nonzero digit followed by zeros