Comp Sci Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

False

Check buttons are displayed in groups and used to make mutually exclusive selections.

encapsulation

Combining data and code in a single object is known as

True

New attributes and methods may be added to a subclass.

true

Object-oriented programming allows us to hide the object's data attributes from code that is outside the object.

Cola

Of the two classes Cola and Soda, which would most likely be the subclass? a. Cola b. Soda c. Both d. Either

False

One of the ingredients of polymorphic behavior is the ability to define a method in a subclass, and then define a method with the same name in a superclass.

True

Polymorphism works on any two class methods that have the same name.

true

Procedures operate on data items that are separate from the procedures.

True

Programs that use tkinter do not always run reliably under IDLE.

True

Python does not have GUI programming features built into the language itself.

false

Recursive algorithms are always more concise and efficient than iterative algorithms.

less efficient than

Recursive functions are ________ iterative algorithms.

true

The 'self' parameter is required in every method of a class.

Frame

The Toplevel widget is a container, like a(n) _____, but displays in its own window. a. Label b. Frame c. Canvas d. Message

operating system

The _____ accepts the user's commands. a. register b. CPU c. operating system d. ALU

n = 0

Which would be the base case in a recursive solution to the problem of finding the factorial of a number. Recall that the factorial of a non-negative whole number is defined as n! where: If n = 0, then n! = 1 If n > 0, then n! = 1 x 2 x 3 x ... x n

User interface

With what part of the computer does the user interact? a. Graphical unit b. User interface c. Register d. CPU

True

To use the showinfo function, the tkinter.messagebox module needs to be imported.

Scale

Which widget allows the user to select a value by moving a slider along a track? a. Entry b. Scale c. Scrollbar d. Slider

Canvas

Which widget will create a rectangular area that can be used to display graphics? a. Label b. Frame c. Canvas d. Message

Label

Which widget will create an area that displays one line of text or an image? a. Label b. Frame c. Canvas d. Message

Message

Which widget will display multiple lines of text? a. Label b. Canvas c. Message d. Text

false

All class definitions are stored in the library so that they can be imported into any program.

false

All instances of a class share the same values of the data attributes in the class.

False

An 'is a' relationship exists between a grasshopper and a bumblebee.

false

A base case is not necessary for all recursive algorithms.

7

A function is called from the main function for the first time and then calls itself seven times. What is the depth of recursion?

False

A mutator method has no control over the way that a class's data attributes are modified.

smaller

A problem can be solved with recursion if it can be broken down into ________ problems.

true

A problem can normally be solved with recursion if it can be broken down into smaller problems that are identical in structure to the overall problem.

overhead actions

A recursive function includes ________ which are not necessary in a loop structure.

true

A recursive function must have some way to control the number of times it repeats.

True

A root widget's destroy method can be used as a callback function for a quit button.

False

A subclass may not override any method other than the __init__ method.

False

A superclass inherits attributes and methods from its subclasses without any of them having to be rewritten.

getters

Accessor methods are also known as

True

An info dialog box is a simple window that displays a message to the user and has an OK button that closes the dialog box.

superclasses

Base classes are also called _____. a. superclasses b. derived c. subclasses d. classes

True

Each subclass has a method named __init__ that overrides the superclass's __init__.

true

Each time a function is called in a recursive solution, the system incurs overhead that is not incurred with a loop

Vegetable

Examine the following piece of code: class Potato (Vegetable): In a UML diagram, what would the open arrowhead point to? a. Potato b. Vegetable c. class d. Potato(Vegetable)

Fifteen

How many graphical widgets does the tkinter module provide? a. Five b. Ten c. Fifteen d. Twenty

solves it and returns

If a problem can be solved immediately without recursion, then the recursive function

true

If a recursive solution is evident for a particular problem, and if the recursive algorithm does not slow system performance by an intolerable amount, then recursion would probably be a good design choice.

indirect

If, in a recursive solution, function A calls function B which calls function C, this is called ________ recursion.

tkinter

In Python, what module is used to create a GUI program? a. tkinter b. Pgui c. gint d. pygui

dialog boxes

In a GUI environment, most interactions are done through small windows known as _____ that display information and allow the user to perform actions. a. input boxes b. windows c. dialog boxes d. message boxes

False

In a GUI environment, no text input is possible.

False

In a UML diagram depicting inheritance, you only write the name of the subclass.

false

In a UML diagram the first section holds the list of the class's methods.

Superclass

In a UML diagram, what does the open arrowhead point to? a. Superclass b. Subclass c. Object d. Method

calls itself to solve the smaller problem

In a recursive solution, if the problem cannot be solved now, then a recursive function reduces it to a smaller but similar problem and

Subclass

In an inheritance relationship, what is a specialized class called? a. Superclass b. Subclass c. Object d. Method

false

