Docsity

STARTING OUT WITH PYTHON 6 GUIDE PROGRAMMING FUNDAMENTALS PROBLEM SOLVING PREMIUM REVIEW W, Exams of Information and Communications Technology (ICT)

Toggle sidebar
bg1
STARTING OUT WITH PYTHON 6 GUIDE PROGRAMMING
FUNDAMENTALS PROBLEM SOLVING PREMIUM REVIEW WITH
SOLVED QUESTIONS AND ANSWERS
Question 1.
Logic Error.
Answer: An error in a program that makes it do something other than what the
programmer intended. It does not prevent the program from running, but
causes it to produce incorrect results. Mathematical mistakes are common
causes of logic errors.
Question 2.
debugging.
Answer: Finding and fixing problems in your algorithm or program.
Question 3.
algorithm.
Answer: a set of well-defined logical steps that must be taken to perform a task.
Question 4.
pseudocode.
Answer: Shorthand notation for programming which uses a combination of
informal programming structures and verbal descriptions of code.
Question 5.
Flowcharts.
Answer: A graphical representation of the steps in a process; details all of the
elements in a process and the sequence in which these elements occur. This a
tool that programmers use to design programs
Question 6.
terminal symbols.
Answer: The ovals that appear at the top and bottom of the flowchart. The start
terminal marks the starting point, and the End terminal marks the program's
ending point.
Question 7.
input symbol.
Answer: indicates an input operation and is represented by a parallelogram in
flowcharts
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download STARTING OUT WITH PYTHON 6 GUIDE PROGRAMMING FUNDAMENTALS PROBLEM SOLVING PREMIUM REVIEW W and more Exams Information and Communications Technology (ICT) in PDF only on Docsity!

STARTING OUT WITH PYTHON 6 GUIDE PROGRAMMING

FUNDAMENTALS PROBLEM SOLVING PREMIUM REVIEW WITH

SOLVED QUESTIONS AND ANSWERS

Question 1.

Logic Error.

Answer: An error in a program that makes it do something other than what the programmer intended. It does not prevent the program from running, but causes it to produce incorrect results. Mathematical mistakes are common causes of logic errors.

Question 2.

debugging.

Answer: Finding and fixing problems in your algorithm or program.

Question 3.

algorithm.

Answer: a set of well-defined logical steps that must be taken to perform a task.

Question 4.

pseudocode.

Answer: Shorthand notation for programming which uses a combination of informal programming structures and verbal descriptions of code.

Question 5.

Flowcharts.

Answer: A graphical representation of the steps in a process; details all of the elements in a process and the sequence in which these elements occur. This a tool that programmers use to design programs

Question 6.

terminal symbols.

Answer: The ovals that appear at the top and bottom of the flowchart. The start terminal marks the starting point, and the End terminal marks the program's ending point.

Question 7.

input symbol.

Answer: indicates an input operation and is represented by a parallelogram in flowcharts

Question 8.

output symbol.

Answer: indicates an output operation and is represented by a parallelogram in flowcharts

Question 9.

Processing Symbols:.

Answer: represent steps in which the program performs some process on data, such as a mathematical calculation. (rectangle in a flow chart)

Question 10.

programmer's customer.

Answer: Any person, group, or organization that is asking you to write a program.

Question 11.

software requirement.

Answer: is simply a single task that the program must perform in order to satisfy the customer

Question 12.

algorithm.

Answer: A set of well-defined logical steps that must be taken to perform a task.

Question 13.

pseudocode.

Answer: a cross between human language and a programming language. Although the computer can't understand it; programmers often find it helpful to plan an algorithm in a language that's almost a programming language but still very readable by humans.

Question 14.

Flowchart.

Answer: a diagram that graphically depicts the steps that take place in a program

Question 15.

Input.

Answer: short notes placed in different parts of a program, explaining how those parts of the program work. They are intended for any person reading a program's code, not the computer.

Question 25.

character.

Answer: In Python you begin a comment with this character. When the interpreter sees it, it ignores everything from that character to the end of the line.

Question 26.

end-line comment.

Answer: a comment that appears at the end of a line of code

Question 27.

A variable.

Answer: is a name that represents a value stored in the computer's memory. Programs use this to access and manipulate data that is stored in memory.

Question 28.

references the value.

Answer: When a variable represents a value in the computer's memory, we say that the variable _________.

Question 29.

assignment statement.

Answer: You use an ______________________ __________________ to create a variable and make it reference a piece of data.

Question 30.

variable = expression.

Answer: assignment statement is written in this general format

Question 31.

assignment operator.

Answer: The = sign is know as the ______________ _______________

Question 32.

quotation marks.

Answer: When you pass a variable as a argument to the print function, you do NOT enclose the variable name in ___________ _____________.

Question 33.

In an assignment statement, the variable that is receiving the assignment must appear on the.

Answer: left side of the = operator

Question 34.

You cannot use a variable until you have.

Answer: assigned a value to it.

Question 35.

Variable Naming Rules.

