quiz-4

Ace your homework & exams now with Quizwiz!

Which mode specifier will open the file but will not let you change the file or write to it?

'r'

what statement do you have to have in a value-returning function?

return expression,where expression holds the value that is to be returned to the calling function. This can be any value, variable or expression that has a value.

Which method could be used to strip specific characters from the end of the string?

rstrip

which method could be used to strips specific characters from the end of the string?

rstrip

a ____ is a span of characters that are taken from within a string

slice

When will the following loop terminate? while keep_on_going != 999:

When keep_on_going refers to a value equal to 999

the GUI environment, most interactions are done through small windows known as ____ that display information and allow the user to perform actions.

dialog boxes

what type of file access jumps directly to any piece of data in the file without reading the data that came before it?

direct

In a print statement, you can set the _____ argument to a space or empty string to stop the output from advancing to a new line.

end

a callback function is

event handler because it handles the event that occurs when the user clicks the button.

Assume list1 references a list. After the following statement executes, list1 and list2 will reference two identical but seperate lists in memory:list 2 = list1

false

Indexing starts at 1, so the index of the first element is 1, the index of the second element is 2, and so forth.

false

the data that you retrieve from an entry widget is always of the int data type.

false

when a file that already exists is opened in append mode, the files exisitng content are erased

false

This string method returns the lowest index in the string where a specified substring is found.

find

this widget is a container that can hold other widgets.

frame

each object that is created from a class is called _____ of the class

instance

what is the relationship called in which one object is a specialized version of another object?

is a

which of the following string methods can be used to determine if a string contains only \n characters?

isspace()

what does a subclass inherit from its superclass?

its data members and its methods

Suppose a program uses two classes: Airplane and JumboJet. Which of these would most likely be the subclass?

jumbojet

this widget is an area that displays one line of text

label

the built-in function _____ returns the length of a sequence.

len

A _____ variable is created inside a function.

local

What type of error produces incorrect results but does not prevent the program from running?

logic

In a value-returning function, the value of the expression that follows the key word ______ will be sent back to the part of the program that called the function.

return

this statement causes a function to end and sends a value back to the part of the program that called the function.

return

how can you use a stringvar object to update the contents of a label widget?

Create a label and associate it with the StringVar object. Any value stored in the StringVar object will automatically be displayed in the label.

in an inheritance relationship, a television is a _____ of the electronics class.

subclass

in an inheritance relationship, the ____ is the specialized class.

subclass

the contents of this type of file can be viewed in an editor such as Notepad.

text file

This string method returns true if a sting contains only numeric digits and is as least one character in length.

the isdigit method

you can use this module in python to create GUI programs.

tkinter

Which list will be referenced by the variable number after the execution of the following code?number = range(0, 9, 2)

[0, 2, 4, 6, 8]

What would be the value of the variable list2 after the execution of the following code? (Ignore impropper indentation)

[1, 2, 3]

What will the following code output? values = [2,4,6,8,10] print(values[1,3])

[4,6]

what is boolean function

a function which returns either True or False.You can use a Boolean function to test a condition, and then return either True or False to indicate whether the condition exists. Boolean functions are useful for simplifying complex conditions that are tested in decision and repetition structures.

What type of loop structure repeats the code a specific number of times?

Count-controlled loop

An _______ method gets the value of a data attribute but does not change it

accessor

This is a section of code that gracefully responds to exceptions.

exception handler

What is a group of statements that exists within a program for the purpose of performing a specific task?

function

the following statement calls an objects method: wallet.get_dollar(). what is the name of the method? what is the name of the variable that references the object?

get_dollar = represents name of method contained in object "wallet"wallet = name of variable that references object

from the following line of code, determine what is the name of the base class. class male(human):

human

why should a program close a file when it a finished using it?

To ensure data stored in the file-bound buffer gets saved properly. To free up system resources by not having a bunch of open files.

what does the acronyms UML stand for?

Unified Modeling Language.

mystr = 'abc' *3 print(mystr)

abcabcabc

this term describes any mechanism that accepts input, performs some operation that cannot be seen on the input, and produces output.

black box

What type of function can be used to determine whether a number is even or odd?

boolean

a ____ is a widget that the user can click to cause an action to occur

button