In many cases it is easier to see how to solve a problem with recursion than with a loop.

identify the classes needed

In object-oriented programming, one of first tasks of the programmer is to

Human

In the following line of code, what is the name of the base class? class Male(Human): a. Male b. Human c. Either d. Incorrect code

Rose

In the following line of code, what is the name of the subclass? class Rose(Flower): a. Rose b. Flower c. Either d. Incorrect code

GUI

In which environment can a user determine the order in which things happen? a. Command line b. GUI c. ALU d. CPU

Command line

In which type of interface is a prompt displayed that allows the user to enter a command, which is then executed? a. Command line b. GUI c. ALU d. CPU

False

It is not possible to indicate inheritance in a UML diagram.

False

Many computer users find a command line interface relatively easy to use.

setters

Mutator methods are also known as

Graphical User Interface

The acronym GUI stands for: a. Graphical User Interface b. Graphical Unit Interface c. Graphical User Interaction d. Graphical Users' Interface

recursion

The base case is the case in which the problem can be solved without

True

The pack method determines where a widget should be positioned.

methods

The procedures that an object performs are called

several actions to be performed by the computer

The process of calling a function requires

false

There must be only one function involved in any recursive solution.

False

Using the radio buttons, the user can make multiple selections at one time.

Widgets

What are the items that appear on the graphical interface window called? a. Buttons b. Icons c. Widgets d. Graphical elements

Inheritance

What concept involves a superclass and a subclass? a. Polymorphism b. Inheritance c. Encapsulation d. Methods

the number of times the function calls itself

What defines the depth of recursion?

Attributes and methods

What does a subclass inherit from a superclass? a. Instances and attributes b. Data and methods c. Methods and instances d. Attributes and methods

Unified modeling language

What does the acronym UML stand for?

Polymorphism

What gives a program the ability to call the correct method depending on the type of object that is used to call it? a. Polymorphism b. Inheritance c. Encapsulation d. Methods

identify at least one case in which the problem can be solved without recursion

What is the first step to take in order to apply a recursive approach?

Is a

What is the relationship called in which one object is a specialized version of another object? a. Parent-child b. Node c. Is a d. Class

determine a way to use recursion to solve the problem in all circumstances which cannot be solved without recursion

What is the second step to take in order to apply a recursive approach?

__str__

What is the special name given to the method that returns a string containing an object's state?

accessors

What type of method provides a safe way for code outside a class to retrieve the values of attributes, without exposing the attributes in a way that could allow them to be changed by code outside the method?

object-oriented

What type of programming contains class definitions?

GUI programs

What types of programs are event-driven? a. GUI programs b. Command line programs c. Procedural programs d. Modular programs

False

When a class inherits another class, it is required to use all the data attributes and methods of the superclass.

a reference to the object

When an object is passed as an argument, ________ is passed into the parameter variable.

superclass

When there are several classes that have many common data attributes, it is better to write a(n) _____ to hold all the general data. a. superclass b. subclass c. object d. method

true

When, in a recursive solution, function A calls function B which, in turn, calls function A, this is known as indirect recursion.

instance

Which attributes belong to a specific instance of a class?

class Worker:

Which is the first line needed when creating a class named Worker?

isinstance

Which method can you use to determine whether an object is an instance of a class? a. isinstance b. isclass c. isobject d. isinheritance

__str__

Which method is automatically called when you pass an object as an argument to the print function?

__init__

Which method is automatically executed when an instance of a class is created in memory?

an object

Which of the following can be thought of as a self-contained unit that consists of data attributes and the methods that operate on the data attributes?

a case in which the problem can be solved without recursion

Which of the following describes the base case in a recursive solution?

class dining(furniture):

Which of the following is the correct syntax for defining a class dining which inherits from class furniture? a. class furniture(dining) b. class dining(furniture) c. class furniture(dining): d. class dining(furniture):

worker_joey = Worker()

Which of the following will create an object, worker_joey, of the Worker class?

second section

Which section in the UML holds the list of the class's data attributes?

third section

Which section in the UML holds the list of the class's methods?

Inheritance

_____ allows a new class to inherit the members of the class it extends. a. Encapsulation b. Domain c. Methods d. Inheritance

never required to solve a problem

recursion is

false

recursion is sometimes required to solve certain types of problems.


Kaugnay na mga set ng pag-aaral

Tax Research Test 2 - Homework Questions and Answers

View Set

Stats 1.2 Simple random sampling

View Set

Wisconsin Accident and Health Insurance Exam 2

View Set

AWS Cloud Practitioner Udemy Exam 5

View Set

National Counselor Examination (NCE)

View Set

Med Surge Prup U Chapter 28: Caring for Clients with Heart Failure - ML5

View Set

PREPU Chapter 26: Wellness and Health Promotion

View Set