Python Programming Mock Exam - 488 Verified Questions

Page 1


Python Programming

Mock Exam

Course Introduction

Python Programming is an introductory course designed to equip students with the fundamental concepts and practical skills of programming using the Python language. The course covers core topics such as variables, data types, control structures, functions, modules, and file operations, along with essential programming constructs like loops and conditionals. Emphasis is placed on problem-solving, algorithm development, and writing clean, efficient code. Students will also be introduced to foundational libraries and tools for data handling and visualization, preparing them for more advanced studies in computer science, data analysis, or software development. By the end of the course, learners will be able to design, implement, and debug Python programs for a variety of applications.

Recommended Textbook

Starting Out with Python 3rd Edition by Tony Gaddis

Available Study Resources on Quizplus

13 Chapters

488 Verified Questions

488 Flashcards

Source URL: https://quizplus.com/study-set/1057

Page 2

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

36 Verified Questions

36 Flashcards

Source URL: https://quizplus.com/quiz/20921

Sample Questions

Q1) The Python _______________ is a program that can read Python programming statements and execute them.

Answer: interpreter

Q2) The disk drive is a secondary storage device that stores data by _____ encoding it onto a spinning circular disk.

A) electrically

B) magnetically

C) digitally

D) optically

Answer: B

Q3) A computer is a single device that performs different types of tasks for its users.

A)True

B)False

Answer: False

Q4) _______________ is a type of memory that can hold data for long periods of time, even when there is no power to the computer.

Answer: Secondary storage

To view all questions and flashcards with answers, click on the resource link above. Page 3

Chapter 2: Input, Processing, and Output

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20922

Sample Questions

Q1) The \t escape character causes the output to skip over to the next horizontal tab.

A)True

B)False

Answer: True

Q2) In Python, math expressions are evaluated from left to right, no matter what the operators are.

A)True

B)False

Answer: False

Q3) A flowchart is a tool that programmers use to design programs.

A)True

B)False

Answer: True

Q4) Python formats all floating-point numbers to two decimal places when outputting using the print statement.

A)True

B)False

Answer: False

To view all questions and flashcards with answers, click on the resource link above. Page 4

Chapter 3: Decision Structures and Boolean Logic

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20923

Sample Questions

Q1) Short-circuit evaluation is performed with the not operator.

A)True

B)False

Answer: False

Q2) A(n) _______________ operator determines whether a specific relationship exists between two values.

Answer: relational

Q3) The Python language is not sensitive to block structuring of code.

A)True

B)False

Answer: False

Q4) A Boolean variable can reference one of two values: _____.

A) yes or no

B) true or false

C) T or F

D) Y or N

Answer: B

Q5) A(n) _______________ expression is made up of two or more Boolean expressions.

Answer: compound

To view all questions and flashcards with answers, click on the resource link above. Page 5

Chapter 4: Repetition Structures

Available Study Resources on Quizplus for this Chatper

34 Verified Questions

34 Flashcards

Source URL: https://quizplus.com/quiz/20924

Sample Questions

Q1) In Python, the variable in the for clause is referred to as the _____ because it is the target of an assignment at the beginning of each loop iteration.

A) target variable

B) loop variable

C) for variable

D) count variable

Q2) The integrity of a program's output is only as good as the integrity of its input. For this reason the program should discard input that is invalid and prompt the user to enter correct data.

A)True

B)False

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

A) Condition-controlled loop

B) Number-controlled loop

C) Count-controlled loop

D) Boolean-controlled loop

Q4) A(n) _______________ total is a sum of numbers that accumulates with each iteration of a loop.

To view all questions and flashcards with answers, click on the resource link above. Page 6

Chapter 5: Functions and Modules

Available Study Resources on Quizplus for this Chatper

69 Verified Questions

69 Flashcards

Source URL: https://quizplus.com/quiz/20925

Sample Questions

Q1) A(n) _____ chart is also known as a structured chart.

A) flow

B) data

C) hierarchy

D) organizational

Q2) A function definition specifies what a function does and causes the function to execute.

A)True

B)False

Q3) The _____ design technique can be used to break down an algorithm into functions.

A) subtask

B) block

C) top-down

D) simplification

Q4) Boolean functions are useful for simplifying complex conditions that are tested in decision and repetition structures.

A)True

B)False

Q5) The code for a function is known as a function _______________.

Page 7

To view all questions and flashcards with answers, click on the resource link above.

Chapter 6: Files and Exceptions

Available Study Resources on Quizplus for this Chatper

34 Verified Questions

34 Flashcards

Source URL: https://quizplus.com/quiz/20926

Sample Questions

Q1) When a piece of data is read from a file, it is copied from the file into the program.

A)True

B)False

Q2) If a file with the specified name already exists when the file is opened, and the file is opened in 'w' mode, then an alert will appear on the screen.

A)True

B)False

Q3) A(n) _______________ access file retrieves data from the beginning of the file to the end of the file.

Q4) What happens when a piece of data is written to a file?

A) Data is copied from a variable in RAM to a file.