which widget will create a rectangular area that can be used to display graphics?

canvas

What is the syntax for defining a class Python, that inherits from class LCCcourses?

class Python(LCCcourses)

Which of the following is the correct syntax in python for defining a class dining which inherits from class furniture?

class dining(furniture)

What would you use if an element is to be removed from a specific index?

del statement

it is not possible to indicate inheritance in a UML diagram

false

A class might be thought of as a "blueprint" that an object may be created from.

true

A subclass can have a method with the same name as a method in the superclass.

true

If x is 5, y is 3, and z is 8, what is the result of the following Boolean expression?

true

In python, there can be a list of variables on the left side of the assignment operator. true/false

true

The repetition operator * works with strings as well as with lists.

true

a root widgets destroy method can be used as a callback function for a quit button

true

closing a fie disconnects the communication between the file and the program.

true

a _____ includes one or more statements that can potentially raise an exception.

try block

Examine the following piece of code: class potato(vegetable): In a UML diagram, what would the open arrowhead (depicting inheritance) point to?

vegetable

Which mode specifier will open a file but will not let you change the file or write to it?

'r'

The following is an example of an instruction written in which computer language?

Machine Language

the approach of _____ makes the program easier to understand, test, and maintain.

Modularization

By doing this you can hide a class's attribute from code outside the class.

begin the attribute's name with two underscores

which method can you use to determine whether an object is an instance of a class?

isinstance

Which of the following string methods can be used to determine if a string contains only n characters?

isspace()

what is the first negative index in a string?

-1

before a file can be used by a program, it must be _____

...

What is not an example of an augmented assignment operator?

<=

you do not have to have an statement in a program to use the function in the random module true/false

false

How many graphical widgets does the tkinter module provide?

fifteen

what type of programs are event-driven?

GUI programs

What method or operator can be used to concatenate lists?

+

given the following code, what will be printed?def magic(num):return num +2*10print(magic(5))

25

the p in the acronym IPO refers to _______

Processing, process

Which widget will create an area that displays one line of text or an image?

Label

in ____ programming, the programming is centered on objects that are created from abstract data types that encapsulate data and functions together.

Object-oriented

what is an overridden method

Overriding is the ability of a class to change the implementation of a method provided by one of its ancestors

a ____ access file retrieves data from the beginning of the file to the end of the file.

Sequential

what does the tkinter modules mainloop function do

The mainloop function is executed as an infinite loop till the main window of the program does not close

how can you use an intvar object to determine which radiobutton has been selected in a group of radiobuttons

When we create a group of Radiobuttons, associate them all with the same IntVar object. When one of the Radiobutton widgets is selected, store a unique integer value in the IntVar object.

if you call the index method to locate an item in a list and the item is not found, this happens.

a ValueError exception is raised.

This built-in function returns the highest value in a list.

max

What are the procedures that an object performs called?

methods

what are the procedures that an object performs called?

methods

lists are ____ which means their elements can be changed.

mutable

Which of the following will assign a random number in the range of 1 through 50 to the variable number?

number = random(range(1, 50))

which of the following will assign a random number in the range of 1 through 50 to the variable number?

number = random.randint(1, 50)

What type of programming contains class definition?

object-oriented

Which step creates a connection between the file and the program?

open the file

When using the _________ operator, one or both subexpressions must be true for the compound expression to be true.

or

the term _____ file is used to describe a file to which data is written

output

When a subclass method has the same name as a superclass method, the subclass method __________ the superclass method.

overridden

the label widgets ____ method determines where a widget should be positioned and makes the widget visible when the main window is displayed.

pack

What gives the program the ability to call the correct method depending on the type of object that is used to call it?

polymorphism

this characteristic of object-oriented programming allows the correct version of an overridden method to be called when an instance of a subclass is used to call it.

polymorphism

This standard library function returns a random floating-point number in the range of 0.0 up to 1.0 (but not including 1.0)

random


Related study sets

multiplication and division vocabulary

View Set

Introduction to multiple linear regression

View Set

compromise of 1850, daniel webster & john c. calhoun

View Set

intermolecular forces and phase change

View Set

Onychomycosis (or tinea unguium)

View Set

Mao's rise to power' and the 'Chinese civil war 1911 - 1949

View Set