Answer: 1. You cannot use one of Python's key words. 2. It cannot contain spaces. 3. The first character must be one of the letters a through z, A through Z, or an underscore character ( _ ) 4. After the first character you may use the letters a through z or A through Z, the digits 0 through 9, or underscores. 5. Uppercase and lowercase characters are distinct; they matter.

Question 36.

garbage collection.

Answer: Releases memory that was used for a variable's value once the variable is no longer to be used by a program.

Question 37.

variable reassignment.

Answer: to change the value of a variable based on its current value

Question 38.

data types.

Answer: Python uses _________ to categorize values in memory.

Question 39.

int.

Answer: In Python, when an integer is stored in memory, it is classified as this

Question 40.

float.

Answer: The purpose of testing a program with different combinations of data is to expose run-time and ____ errors.

Question 49.

String constant.

Answer: a specific group of characters enclosed within quotation marks

Question 50.

empty string.

Answer: A string value that has no characters, represented in code as "".

Question 51.

variable.

Answer: A location in memory used for storing data and given a name in a computer program is called a _________ because the data in the location can be changed.

Question 52.

foreground = "red".

Answer: Associate the variable foreground with the value "red".

Question 53.

method invocation.

Answer: the line of code that causes a method to be executed

Question 54.

price%100.

Answer: Assume that price is an integer variable whose value is the price (in US currency) in cents of an item. Assuming the item is paid for with a minimum amount of change and just single dollars, write an expression for the amount of change (in cents) that would have to be paid.

Question 55.

x%10.

Answer: Assume that a variable x has been assigned a integer value,. Write an expression whose value is the last (rightmost) digit of x.

Question 56.

n.

Answer: The character escape sequence to force the cursor to go to the next line is

Question 57.

values.

Answer: Variables are called "variable" because they can reference different values while a program is running - when you assign a value; it will reference that value until you assign it a different value.

Question 58.

whole number.

Answer: A numeric literal that is written as a _____________ ______________ with no decimal point is considered an int

Question 59.

decimal point.

Answer: A numeric literal that is written as a ______________ _____________ is considered a float

Question 60.

input function.

Answer: reads a piece of data that has been entered at the keyboard and returns that piece of data, as a string, back to the program - you normally us this function in an assignment statement

Question 61.

prompt.

Answer: In the general format, _____________ is a string that is displayed on the screen.

Question 62.

exception.

Answer: an unexpected error that occurs while a program is running, causing the program to halt if the error is not properly dealth with.

Question 63.

math operators.

Answer: a programmer's tools for performing calculations

Answer: An expression that contains operands of different data types; also called mixed mode expression

Question 73.

line continuation character.

Answer: Python allows you to break a statement into multiple lines by using this; which is a backslash ( \ ) You simply type the backslash character (no parentheses) where you want to break the statement, then press the Enter key.

Question 74.

parentheses.

Answer: Python also allows you to break any part of a statement that is enclosed in ________________ without using the line continuation character.

Question 75.

newline character.

Answer: You can think of this as a special command that causes the computer to start a new line of output (you do not see it , but when it is displayed, it causes the output to advance to the next line)

Question 76.

end=' '.

Answer: A keyword parameter for the print() function that causes the function to NOT add a newline at the end of the string. (there is a space between the quotes)

Question 77.

end=''.

Answer: A keyword parameter for the print() function that causes the function to NOT add a newline at the end of the string and NOT add a space (there is not space between the quotes.

Question 78.

sep=''.

Answer: When multiple arguments are passed to the print function, they are automatically separated by a space when they are displayed on the screen, if you do NOT want a space printed between the items; you can pass this argument to the print function ie: OneTwoThree

Question 79.

sep='*'.

Answer: You can also tell this special argument to specify a character other than a space to separate multiple items ie: OneTwoThree (you can use any character)**

Question 80.

escape character.

Answer: is a special character that is preceded with a backslash ( \ ), appearing inside a string literal, for example: \n

Question 81.

\n.

Answer: newline escape character in Python

Question 82.

\t.

Answer: This escape character advances the output to the next horizontal tab position (A tab position normally appears after every eighth character)

Question 83.

'.

Answer: Causes a single quotation mark to be printed in Python ie: print('I'm ready to begin') -instead of print("I'm ready to begin") both work in Python

Question 84.

''.

Answer: Causes a double quotation mark to be printed in Python ie: print("Your assignment is to read "Hamlet" by tomorrow.") -instead of print('Your assignment is to read"Hamlet" by tomorrow.') both work in Python

Question 85.

\.

Answer: Causes a backslash character to be printed; in Python ie: print('The path is C:\temp\data.') required when you want to print a backslash; a single one will not work in Python.

Question 86.

string concatenation.

Question 93.

Named Constant.

Answer: is a name that represents a value that cannot be changed during the program's execution.

Question 94.

use d as the type designator.

Answer: How do you use the format function to format integers? They are written in all upper case. Used with magic numbers.

Question 95.

magic number.

Answer: is an unexplained value that appears in the program's code ie: amount = balance * 0.