Skip to main content

Python Programming Question Bank - 533 Verified Questions

Page 1


Python Programming Question Bank

Course Introduction

Python Programming introduces students to the fundamental concepts and methodologies of computer programming using the Python language. The course covers essential topics such as variables, data types, control structures, functions, and modules, as well as input/output operations and error handling. Students also learn about object-oriented programming principles, file manipulation, and working with libraries for data analysis and visualization. Through hands-on exercises and projects, learners develop problem-solving skills and gain practical experience in writing, testing, and debugging Python programs applicable to a variety of real-world scenarios.

Recommended Textbook

Starting Out with Python 4th Edition by Tony Gaddis

Available Study Resources on Quizplus

13 Chapters

533 Verified Questions

533 Flashcards

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

Page 2

Chapter 1: Introduction to Computers and Programming

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

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

Sample Questions

Q1) Which of the following is not a major component of a typical computer system?

A) the CPU

B) main memory

C) the operating system

D) secondary storage devices

Answer: C

Q2) A __________ has no moving parts and operates faster than a traditional disk drive.

A) DVD drive

B) solid state drive

C) jumper drive

D) hyper drive

Answer: B

Q3) The Python language uses a compiler which is a program that both translates and executes the instructions in a high-level language.

A)True

B)False

Answer: False

Q4) A disk drive stores data by __________ encoding it onto a circular disk.

Answer: magnetically

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Select all that apply. Which of the following are steps in the program development cycle?

A) design the program

B) write the code and correct syntax errors

C) test the program

D) correct logic errors

Answer: A,B,C,D

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

A)True

B)False

Answer: False

Q3) Comments in Python begin with the # character.

A)True

B)False

Answer: True

Q4) ___________ are notes of explanation that document lines or sections of a program.

Answer: Comments

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The turtle.isdown()function returns ___________ if the turtle's pen is down.

A)True

B)False

Answer: True

Q2) Python provides a special version of a decision structure known as the __________ statement,which makes the logic of the nested decision structure simpler to write.

Answer: if-elif-else

Q3) What is the result of the following Boolean expression,given that x = 5,y = 3,and z = 8?

X < y or z > x

A) True

B) False

C) 8

D) 5

Answer: A

Q4) A(n)__________ statement will execute one block of statements if its condition is true or another block if its condition is false.

Answer: if-else

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

41 Verified Questions

41 Flashcards

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

Sample Questions

Q1) The first operation is called the __________ and its purpose is to get the first input value that will be tested by the validation loop.

A) priming read

B) first input

C) loop set read

D) loop validation

Q2) A(n)__________ structure is a structure that causes a statement or a set of statements to execute repeatedly.

A) sequence

B) decision

C) module

D) repetition

Q3) A(n)__________-controlled loop causes a statement or set of statements to repeat as long as the condition is true.

Q4) In a flowchart,both the decision structure and the repetition structure use the diamond symbol to represent the condition that is tested.

A)True

B)False

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

6

Chapter 5: Functions

Available Study Resources on Quizplus for this Chatper

66 Verified Questions

66 Flashcards

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

Sample Questions

Q1) The math function ceil(x)returns the smallest integer that is greater than or equal to x.

A)True

B)False

Q2) Which of the following statements causes the interpreter to load the contents of the random module into memory?

A) load random

B) import random

C) upload random

D) download random

Q3) A value-returning function is

A) a single statement that performs a specific task

B) called when you want the function to stop

C) a function that will return a value back to the part of the program that called it

D) a function that receives a value when called

Q4) Arguments are passed by __________ to the corresponding parameter variables in a function.

Q5) The top-down design breaks down the overall task of a program into a series of

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

Chapter 6: Files and Exceptions

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

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

A) 'w'

B) 'r'

C) 'a'

D) 'e'

Q2) Which of the following is associated with a specific file and provides a way for the program to work with that file?

A) the filename

B) the file extension

C) the file object

D) the file variable

Q3) Which step creates a connection between a file and a program?

A) open the file

B) read the file

C) process the file

D) close the file

Q4) A(n)___________ block includes one or more statements that can potentially raise an exception.

Q5) A(n)__________ file contains data that has not been converted to text.

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The __________ method is commonly used to add items to a list.

Q2) A(n)___________ is a span of items that are taken from a sequence.

Q3) The remove method removes all occurrences of an item from a list.

A)True

B)False

