COMPLETE QUESTIONS AND CORRECT
DETAILED ANSWERS WITH RATIONALES
What is a program? - correct answer-a set of instructions that a computer follows to perform a task
What is a compiler? - correct answer-
A compiler converts the whole program into machine code before it is run.
What does 2**2 do - correct answer-This will raise 2 by the 2 power
What does // do - correct answer-This is integer division (division without remainder)
- eg 7 // 3 = 2
What does % do in python? - correct answer-This is modulus sign (remainder from division)
- eg 7%3 = 1
What angles do trig functions use? - correct answer-Radians
What is the computer memory hierarchy - correct answer-Fastes - CPU registers
Cache
Main memory
Secondary memory (Files)
Slowest Offline Memory
As you go from the cpu registers to the offline memory, what happens - correct answer--
slower to access
- more total data
- more long lasting/permanent
, What are variables? - correct answer-Boxes of memory
X 2 X 2 X 2 X 2 X 2 X 2 X 2
For a variable name, what does it have to start with - correct answer-
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
Has to start either with a letter to an underscore
X2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
- cannot start with a number X 2 X 2 X 2 X 2
- and cannot be and reserved keyword like while or if
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
What is the order of assignment of variables - correct answer-
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
First we evaluate the RHS, then assign that value to the LHS
X2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
What are the integers? - correct answer-whole numbers and their negatives
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
What are floating point numbers? - correct answer-numbers with decimal points, positive or negative
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
What re Boolean? - correct answer-True or False
X 2 X 2 X 2 X 2 X 2 X 2 X 2
What is a string? - correct answer-A sequence of characters, or text
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
How would you add a quotation to a string -
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
correct answer-
X 2 X 2
Add a back slash to specify which character you want to print
X2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
- eg 'He said "i\m tired."'
X 2 X 2 X 2 X 2
How to print one backslash - correct answer-\\
X 2 X 2 X 2 X 2 X 2 X 2 X 2
How to print a tab - correct answer-\t
X 2 X 2 X 2 X 2 X 2 X 2 X 2
how to print on a new line - correct answer-\n
X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2 X 2
How to print a backspace - correct answer-\b
X 2 X 2 X 2 X 2 X 2 X 2 X 2