Quiz 1 Computers and Programming
True (This is the difference between compiled and interpreted code. Compiler translates to machine code in one go.)
After compiling a program the source code is no longer necessary to run the program.
To explain the purpose of a program To remind the coder how they wrote the program To make the code more readable to others
Comments are used for the following reasons
False
Compiled code is better than interpreted code.
False
Computers must be binary, i.e. run on 0s and 1s.
True
Expressions are fragments of code containing literals, variables and operators that produce a new value.
True
High-level programming languages are designed to be understood by humans. Low-level programming languages are designed to be understood by machines.
Online, on the student network or on your own laptop/home computer
In which of the following ways can we run python in this class?
import
Python scripts are run in a shell using which command?
Either prompted by a print statement or taken as a (pre-defined) argument to a function
User input can be
Remember, variable names have to start with a letter or underscore (_). x_1 _x1 x1 _1x
Which of the following are valid variable names in python?