B) Data is copied from a variable in the program to a file.

C) Data is copied from the program to a file.

D) Data is copied from a file object to a file.

Q5) The ZeroDivisionError exception is raised when the program attempts to perform a division by zero.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Lists and Tuples

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20927

Sample Questions

Q1) A list cannot be passed as an argument to a function.

A)True

B)False

Q2) The index - 1 identifies the last element in a list.

A)True

B)False

Q3) What would be the value of the variable list2 after the execution of the following code?

List1 = [1, 2, 3]

List2 = list1

List1 = [4, 5, 6]

A) [1, 2, 3]

B) [4, 5, 6]

C) [1, 2, 3, 4, 5, 6]

D) invalid code

Q4) The _______________ method reverses the order of the items in the list.

Q5) Each element in a tuple has a(n) _______________ that specifies its position in the tuple.

Q6) The _______________ function returns the item that has the lowest value in the sequence.

Page 9

To view all questions and flashcards with answers, click on the resource link above.

Chapter 8: More About Strings

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20928

Sample Questions

Q1) If the + operator is used on strings, it produces a string that is the combination of the two strings used as its operands.

A)True

B)False

Q2) If a whole paragraph is included in a single string, the split() method can be used to obtain a list of the sentences included in the paragraph.

A)True

B)False

Q3) In slicing, if the end index specifies a position beyond the end of the string, Python will use the length of the string instead.

A)True

B)False

Q4) Indexing works with both strings and lists.

A)True

B)False

Q5) The _______________ method returns true if the string contains only numeric digits.

Q6) The _______________ method returns the list of the words in the string.

To view all questions and flashcards with answers, click on the resource link above. Page 10

Chapter 9: Dictionaries and Sets

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20929

Sample Questions

Q1) Each element in a(n) _______________ has two parts: a key and a value.

Q2) The difference of set1 and set2 is a set that contains only the elements that appear in set1 but do not appear in set2.

A)True

B)False

Q3) A dictionary can include the same value several times, but cannot include the same key several times.

A)True

B)False

Q4) The index of the first key-value pair in a dictionary is 0.

A)True

B)False

Q5) A(n) _______________ is an object that holds multiple unique items of data in an unordered manner.

Q6) Sets are immutable.

A)True

B)False

Q7) The _______________ method returns a value associated with a specified key and if found, removes that key-value pair from the dictionary.

To view all questions and flashcards with answers, click on the resource link above. Page 11

Chapter 10: Classes and Object Oriented Programming

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20930

Sample Questions

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

A)True

B)False

Q2) Which method is automatically executed when an instance of the class is created in memory?

A) __state__

B) __obj__

C) __str__

D) __init__

Q3) A method that returns a value from a class's attribute but does not change it is known as a(n) _______________ method.

Q4) A class _______________ is a set of statements that define a class's methods and data attributes.

Q5) A(n) _______________ is code that specifies the data attributes and methods for a particular type of object.

Q6) Each object that is created from a class is called a(n) _______________ of the class.

Q7) An object's _______________ is simply the values of the object's attributes at any given moment.

Page 12

To view all questions and flashcards with answers, click on the resource link above.

Chapter 11: Inheritance

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20931

Sample Questions

Q1) 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

Q2) In an inheritance relationship, the extended class is called the _______________.

Q3) 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

Q4) _____ allows a new class to inherit the members of the class it extends.

A) Encapsulation

B) Domain

C) Methods

D) Inheritance

Q5) Superclasses are also called _______________ classes.

To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 12: Recursion

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20932

Sample Questions

Q1) If the problem can be solved immediately without recursion, then the recursive function _____.

A) solves it and returns

B) Exits

C) returns the result

D) generates a run-time error

Q2) There can be several functions involved in the recursion.

A)True

B)False

Q3) What is referred to as the recursive case?

A) At least one case in which the problem can be solved without recursion

B) A way to solve the problem in all other circumstances using recursion

C) The way to stop the recursion

D) The way to return to the main function

Q4) A solution using a(n) _______________ is usually more evident than a recursive solution.

Q5) Recursion is required to solve some type of problems.

A)True B)False

Q6) The majority of repetitive programming tasks are best done with

To view all questions and flashcards with answers, click on the resource link above. Page 14

Chapter 13: GUI Programming

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

Source URL: https://quizplus.com/quiz/20933

Sample Questions

Q1) Which widget allows the user to select a value by moving a slider along a track?

A) Entry

B) Scale

C) Scrollbar

D) Slider

Q2) A(n) _______________ function is a function or method that executes when the user clicks the button.

Q3) What are the items that appear on the graphical interface window called?

A) Buttons

B) Icons

C) Widgets

D) Graphical elements

Q4) The Label widget's _______________ method determines where a widget should be positioned and makes the widget visible when the main window is displayed.

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

A)True

B)False

Q6) The _______________ widget is used to display text in a window.

Q7) The _______________ module allows you to create GUI programs in Python.

Page 15

To view all questions and flashcards with answers, click on the resource link above.

Turn static files into dynamic content formats.

Create a flipbook