EECS 600SC 2012[10](01-05) Flashcards
(19 cards)
What is the difference between declarative and imperative knowledge?
Declarative knowledge is statements of fact; imperative knowledge is “how to” knowledge.
What is the advantage of a stored-program computer?
It’s far more versatile than a fixed-program computer, since it interprets a program given to it and carries out those instructions, as opposed to being built to do one thing.
What are the syntax, static semantics, and semantics of a language?
Syntax determines whether a string is legal, static semantics determine whether the string has meaning, and semantics assigns a meaning to a legal sentence (assuming no static semantic errors).
What sorts of errors can occur in a program?
It can crash, run forever, or give a wrong answer.
What is a ‘type’?
Types are classifications of objects, which is what Python, as an OOP language, deals with. They determine how those objects are dealt with (for example, adding two integers results in an integer, two strings results in a concatenated string, and an integer and a string results in an error).
What is an ‘expression’?
An expression is composed of objects (or operands) and operators, and can be interpreted into a value.
What is a type conversion?
A type conversion turns one type of object into another. For example, applying str to the integer 3 results in the string ‘3’.
What is a keyword?
Keywords are words that have special meanings within a language. Many editors will display them in special colors. These words cannot be used as variables.
What is the difference between a straight line program and a branching program?
A straight line program simply goes through and carries out each step. A branching program will do different things depending on conditions set within the program.
What is a conditional?
A conditional statement starts with an if statement, and can also include elif and else statements.
What does it mean for a program to terminate?
Either the program will return a value, or throw an exception. A program that does not terminate runs indefinitely, typically because it’s gotten stuck in a loop.
What is a for loop?
A for loop takes some sort of iterable object (a list, tuple, or string) and performs its function once for each item in that object. Any function that depends on the input can have a different result at each step, since the input is the current item.
What is decomposition?
Decomposition breaks a problem into self-contained, manageable parts.
What is abstraction?
Decomposition breaks a problem into self-contained, manageable parts.
What is the difference between formal and actual parameters?
Formal parameters are the names of variables used inside a procedure; actual parameters (or arguments) are the values assigned to those names.
What is mutability?
A mutable object’s values can be changed; we must be careful when working with mutable objects not to inadvertently change them.
What is the important difference between a list and a tuple?
Tuples are immutable (as are strings).
What is cloning?
Cloning creates a copy of a mutable object, so that the values can be manipulated without mutating the original object.
What are the important aspects of a dictionary?
A dictionary is mutable, with immutable keys, and unordered.