Computer Science

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

The assignment of roles and responsibilities to different actors in a program is known as what type of design?

responsibility-driven design

What is the term used to describe the processing of a multi-row, multi-column grid of information using a nested loop structure?

row-major transveral

What string method can you use to locate the lowest index in a string named s where substring "findme" is found?

s.find("findme")

What two methods can be used to return a copy of a string named s converted to all lowercase and all uppercase respectively?

s.lower() s.upper()

In Python, what is the term that is used to describe the area of a program text in which an object name refers to a given value?

scope

What EasyFrame method is used to specify if a window is resizable or not?

setEnableResize()

For each call of a function, the Python virtual machine must allocate a small chunk of memory on the call stack, which is known by what term?

stack frame

The gradual process of developing functions to solve each subproblem in a top-down design is known as what process?

stepwise refinement

What attribute can be used to override the default alignment of a window component?

sticky

How is data stored within a computer's memory?

stored as binary data

You are parsing a comma separated value string with Python. What method can you use to separate the values in each line and place them in a list?

string.split(',')

What Turtle method is used to move the Turtle object instance t to the center of the window, pointed east?

t.home()

The decimal number system, which utilizes the numbers 0-9, is also known as what number system?

the base-10 numbering system

After the creation of a thread, what makes a thread "ready"?

the calling of the start method

When instantiating a class and assigning the resulting object to a variable, what is the right side of the assignment called?

the constructor statement

When you launch Python, what file system path does it start with?

the current working directory

What does a mode string of 'r' indicate when opening a file in Python?

the file will be opened for read access

What part of the loop comprises the statements to be executed?

the loop body

In the waterfall development model, what is the most expensive part of software development?

the maintenance phase

When discussing an image, what is an image's aspect ratio?

the ratio of an image's width to its height

What is the name of the standard GUI module for Python?

tkinter

True or False: A while loop can be used for a count-controlled loop.

true

True or False: All data output to or input from a text file must be strings.

true

True or False: Although the while loop can be complicated to write correctly, it is possible to simplify its structure and thus improve its readability.

true

True or False: An algorithm describes a process that ends with a solution to a problem.

true

True or False: Computer scientists refer to the process of planning and organizing a program as software development.

true

True or False: GUI-based programs can be configured to respond to various keyboard events and mouse events.

true

True or False: Generally, an object's state is the set of values of its attributes at any given point in time.

true

True or False: Inheritance allows a class to automatically reuse and extend the code of similar but more general classes.

true

True or False: Operator overloading is an example of an abstraction mechanism.

true

True or False: Python programmers typically capitalize their own class names to distinguish them from variable names.

true

True or False: Recursive functions are frequently used to design algorithms for computing values that have a recursive definition.

true

True or False: Testing is a deliberate process that requires some planning and discipline on the programmer's part.

true

True or False: The addButton method returns an object of type tkinter.Button.

true

True or False: The creation of a customized version of an existing class is called subclassing.

true

True or False: The if-else statement is the most common type of selection statement.

true

True or False: The two digits in the base two number system are 0 and 1.

true

True or False: To get a better understanding of how recursion works, it is helpful to trace its calls.

true

True or False: Using a text editor such as Notepad or TextEdit, you can create, view, and save data in a text file.

true

True or False: When developing a network application, the programmer can first try it out on a local host—that is, on a standalone computer that may or may not be connected to the Internet

true

True or False: When the Python interpreter evaluates a literal, the value it returns is simply that literal.

true

True or False: When using the open function to open a file for input (i.e., using 'r' as the mode string), if the file does not exist, Python raises an error.

true

True or False: You add a new key/value pair to a dictionary by using the subscript operator [].

true

true or false: The RGB system is called a true color system.

true

true or false: Using a text editor such as Notepad or TextEdit, you can create, view, and save data in a text file.

true

true or false: You add a new key/value pair to a dictionary by using the subscript operator [].

true

When creating a list of items whose structure will not change, what should you ideally use to contain the values?

tuples

The drawing of simple, two-dimensional shapes, such as rectangles, triangles, pentagons, and circles, is known as what type of graphics?

vector graphics

