Python Programming Ch. 1 - 7 MC

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

In modern Python, an int value that grows larger than the underlying hardware int

Uses memory

If a function returns a value, it should generally be called from

main

What expression would create a line from (2,3) to (4,5)?

(d) Line(Point(2,3), Point(4,5))

A function with no return statement returns

(d) None

What graphics class would be best for drawing a square?

(d) Rectangle

The template for <variable> in range(<expr>) describes

(d) a counted loop

Which of the following is not a Python type-conversion function?

(d) abs

Which of the following computes the horizontal distance between points p1 and p2?

(d) abs(p1.getX() - p2.getX())

A method that returns the value of an object's instance variable is called a(n)

(d) accessor

In order to use functions in the math library, a program must include

(d) an import statement

Accessing a single character out of a string is called:

(d) indexing (although slicing is often used as well)

In Python getting user input is done with a special expression called

(d) input

In a mixed-type expression involving ints and floats, Python will convert

(d) ints to floats

A problem is intractable when

(d) it is not practical to solve

The items listed in the parentheses of a function definition are called

(d) parameters

An algorithm is like a

(d) recipe

What comand would be used to draw the graphics object shape into the graphics window win?

(d) shape.draw(win)

The process of describing exactly what a computer program will do to solve a problem is called

(d) specification

Which of the following is not a built-in operation?

(d) sqrt()

Which of the following is not a reason to use functions?

(d) to demonstrate intellectual superiority

Which string method converts all the characters of a string to upper case?

(d) upper

The string "slots that are filled in by the format method are marked by:

(d) {}

The best structure for implementing a multi-way decision in Python is

(c) if-elif-else

A multiple choice question is most similar to

(c) multi-way decisions

Placing a decision inside of another decision is an example of

(c) nesting

What of the following is not a Python data type?

(c) rational

Which of the following is not a file-reading method in Python?

(c) readall

Which of the following is the same as s[0:-1]?

(c) s[:len(s)-1]

Which of the following can not be used to convert a string of digits into a number?

(c) str

A structure in which one decision leads to another set of decisions, which leads to another set of decisions, etc., is called a decision

(c) tree

What command would set the coordinates of win to go from (0,0) in the lower-left corner to (10,10) in the upper-right?

(c) win.setcoords(0, 0, 10, 10)

Which of the following is not a step in the function-calling process?

(d) Control returns to the point just before the function was called.

A statement that controls the execution of other statements is called a

(c) control structure

A successor to ASCII that includes characters from (nearly) all written languages is

(c) Unicode

When a program is being run directly (not imported), the value of __name__ is

(c) __main__

One difference between a compiler and an interpreter is

(c) a compiler is no longer needed after a program is translated

The term for a program that does its I/O with files is

(c) batch

Which of the following is not a legal identifier?

(a) 2spam

What is the correct forumla for converting Celsius to Fahrenheit?

(a) F = 9/5(C) + 32

A user interface organized around visual elements and user actions is called a(n)

(a) GUI

Which of the following is not an example of secondary memory?

(a) RAM

Which of the following is not true of comments?

(a) They make a program more efficient

Taking the square root of a negative value with math.sqrt produces a(n)

(a) ValueError

The pattern used to computer factorial is

(a) accumulator

In Python, actual parameters are passed to functions

(a) by value

A Python function definition begins with

(a) def

Computer languages designed to be used and understood by humans are

(a) high-level languages

In Python, the body of a decision is indicated by

(a) indentation

A function can modify the value of an actual parameter only if it's

(a) mutable

Before reading or writing to a file, a file object must be created via

(a) open

What function gives the Unicode value of a character?

(a) ord

A function can send output back to the program with a(n)

(a) return

Which of the following is the most accurate model of assignment in Python?

(a) sticky note (although you'll often see analysis of programs using the variable-as-box diagram)

The value of 4! is

(b) 24

An expression that evaluates to either true or false is called

(b) Boolean

What kind of object can be used to get text input in a graphics window?

(b) Entry

Which of the following is not part of the IPO pattern?

(b) Program

The literals for type bool are

(b) True, False

What is the fundamental question of computer science?

(b) What can be computed

A statement is

(b) a complete computer command

The part of a program that uses a function is called the

(b) caller

What color is `color_rgb(0,255,255)?

(b) cyan

Fragments of code that produce or calculate new data values are called

(b) expressions

The most appropriate data type for storing the value of pi is

(b) float

By convention, the statements of a program are often placed in a function called

(b) main

A method that changes the state of an object is called a(n)

(b) mutator

Formal and actual parameters are matched up by

(b) position

Which of the following are not used in expressions?

(b) statements

The number of distinct values that can be represented using 5 bits is

(c) 32

What of the following is not a step in the software development process?

(c) Fee setting


Ensembles d'études connexes

Week 14 - PrepU Transplant & Burn Questions

View Set

Fundamentals Success: Communication, Psychological Support, Nutrition

View Set

Nutrition Chapter 1: What is Nutrition?

View Set