PROGRAMMING 12,13 REVIEW

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which of the following describes the base case in a recursive solution? a. a case in which the problem can be solved without recursion b. the case in which the problem is solved through recursion c. the way to stop the recursion d. the way to return to the main function

a. a case in which the problem can be solved without recursion

Which of the following is not a method of the Canvas widget? a. create_line b. create_oval c. create_button d. create_text

c. create_button

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

c. dialog boxes

In an event-driven program, the __________ accepts the user's commands. a. register b. CPU c. operating system d. GUI

c. operating system

A recursive function includes __________ which are not necessary in a loop structure. a. function calls b. conditional clauses c. overhead actions d. object instances

c. overhead actions

The process of calling a function requires a. a slow memory access b. a quick memory access c. several actions to be performed by the computer d. one action to be performed by the computer

c. several actions to be performed by the computer

What defines the depth of recursion? a. the length of the algorithm b. the number of function calls c. the number of times the function calls itself d. the number of times the function goes to the base case

c. the number of times the function calls itself

What are the items that appear on the graphical interface window called? a. buttons b. icons c. widgets d. graphical elements

c. widgets

A __________ program is an event-driven program. a. GUI b. command line c. procedural d. modular

a. GUI

What is the first step to take in order to apply a recursive approach? a. Identify at least one case in which the problem can be solved without recursion. b. Determine a way to solve the problem in all circumstances using recursion. c. Identify a way to stop the recursion. d. Determine a way to return to the main function.

a. Identify at least one case in which the problem can be solved without recursion.

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

a. Label

A function is called from the main function for the first time and then calls itself seven times. What is the depth of recursion? a. 8 b. 2 c. 1 d. 7

d. 7

In a recursive solution, if the problem cannot be solved now, then a recursive function reduces it to a smaller but similar problem and a. exits b. returns to the main function c. returns to the calling function d. calls itself to solve the smaller problem

d. calls itself to solve the smaller problem

Which of the following must you include with your program so you can display a message to the user with the showinfo function? a. import tkinter b. import canvas import messagebox c. import messagebox d. import tkinter import tkinter.messagebox

d. import tkinter import tkinter.messagebox

If, in a recursive solution, function A calls function B which calls function C, this is called __________ recursion. a. continuous b. direct c. three function call d. indirect

d. indirect

The base case is the case in which the problem can be solved without a. loops b. decisions c. objects d. recursion

d. recursion

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 a. n = 0 b. n = 1 c. n > 0 d. The factorial of a number cannot be solved with recursion.

a. n = 0

Recursion is a. never required to solve a problem b. required to solve certain mathematical problems c. sometimes required to solve string problems d. required to solve some problems

a. never required to solve a problem

A problem can be solved with recursion if it can be broken down into __________ problems. a. smaller b. one-line c. manageable d. modular

a. smaller

If a problem can be solved immediately without recursion, then the recursive function a. solves it and returns b. exits c. returns a default value d. generates a run-time error

a. solves it and returns

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

a. tkinter

What is the second step to take in order to apply a recursive approach? a. Identify at least one case in which the problem can be solved without recursion. b. Determine a way to use recursion to solve the problem in all circumstances which cannot be solved without recursion. c. Determine a way to return to the main function. d. Identify a way to stop the recursion.

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

Which widget allows the user to enter a single line of input from the keyboard? a. Toplevel b. Entry c. Message d. Text

b. Entry

The acronym GUI stands for a. Graphical User's Interface b. Graphical User Interface c. Graphical User Interaction d. Graphical Union Interface

b. Graphical User Interface

In a(n) __________ interface, a prompt is displayed that allows the user to enter a command which is then executed. a. windows b. command line c. GUI d. operating

b. command line

Recursive functions are __________ iterative algorithms. a. more efficient than b. less efficient than c. as efficient as d. impossible to compare to

b. less efficient than

Given the following code, which line defines the size of the window? import tkinter class myShape: def __init__(self): self.main_window = tkinter.Tk() self.canvas = tkinter.Canvas(self.main_window, width=200, height=200) self.canvas.create_rectangle(30,30, 175, 175) self.canvas.pack() tkinter.mainloop() shape = myShape() a. self.main_window = tkinter.Tk() b. self.canvas = tkinter.Canvas(self.main_window,width=200, height=200) c. self.canvas.create_rectangle(30,30, 175, 175) d. shape = myShape()

b. self.canvas = tkinter.Canvas(self.main_window,width=200, height=200)

In an event-driven environment, the user interacts with a. the graphical unit b. the user interface c. the register d. the CPU

b. the user interface

Given the following code, what are the dimensions, in pixels, of the shape created? import tkinter class myShape: def __init__(self): self.main_window = tkinter.Tk() self.canvas = tkinter.Canvas(self.main_window, width=200, height=200) self.canvas.create_rectangle(30,30, 175, 175) self.canvas.pack() tkinter.mainloop() shape = myShape() a. 200 X 200 b. 30 X 175 c. 145 X 145 d. None of these

c. 145 X 145

A __________ is a container that can be used to organize the widgets in a window. a. Textbox b. Label c. Frame d. Canvas

c. Frame

In a(n) __________ interface, the user can determine the order in which things happen. a. windows b. command line c. GUI d. operating

c. GUI

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

c. Message

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

c. Scale


Set pelajaran terkait

Choosing Precise Words to Eliminate Wordiness and Redundancy by LegitSwag69

View Set

Chapter #3: Sensation and Perception

View Set

Writing Quality Profiles (1.5 hrs)

View Set

CMST 2120 Exam #2 COMPLETE CHAPTER NOTES

View Set

NUR-227 PEDS Test 2 (Medication Administration (Sherpath))

View Set