A GUI-based program displays a window that contains various components, also known by what specific term?

widgets

In the RGB system, what hexadecimal value represents the color black?

#000000

When passing color values to the tkinter module in hexadecimal, what hex string represents the color red?

#ff0000

What character is used as the format operator when formatting output?

%

When declaring a tuple, you enclose the tuple's elements in what two characters?

( )

If you use the range method with a single parameter of 50, what will be the range of integers included in the returned list?

0 through 49

What RGB value should you use to produce a blue color?

0, 0, 225

What are the two different ways that default arguments can be provided to a function? (Choose two.)

1. By supplying arguments in which they occur in the function header 2. By assigning values to the keys in the function header

What is the value of the binary number 10010110 in base-10?

150

What is the maximum number of distinct color values that can be displayed by the true color RGB system?

16,777,216

Regarding class variables, what statement is accurate?

A class variable is visible to all instances of a class, and does not vary from instance to instance.

What does a block cipher utilize in order to change plaintext characters into two or more encrypted characters?

A mathematical structure known as an invertible matrix.

What statement correctly defines what a median is?

A median is the value that is less than half the numbers in a set and greater than the other half.

What statement accurately describes what a mutator is in the Python language?`

A mutator is a method that is devoted entirely to the modification of the internal state of an object.

What statement accurately describes the use of a parameter in Python?

A parameter is the name used in the function definition for an argument that is passed to the function when it is called.

What statement accurately defines what a pixel is?

A pixel is a colored dot, also known as a picture element, that makes up part of a display.

Which of the following is an example of time slicing?

A running process is automatically moved to the rear of the ready queue after a few milliseconds of run time.

What statement accurately describes what a semantic error is?

A semantic error occurs when an expression is syntactically correct, but the expression cannot be carried out.

In a conditional iteration loop, such as a while loop, what is a sentinel value?

A sentinel value is a special value provided by the user to terminate the loop

What statement accurately describes the role of a socket?

A socket is an object that serves as a communication link between a single server process and a single client process

What statement regarding the structure of strings is accurate?

A string is a sequence of zero or more characters.

When a client connects to a server, what does the socket accept method return?

A tuple containing the client's socket and its address information.

What statement accurately describes the difference between a list and a tuple?

A tuple's contents cannot be changed.

What happens if you attempt to access a string using an index equal to the string's length?

An error will occur, indicating the index is out of range.

At what point in the interpretation of a Python program are syntax error messages generated?

Before execution of the program, when it is passed through the translator.

How does the int function convert a float to an int?

By removing the fractional value of the number.

In a computer, what component is known as the "processor"?

CPU (central processing unit)

You are running a Python script and suspect that the script has entered an infinite loop. What key combination can you use to halt the loop?

CTRL + c

The encryption method that replaces a character in a text with another character some given distance away in the alphabet from the original is known as what type of cipher?

Caesar Cipher

What was the first PC-based operating system called?

Control Program for Microcomputers (CP/M)

How does digital information differ from analog information?

Digital information consists of discrete values, while analog is a continuous range of values.

In the breezypythongui module, what class provides the basic functionality for any window, such as the command buttons in the title bar?

EasyFrame

In evaluating the precedence rules used by Python, what statement is accurate?

Exponentiation has the highest precedence.

True or False: 4 != 4 evaluates to True.

False

True or False: A difference between functions and methods is that methods cannot return values.

Fasle

What is the name used for the integrated program development environment that comes with a Python installation?

IDLE

What statement accurately describes the analysis phase of the waterfall model?

In this phase, the programmers determine what the program will do.

What statement is an accurate description of the concept of inheritance in object-oriented programming?

Inheritance is allowing a class to automatically reuse and extend the code of a similar but more general class.

In general terms, what does a selection statement do?

It allows a computer to make choices based on test conditions

What is the lambda function in Python utilized for?

It allows for the creation of an anonymous function, which contains the names of its arguments and a single expression.

What is the __str__ method used for?

It builds and returns a string representation of an object's state.

What effect does using the model/view pattern of design have?

It divides the roles and responsibilities of the system between data management and user interface display.

What is a count controlled loop?

It is a loop that counts through a range of numbers to control when the loop ends

What is a count-controlled loop?

It is a loop that counts through a range of numbers to control when the loop ends.

What is a one-way selection statement in the context of Python?

It is a single if statement without a corresponding else statement used to test a condition and run statements, then proceed to the next statement.

What is the "self" parameter utilized for in a class definition block?

It is used within the class and method definitions to call other methods on the same object, or to access that object's variables or data.

In Python, functions are treated as first-class data objects. What does this mean?

It means that functions can be assigned to variables, passed as arguments to other functions, returned as values, and stored in data structures.

What special character does the '\b' escape sequence generate?

It produces a backspace special character, which performs the same function as the backspace key.

What does the os module function remove do when called?

It removes a given file that is passed to it.

In Python, what does the "%" operator do in the expression 6 % 4?

It returns a remainder or modulus.

What is the purpose of a higher-order function?

It separates the task of transforming data values from the logic of accumulating the results.

What language was designed based on a theory of recursive functions and is considered to be an ideal language for solving difficult or complex problems?

LISP

The Turtle graphics toolkit was originally developed as part of what programming language for children?

Logo

What type of programming is defined by the term "imperative programming"?

Programming that involves the use of input and output statements, assignment statements, and control statements for selection and iteration.

What type of programming is defined by the term "functional programming"?

Programming using a set of cooperating functions rather than relying on assignment.

What type of programming is defined by the term "procedural programming"?

Programming utilizing cooperative subprograms to solve problems.

What happens when a function tries to assign or change a value of a variable that has been defined at the module level?

Python creates a temporary variable with the same name, and the value of that variable exists only within the scope of the function.

What function call will generate a random number in the range of 1 through 6 using the random module?

Random.randint(1, 6)

What is the call stack used for in the Python virtual machine?

The call stack is an area of reserved memory used to store chunks of memory related to functions.

What statement regarding precedence of operators is accurate?

The comparison operators (==, !=, <, >, <=, >=) are higher in precedence than the assignment operator (=).

Why is the conversion of an image to grayscale by simply computing the average of a pixel less than ideal?

The conversion does not take luminance into account.

In order to create a docstring for a defined function, where should the docstring be?

The docstring should be the next indented line after the def statement.

You are running a Python script that is supposed to write data to an open file, but discover that the file contents are not updating even after the script finishes. What is most likely the issue?

The file was not closed using the close() method.

What is the return value for a function that has no return statement defined?

The function will return a special value of None.

What does the term "sampling" imply in relation to images?

The mapping of analog information in a visual format to discrete values.

What happens when you make a new class a subclass of another class?

The new class inherits the attributes and behaviors defined in the parent class.

What effect does the following print statement have? print("Hello" * 5)

The print statement will produce "HelloHelloHelloHelloHello".

What statement accurately reflects the difference between the quotient operator and the division operator?

The quotient operator produces an integer, while the division operator produces a float.

What makes up a Python program's namespace?

The set of all its variables and their values.

When using the range function, what effect does the specification of a third argument have?

The third argument specifies a step value to be used in the range

In a GUI-based program, what are labels supposed to do?

They are text elements that describe inputs and outputs.

True or False: A function can be defined in a Python shell, but it is more convenient to define it in an IDLE window, where it can be saved to a file.

True

True or False: A method is always called with a given data value called an object, which is placed before the method name in the call.

True

True or False: A programmer typically starts by writing high-level language statements in a text editor.

True

True or False: The RGB system is called a true color system

True

True or False: The part of a computer that is responsible for processing data is the central processing unit (CPU).

True

What can be used to describe and document the analysis and design of complex software systems?

Unified Modeling Language

In the images module, how does the Image class represent an image?

Using a two-dimensional grid of RGB values.

What is the dominant term when evaluating the amount of work in an algorithm?

When expressed as a polynomial, the dominant term of an algorithm is the area where the most work is performed.

In Python, when does an object reach the end of its life?

When it can no longer be referred to by the program that created it.

As a rule of thumb, when should you include an __eq__ method in a class?

Whenever a comparison for equality uses criterion other than object identity.

How could you overload the addition operator in the Python language?

You declare a new method with the same name, __add__, and define the method.

How can you associate a keyboard event and an event-handling method with a widget?

You must use the bind method, which expects a string containing a key event.

What scenario would it make logical sense to use a multi-way selection statement for?

You need to convert numeric grades to letter grades.

What scenario would be ideal for the use of a check button?

You require a GUI element that can be grouped with other elements that can be selected at the same time.

What scenario would be ideal for the use of a prompter box?

You require a GUI element to prompt for a user's text input.

If you wanted to overload the greater than or equal operator, what method name should you define?

__ge__

Functions that are always available in Python come from what module?

_builtin_

What method is known as a class's constructor, because it is run automatically when a user instantiates the class?

_init_

When using the EasyFrame class to create a window, what method specifically is used to set up any window components to display in the window?

_init_

What statement regarding the use of lists is accurate?

a list can be sliced into sublists

It is a rough draft of a program

a rough draft of the program

A flash memory stick is an example of what type of storage media?

a semiconductor storage media

When using the counting instructions method of measuring efficiency, what are the two classes of instructions you must distinguish between? (Choose two.)

a. Instructions that perform assignment operations that can be combined. b. Instructions that execute the same number of times regardless of the problem size.

What two items are included in the class header of a class defined in Python? (Choose two.)

a. The list of one or more parent classes. b. The class name, conventionally capitalized.

What two items must be given to the socket function in order to create a socket object?

a. The socket family that will be used. b. The IP address to be used.

What two Turtle methods affect the color of a Turtle drawing? (Choose two.)

a. pencolor() b. fillcolor()

What are two common methods by which functions serve as abstraction mechanisms? (Choose two.)

a. the hiding of complicated processes b. the elimination of redundant, or repetitious codes

What term describes the process of substituting a simple process for a complex process in a program to make the program easier to understand and maintain?

abstraction

What type of method returns the values of an object's attributes without altering its state?

accessor methods

What two terms are used for the methods that are used to observe or modify the state of an object, respectively?

accessors and mutators

What happens if you attempt to pop a key from a dictionary and the key does not exist, and you specified no default return?

an error will be raised

What kind of programming language is Python?

an interpreted language

What are the two functions available in the tkinter.filedialog module used to support file access in a GUI program?

asksaveasfilename askopenfilename

In a recursive function, what is used to determine whether to stop or to continue with another recursive step?

base case

What list method should you use in order to remove and return the element at the end of the list named "books"?

books.pop()

What coordinate system is utilized for the Turtle graphics toolkit?

cartesian system

When a sender of information encrypts that information, what is the resulting text known as?

cipher text

What two keyword arguments can be used to force a horizontal and/or vertical spanning of grid positions? (Choose two.)

columnspan rowspan

What type of processing occurs when processes run for a slice of time, then yield access to the CPU to another process, cycling through processes repeatedly?

concurrent processing

What concept within object-oriented programming involves the restriction of the manipulation of an object's state by external users to a set of method calls?

data encapsulation

What are the two different types of loops that are used within the Python language?

definite iteration and indefinite iteration

What function can you call inside of IDLE to show the resources of the math module, once it has been imported?

dir(math)

The while loop is also known as what kind of a loop?

entry-control loop

The string is a mutable data structure.

false

True of False: A list is a sequence of data values called indexes.

false

True of False: Inheritance allows several different classes to use the same general method names.

false

True or False: A fractal curve is one-dimensional.

false

True or False: A module behaves like a function, but has a slightly different syntax.

false

True or False: In Python, = means equals, whereas == means assignment.

false

True or False: In Python, \b is a escape sequence that represents a horizontal tab.

false

True or False: In a GUI-based program, the user can usually alter the size of a window by holding the mouse on its lower-left corner and dragging in any direction.

false

True or False: Loop statements allow a computer to make choices.

false

True or False: Most object-oriented languages require the programmer to master the following techniques: data encapsulation, inheritance, and abstraction.

false

True or False: Python is a loosely typed programming language.

false

True or False: The + operator allows you to build a string by repeating another string a given number of times.

false

True or False: The Boolean data type is named for the twentieth-century British mathematician George Boole.

false

True or False: The attributes of an object are represented as instance datum.

false

True or False: The attributes of each window component are actually stored in a list.

false

True or False: The design phase of the waterfall model is also called the coding phase.

false

True or False: The not operator has a lower precedence than the and and or operators.

false

True or False: The scope of an instance variable is the entire module.

false

True or False: The simplest form of selection is the if-else statement.

false

True or False: The statements within a while loop can execute one or more times.

false

True or False: The while loop is also called a sentinel-control loop, because its condition is tested at the top of the loop.

false

True or False: Unlike other object-oriented languages, Python does not support polymorphic methods.

false

True or False: When using the open function to open a file for output (i.e., using 'w' as the mode string), if the file does not exist, Python raises an error.

false

True or False:GUI-based programs use windows that contain various components, also called window objects or gadgets.

false

True or False: Informally, a computing agent is like a recipe.

false (algorithm)

True or False: Information is stored as patterns of bytes (1s and 0s).

false (binary digits)

Your script is parsing filenames and is creating a count of how many files per file extension type exist within a directory. What slice could you use to extract the file extension substring, assuming the extensions are three letters only?

filename[-3:]

What argument can be specified to the two file dialog functions in order to specify the available file types that can be used?

filetypes

In Python, what data type is used to represent real numbers between -10^308 and 10^308 with 16 digits of precision?

float

What is the process in which the Python virtual machine recycles its storage known as?

garbage collection

What os module function should you use to get the path of the current working directory?

getcwd()

A black-and-white photograph contains more than just the black and white colors, but various shades of gray known by what term?

grayscale

Assuming you have an images module object named i, what method can you use to change the pixel at coordinate 238, 590 to red?

i.setPixel(238, 590, (255, 0, 0))

What built-in function should you use in Python to prompt a user for data input?

input

The attributes of an object are represented as what type of variables?

instance variables

What thread method can be used to test if the thread is dead or not?

isAlive()

A list is a sequence of data values known by either of what two terms? (Choose two.)

items and elements

What term describes a dictionary of functions keyed by command names?

jump table

In a Python dictionary, an association is formed between what two components of the dictionary? (Choose two.)

keys and values

What type of image compression analyzes larger regions of pixels and saves a color value that the pixels' colors approximate?

lossy compression

What os.path module function can you use to convert a path to a pathname appropriate for the current file system?

normcase(path)

What happens if you use the following statement to sort a list of numbers called numbers? numbers = numbers.sort()

numbers is a value of None

The process of hiding a complex process by developing a mechanism to simplify or hide that process is known by what term?

obfuscation

At the top, or root of the class hierarchy is the most abstract class. What is the name of this class?

object

The discipline of building hardware architectures, operating systems, and specialized algorithms for running a program on a cluster of processors is known by what term?

parallel computing

What dictionary method can be utilized to access the entries in a dictionary variable with a name of parts?

parts.lists()

Which of the following assigns a dictionary list of keys and values to the variable named persons?

persons = {"Sam":"CEO", "Julie":"President"}

What function do you use to save an object utilizing the pickle module?

pickle.dump

What statement is an accurate description of the concept of polymorphism in object-oriented programming?

polymorphism is allowing the several different classes to use the same general method names

What print statement will output a single '\' character?

print('\\')

What does the analysis phase of the waterfall effect do?

programmers determine what the program will do

When using IDLE for Python programming, what color is used to distinguish built-in function names?

purple

What are the two access modes that are used when opening a file for input and output when pickling? (Choose two.)

rb wb

What file access method can be used to read a single line of input and return the line as a string, including the newline character?

readline

The Fibonacci sequence is a series of values that can be easily calculated with what kind of function?

recursive function

What higher-order function takes a list of values and repeatedly applies a function to accumulate a single data value?

reducing


Ensembles d'études connexes

Chapter 11: Lesson 3 (The Crusades)

View Set

Chemistry 101 Introductory Chemistry Chapter 7 Chemical Reactions

View Set

Data Structures Final 🧢‍⃠

View Set

Module 21 NCLEX style questions Pressure Ulcers

View Set

Human Physiology: Chapter 9 (Autonomic Nervous System)

View Set