Q4) Tuples are __________ sequences which means that once a tuple is created,it cannot be changed.

Q5) What are the data items in a list called?

A) data

B) elements

C) items

D) values

Q6) A(n)__________ is an object that holds multiple items of data.

Q7) The sort method rearranges the elements of a list so they are in ascending or descending order.

A)True

B)False

Q8) The ___________ function can be used to convert a list to a tuple.

Q9) The built-in function __________ returns the length of a sequence.

Q10) Lists are ___________,which means their elements can be changed in a Page 9

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

Page 10

Chapter 8: More About Strings

Available Study Resources on Quizplus for this Chatper

37 Verified Questions

37 Flashcards

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

Sample Questions

Q1) When the operand on the left side of the * symbol is a string and the operand on the right side is an integer,the * becomes the ___________ operator.

Q2) What will be assigned to the variable some_nums after the following code executes?

Special = '0123456789' Some_nums = special[0:10:2]

A) '0123456789'

B) '24682468'

C) '02468'

D) '02020202020202020202'

Q3) Each character in a string has a(n)__________ which specifies its position in the string.

Q4) The strip()method returns a copy of the string with all the leading whitespace characters removed but does not remove trailing whitespace characters.

A)True

B)False

Q5) A(n)__________ is a span of characters that are taken from within a string.

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

Q7) The third number in string slicing brackets represents the ___________ value.

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

Chapter 9: Dictionaries and Sets

Available Study Resources on Quizplus for this Chatper

39 Verified Questions

39 Flashcards

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

Sample Questions

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

Q2) Which of the following does not apply to sets?

A) The stored elements can be of different data types.

B) All the elements must be unique; you cannot have two elements with the same value.

C) The elements are unordered.

D) The elements are in pairs.

Q3) The elements in a dictionary are stored in ascending order,by the keys of the key-value pairs.

A)True

B)False

Q4) The set remove and discard methods behave differently only when a specified item is not found in the set.

A)True

B)False

Q5) The __________ method returns a value associated with a specific key and,if found,removes that key-value pair from the dictionary.

Q6) Each element in a(n)__________ has two parts: a key and a value.

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

Chapter 10: Classes and Object-Oriented Programming

Available Study Resources on Quizplus for this Chatper

38 Verified Questions

38 Flashcards

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

Sample Questions

Q1) Mutator methods are also known as

A) setters

B) getters

C) instances

D) attributes

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

A)True

B)False

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

A) list the nouns in the problem

B) list the methods that are needed

C) identify the classes needed

D) identify the objects needed

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

Q5) ___________ programming is a method of writing software that centers on the actions that take place in a program.

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

Page 13

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

36 Verified Questions

36 Flashcards

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

Sample Questions

Q1) In the following line of code,what is the name of the base class?

Class Python(Course):

A) Python

B) Course

C) Python(Course)

D) None of these

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

A)True

B)False

Q3) New attributes and methods may be added to a subclass which makes it a(n)__________ version of the superclass.

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

A)True

B)False

Q5) One problem with using a UML diagram is that there is no way to indicate inheritance.

A)True

B)False

Page 14

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

Chapter 12: Recursion

Available Study Resources on Quizplus for this Chatper

35 Verified Questions

35 Flashcards

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

Sample Questions

Q1) A recursion in which a function directly calls itself is known as ___________ recursion.

Q2) Some problems are more __________ solved with recursion than with a loop.

Q3) Each time a function is called,the system incurs __________ that is not necessary with a loop.

Q4) Recursive function calls are __________ efficient than loops.

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

A)True

B)False

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

Q7) Recursion is sometimes required to solve certain types of problems.

A)True

B)False

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

Q8) The majority of repetitive programming tasks are best done with ___________.

Chapter 13: Gui Programming

Available Study Resources on Quizplus for this Chatper

42 Verified Questions

42 Flashcards

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

Sample Questions

Q1) Which widget allows the user to enter a single line of input from the keyboard?

A) Toplevel

B) Entry

C) Message

D) Text

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

Q3) Since GUI programs respond to the actions of the user,they are called __________ programs.

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

A) buttons

B) icons

C) widgets

D) graphical elements

Q5) The __________ module allows you to create GUI programs in Python.

Q6) A(n) __________ is a widget that the user can click to cause an action to occur.

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

Turn static files into dynamic content formats.

Create a flipbook
Python Programming Question Bank - 533 Verified Questions by Quizplus - Issuu