Skip to main content

Introductory Python Programming Midterm Exam - 533 Verified Questions

Page 1


Introductory Python Programming Midterm

Exam

Course Introduction

This course provides a comprehensive introduction to Python programming, focusing on fundamental programming concepts and problem-solving techniques. Students will learn the basics of Python syntax, data types, variables, control structures, functions, and data structures such as lists and dictionaries. Emphasis is placed on writing readable, efficient code and developing logical thinking skills through hands-on exercises and practical projects. By the end of the course, students will be able to design, implement, and test simple Python programs, laying a strong foundation for further study in computer science and software development.

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) The process known as the __________ cycle is used by the CPU to execute instructions in a program.

A) decode-fetch-execute

B) decode-execute-fetch

C) fetch-decode-execute

D) fetch-execute-decode

Answer: C

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 software developer is the person with the training to design,create,and test computer programs.

A)True

B)False

Answer: True

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) Computer programs typically perform three steps: input is received,some process is performed on the input,and output is produced.

A)True

B)False

Answer: True

Q2) The __________ function reads a piece of data that has been entered at the keyboard and returns that piece of data,as a string,back to the program.

A) input()

B) output()

C) eval_input()

D) str_input()

Answer: A

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

A)True

B)False

Answer: True

Q4) When the + operator is used with two strings,it performs string __________.

Answer: concatenation

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

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

Q2) In a decision structure,the action is ___________ executed because it is performed only when a specific condition is true.

Answer: conditionally

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

A) True

B) False

C) 8

D) 5

Answer: B

Q4) Nested decision statements are one way to test more than one condition.

A)True

B)False

Answer: True

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 following for loop iterates ___________ times to draw a square. for x in range(4): turtle.forward(200) turtle.right(90)

Q2) In Python,a comma-separated sequence of data items that are enclosed in a set of brackets is called A) sequence B) variable C) value D) list

Q3) A(n)___________ structure causes a set of statements to execute repeatedly.

Q4) The while loop is known as a(n)__________ loop because it tests the condition before performing an iteration.

Q5) In Python,an infinite loop usually occurs when the computer accesses an incorrect memory address. A)True

B)False

Q6) Reducing duplication of code is one of the advantages of using a loop structure. A)True B)False

Page 6

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

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) To refer to a function in a module,Python uses ___________ notation.

Q2) A(n)__________ chart is a visual representation of the relationships between functions.

Q3) A value-returning function is like a simple function except that when it finishes it returns a value back to the part of the program that called it.

A)True

B)False

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

A) a function

B) a subtask

C) a process

D) a subprocess

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

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

A)True

B)False

Q7) In Python,a module's file name should end in ___________.

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

40 Verified Questions

40 Flashcards

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

Sample Questions

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

Q2) When a program needs to save data for later use,it writes the data in a(n)___________.

Q3) Which of the following describes what happens when a piece of data is written to a file?

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

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

C) The data is copied from the program to a file.

D) The data is copied from a file object to a file.

Q4) Closing a file disconnects the communication between the file and the program.

A)True

B)False

Q5) How many types of files are there?

A) one

B) two

C) three

D) more than three

Q6) When data is written to a file,it is described as a(n)__________ file.

Q7) A(n)___________ access file retrieves data from the beginning of the file to the end of the file.

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) What is the first negative index in a list?

A) 0

B) -1

C) -0

D) the size of the list minus 1

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

A)True

B)False

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

A)True

B)False

Q4) Which method can be used to convert a tuple to a list?

A) append

B) tuple

C) insert

D) list

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

Q6) Each element in a tuple has a(n)__________ that specifies its position in the tuple.

Q7) The __________ method reverses the order of the items in a list.

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

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) If the + operator is used on strings,it produces a string that is a 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 in the paragraph.

A)True

B)False

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

Q4) When accessing each character in a string,such as for copying purposes,you would typically use a while loop.

A)True

B)False

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

Q6) The __________ method returns True if the string contains only numeric digits.

Q7) You cannot use a for loop to iterate over the characters in a string.

A)True

B)False

10

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

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) What does the get method do if the specified key is not found in the dictionary?

A) It throws an exception.

B) It does nothing.

C) It returns a default value.

D) You cannot use the get method to specify a key.

Q2) The elements in a dictionary are not stored in a specific order. Therefore,a dictionary is not a(n)___________.

Q3) Which method can be used to add a group of elements to a set?

A) add

B) addgroup

C) update

D) addset

Q4) You would typically use a for loop to iterate over the elements in a set.

A)True

B)False

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

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

Q7) Each element in a dictionary view is a __________.

Q8) The __________ method clears the contents of a 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

38 Verified Questions

38 Flashcards

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

Sample Questions

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

A) __state__

B) __obj__

C) __str__

D) __init__

Q2) ___________ provides a set of standard diagrams for graphically depicting object-oriented systems.

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

Q4) Combining data and code in a single object is known as

A) modularity

B) instantiation

C) encapsulation

D) objectification

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

A)True

B)False

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

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

36 Verified Questions

36 Flashcards

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

Sample Questions

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

A)True

B)False

Q2) Of the two classes,Cherry and Flavor,which would most likely be the subclass?

A) Cherry

B) Flavor

C) either one

D) neither; these are inappropriate class or subclass names

Q3) The term ___________ refers to an object's ability to take different forms.

Q4) An "is a" relationship exists between a grasshopper and a bumblebee.

A)True

B)False

Q5) Base classes are also called

A) superclasses

B) derived classes

C) subclasses

D) class instances

Q6) In an inheritance relationship,the extended class is called the __________.

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

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/48083

Sample Questions

Q1) The base case is the case in which the problem can be solved without A) loops

B) decisions

C) objects

D) recursion

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

A)True

B)False

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

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

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

Q6) Recursive function calls are __________ efficient than loops.

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

42 Verified Questions

42 Flashcards

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

Sample Questions

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

Q2) Which widget will display multiple lines of text?

A) Label

B) Canvas

C) Message

D) Text

Q3) __________ are small windows that display information and allow the user to perform actions.

Q4) To use the showinfo function,the tkinter.messagebox module must be imported.

A)True

B)False

Q5) The point (0,0)represents the same place in a window with the Canvas widget as with turtle graphics.

A)True

B)False

Q6) The acronym GUI stands for

A) Graphical User's Interface

B) Graphical User Interface

C) Graphical User Interaction

D) Graphical Union Interface

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