Chapter 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

T/F: Pseudocode is an informal language that has no syntax rules, and is not meant to be compiled or executed. Instead, programmers use pseudocode to create models, or "mockups" of programs

true

T/F: in a math expression, multiplication and division take place before addition and subtraction

true

T/F: the \t escape character advances the output to the next horizontal tab position

true

a _____ is any hypothetical person using a program and providing input for it.

user

a _______ is a name that references a value in the computer's memory

variable

This is an operator that raises a number to a power

**

This operator performs integer division

//

what would the following display? a=5 b=2 c=3 result = a+b*c print(result)

11

Which of the following will cause an error: x='17' x=17 17=x x=99999

17=x

assume the variables result, w, x, y, and z are all integers, and that w = 5, x = 4, y = 8, and z = 2. What value will be store in result after the following statement executes? result = w // z

2

Assume the variables result, w, x, y, and z are all integers, and that w = 5, x = 4, y = 8, and z = 2. What value will be stored in result after the following statement executes? result = y/x

2.0

what would the following display? num=99 num=5 print(num)

5

T/F: If you print a variable that has not been assigned a value, the number 0 will be displayed

False

T/F: Variable names can have spaces in them.

False

an ______ is a set of well-defined logical steps that must be taken to perform a task

algorithm

An ______ makes a variable reference a value in the computer's memory

assignment statement

write a python statement that divides a by 3.14 and assigns the result to b.

b=a/3.14

if a math expression adds a float to an int, what will the data type of the result be?

float

suppose the following statement is in a program: Price = 99.0. After this statement executes, the price variable will reference a value of this data type:

float

this built-in function can be used to convert an int value to a float

float()

a _______ is a diagram that graphically depicts the steps that take place in a program

flowchart

in the expression 12 + 7, the values to the right and left of the + symbol are called

operands

Assume the following statement has been executed: number = 1234567.456 write a python statement that displays the value referenced by the number variable formatted as 1,234,567.5

print (format(number, ',.1f'))

Assume the variable "sales" references a float value. Write a statement that displays the value rounded to two decimal places.

print (format(sales, '.2f'))

an informal language that has no syntax rules, and is not meant to be compiled or executed

pseudocode

a _______ is a single function that the program must perform in order to satisfy the customer

software requirement

A ____ is a sequence of characters

string

T/F: In python the first character of a variable cannot be a number

true

This symbol marks the beginning of a comment in Python

#

This operator performs division, but instead of retuning the quotient it returns the remainder.

%

T/F: Floating point division returns a floating point number that may include fractions. Integer division returns an integer and ignores any fractional part of the division result.

True

short notes placed in different parts of a program explaining how those parts of the program work are called _________-

comments

A string literal in python must be enclosed in _______.

either single-quotes or double-quotes

T/F: programmers must be careful not to make syntax error when writing pseudocode programs

false

Write a python statement that prompts the user to enter his/her height in feet and assigns the user's input to a variable named height.

height = float(input("Enter height in feet: "))

computer programs typically perform what 3 steps?

input is received some process is performed on the input output is produced

This built-in function can be used to read input that has been typed on the keyboard

input()

what does a professional programmer usually do first to gain an understanding of a problem?

interview the customer

a _____ error does not prevent the program from running, but causes it to produce incorrect results

logic


Set pelajaran terkait

Personal Finance Planning Quiz 3 Chapters 5-6

View Set

Exercise Prescription and Implementation

View Set

Globalization and Covid-19 ECON241

View Set