Foundations of Programming Practice Questions - 488 Verified Questions

Page 1


Foundations of Programming Practice Questions

Course Introduction

This course introduces the essential concepts and principles of programming, providing students with a solid foundation in problem-solving, algorithm development, and software design. Students will learn to write, test, and debug code using a modern programming language, exploring key topics such as variables, data types, control structures, functions, and object-oriented programming basics. By engaging in hands-on exercises and projects, learners will develop practical coding skills and a clear understanding of computational thinking, preparing them for more advanced study in computer science and software development.

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 instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.

A)True

B)False

Answer: True

Q2) The CPU is able to quickly access data stored at any random location in ROM.

A)True

B)False

Answer: False

Q3) The _______________ is the part of a computer that actually runs programs and is the most important component in a computer.

Answer: central processing unit or CPU

Q4) Which of the following is not a microprocessor manufacturing company?

A) Intel

B) Dell

C) AMD

D) Motorola

Answer: B

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) A(n) _______________ character is a special character that is preceded with a backslash, appearing inside a string literal.

Answer: escape

Q2) What is the informal language that programmers use to create models of programs that have no syntax rules and are not meant to be compiled or executed?

A) Flowchart

B) Algorithm

C) Code

D) Pseudocode

Answer: D

Q3) The output of the following print statement is:

Print 'I\'m ready to begin'

A) Im ready to begin

B) I\'m ready to begin

C) I'm ready to begin

D) 'I\'m ready to begin'

Answer: C

Q4) The result of the expression 12.3 + 6.7 is _______________.

Answer: 19.0

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) In Python, the _____ symbol is used as the not-equal-to operator.

A) ==

B) <>

C) <=

D) !=

Answer: D

Q2) Nested decision structures are one way to test more than one condition.

A)True

B)False

Answer: True

Q3) The if statement causes one or more statements to execute only when a Boolean expression is true.

A)True

B)False

Answer: True

Q4) In a decision structure, the action is _______________ executed because it is performed only when a certain condition is true.

Answer: conditionally

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) _____ is the process of inspecting data that has been input to a program to make sure it is valid before it is used in a computation.

A) Input validation

B) Correcting data

C) Data validation

D) Correcting input

Q2) What is not an example of an augmented assignment operator?

A) *=

B) /=

C) -=

D) <=

Q3) In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called a _____.

A) sequence

B) variable

C) value

D) list

Q4) In Python, you would use the _______________ statement to write a count-controlled 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) The function header marks the beginning of the function definition.

A)True

B)False

Q2) A set of statements that belong together as a group and contribute to the function definition is known as a(n) _____.

A) header

B) block

C) return

D) parameter

Q3) What is the result of the following statement?

X = random.randint(5, 15) * 2

A) A random integer from 5 to 15, multiplied by 2, assigned to the variable x

B) A random integer from 5 to 15 assigned to the variable x

C) A random integer from 5 to 15, selected in 2 steps, assigned to the variable x

D) A random integer from 5 to 15, raised to the power of 2, assigned to the variable x

Q4) The math function, atan(x), returns one tangent of x in radians.

A)True

B)False

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) Programmers usually refer to the process of _______________ data in a file as "writing data to" the file.

Q2) A filename _______________ is a short sequence of characters that appear at the end of a filename preceded by a period.

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

A) Filename

B) Extension

C) File object

D) File variable

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

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

Q6) A(n) _______________ includes one or more statements that can potentially raise an exception.

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) What method can be used to convert a list to a tuple?

A) append

B) tuple

C) insert

D) list

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

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

A)True

B)False

Q4) A(n) _______________ is a span of items that are taken from a sequence.

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

A)True

B)False

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

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

Q8) The built-in function _______________ returns the length of a sequence.

Q9) Lists are _______________, which means their elements can be changed. 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

35 Verified Questions

35 Flashcards

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

Sample Questions

Q1) What will be assigned to s_string after the execution of the following code?

Special = '1357 Country Ln.'

S_string = special[4: ]

A) '1357'

B) 'Country Ln.'

C) ' Country Ln.'

D) Invalid code

Q2) The third number in string slicing brackets represents the _______________ value.

Q3) The _______________ method returns a copy of the string with all alphabetic letters converted to lower case.

Q4) What are the valid indexes for the string 'New York'?

A) 0 through 7

B) 0 through 8

C) -1 through -8

D) -1 through 6

Q5) A(n) _______________ exception will occur if you try to use an index that is out of range for a particular string.

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

Page 11

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

35 Verified Questions

35 Flashcards

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

Sample Questions

Q1) The issubset method can be used to determine whether set1 is a subset of set2.

A)True

B)False

Q2) The built-in function _______________ returns the number of items in a set.

Q3) What is the process used to convert an object to a stream of bytes that can be saved in a file?

A) Pickling

B) Streaming

C) Writing

D) Dumping

Q4) 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 - no two elements can have the same value.

C) The elements are unordered.

D) The elements are pairs.

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

A)True

B)False

Q6) To add a single item to a set, you can use the set method _______________.

Page 12

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

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) Object-oriented programming allows us to hide the object's data attributes from code that is outside the object.

A)True

B)False

Q2) What is, conceptually, a self-contained unit that consists of data attributes and methods that operate on the data attributes?

A) Class

B) Object

C) Instance

D) Module

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

A) __state__

B) __obj__

C) __str__

D) __init__

Q4) In a UML diagram, the middle section holds the list of the class's methods.

A)True

B)False

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

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

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

A)True

B)False

Q3) Polymorphism works on any two class methods that have the same name. A)True

B)False

Q4) In a UML diagram depicting inheritance, you only write the name of the subclass. A)True

B)False

Q5) In an inheritance relationship, a television is a(n) _______________ of the electronics class.

Q6) New attributes and methods may be added to a subclass. 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/20932

Sample Questions

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

A)True

B)False

Q2) All the cases of the recursive solution other than the base case are called the _______________ case.

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

A) Eight B) Two C) One D) Seven

Q4) Usually, a problem is reduced by making the value of one or more parameters _______________ with each recursive call.

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

A)True B)False

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

Page 15

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) Using the radio buttons, the user can make multiple selections at one time.

A)True

B)False

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

A)True

B)False

Q3) GUI programs respond to the actions of the user, and so they are called _______________ programs.

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

Q5) How many graphical widgets does the tkinter module provide?

A) Five

B) Ten

C) Fifteen

D) Twenty

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

A)True

B)False

Q7) The GUI popularized the use of the _______________ as an input device.

Page 16

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

Turn static files into dynamic content formats.

CreateΒ aΒ flipbook