CS 1400 Chapter 5-7 review

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

The variable data refers to the list [10, 20, 30]. The expression data.index(20) evaluates to 2 0 1 True

1

The variable data refers to the list [10, 20, 30]. The expression data[1] evaluates to 10 30 20 0

20

In the RGB system, where each color contains three components with 256 possible values each, the number of bits needed to represent each color is 256 8 12 24

24

The variable info refers to the dictionary {"name":"Sandy", "age":17}.The expression info.get("hobbies", None) evaluates to 1000 None knitting hobbies

None

The variable data refers to the list [10, 20, 30]. After the statement data[1] = 5, data evaluates to [10, 5, 30] [5, 10, 20] [10, 5, 20] [5, 20, 30]

[10, 5, 30]

The variable data refers to the list [10, 20, 30]. The expression data[1:3] evaluates to [20, 30] [20] [10, 20, 30] [10, 30]

[20, 30]

The expression list(map(math.sqrt, [9, 25, 36])) evaluates to (3, 5, 6) 70 [81, 625, 1296] [3.0, 5.0, 6.0]

[3.0, 5.0, 6.0]

The expression list(filter(lambda x: x > 50, [34, 65, 10, 100])) evaluates to [] (34, 10) [65, 100] [34, 10]

[65, 100]

The clone method: copies an existing object modifies an existing object returns a string representation of an object creates a new object

copies an existing object

Instantiation is a process that builds a string representation of an object creates a new object of a given class describes a function call compares two objects for equality

creates a new object of a given class

The interface of a class is the set of all its functions attributes methods objects

methods

The variable info refers to the dictionary {"name":"Sandy", "age":17}.The method to remove an entry from a dictionary is named pop delete none remove

pop

The print function: prints a string representation of an object copies an existing object creates a new object modifies an existing object

prints a string representation of an object

The lifetime of a parameter is the duration of its function's execution the duration of program execution the duration of its keyword's execution the duration of its argument's execution

the duration of its function's execution

The scope of a temporary variable is -the statements in the body of the function after the statement where the variable is introduced -the set of the variables values -the statements in the body of the function where the variable is introduced -the entire module in which the variable is introduced

the statements in the body of the function after the statement where the variable is introduced

The origin (0, 0) in a screen coordinate system is at the lower-left corner of a window the upper-left corner of a window the lower-right corner of a window the center of a window

the upper-left corner of a window

The state of an object consists of its physical structure the values of all of its attributes its initial position its class of origin

the values of all of its attributes

A row-major traversal of a two-dimensional grid visits all of the positions in a row before moving to the first column column before moving to the next column column before moving to the first row row before moving to the next row

row before moving to the next row

The process whereby analog information is converted to digital information is called sampling filtering compressing recording

sampling

When a recursive function is called, the values of its arguments and its return address are placed in a -stack frame -set -dictionary -list

stack frame

Top-down design is a strategy that: -uses a diagram that shows the relationships among a program's function and the passage of data between them -develops lower-level functions before the functions that depend on those lower-level functions -uses an algorithm for solving a class of problems -starts with the main function and develops the functions on each successive level beneath the main function

starts with the main function and develops the functions on each successive level beneath the main function

Which of the following are immutable data structures? dictionaries and lists strings and tuples functions and methods ciphers and blocks

strings and tuples

The relationships among functions in a top-down design are shown in a(n) structure chart syntax diagram flow diagram abstraction chart

structure chart

The variable info refers to the dictionary {"name":"Sandy", "age":17}.The expression list(info.keys()) evaluates to ["Sandy", "17"] ("Sandy", "17") ["name", "age"] ("name", "age")

["name", "age"]

A data structure used to implement a jump table is a dictionary tuple method list

dictionary

A recursive function has a changing algorithm each time it is called usually runs more slowly than the equivalent loop usually runs faster than the equivalent loop calls another function multiple times

usually runs more slowly than the equivalent loop

In a system of 256 unique colors, the number of bits needed to represent each color is 4 8 32 16

8

The expression reduce(max, [34, 21, 99, 67, 10]) evaluates to 99 231 0 10

99

The variable data refers to the list [10, 20, 30]. The expression data + [40, 50] evaluates to [10, 40, 50] [40, 50] [10, 60, 80] [10, 20, 30, 40, 50]

[10, 20, 30, 40, 50]

The variable data refers to the list [10, 20, 30]. After the statement data.insert(1, 15), the original data evaluates to [15, 10, 20, 30] [10, 15, 30] [10, 20, 30, 15] [10, 15, 20, 30]

[10, 15, 20, 30]


Ensembles d'études connexes

Radiation Health and Safety Exam Practice Questions 2

View Set

Cisco Devnet Assoc -- Infrastructure and automation

View Set

Биология животных

View Set

Biology Unit 2: The Chemistry Of Life

View Set

Test 1 Cognition and Learning QUIZZES

View Set

Social Studies: Social Studies Skills

View Set

Ch 6 The American Revolution Lesson 3 Battlegrounds Shift

View Set

Digital Literacy Unit 1: Lesson 2: True or False

View Set