Principles of Programming Final Test Solutions - 533 Verified Questions

Page 1


Principles of Programming

Final Test Solutions

Course Introduction

Principles of Programming introduces the fundamental concepts and techniques used in computer programming. This course covers the essential building blocks of programming, including data types, control structures, functions, algorithms, and problem-solving strategies. Students will also explore different programming paradigms such as procedural, object-oriented, and functional programming. Through practical exercises and examples, learners will gain hands-on experience in writing, debugging, and analyzing code, laying a solid 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 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) Main memory is commonly known as __________.

Answer: random-access memory,RAM

Q3) What is the decimal value of the following binary number? 10011101

A) 157

B) 8

C) 156

D) 28

Answer: C

Q4) The term ___________ refers to all the physical devices that make up a computer.

Answer: hardware

Q5) RAM is a volatile memory used for temporary storage while a program is running. 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) A(n)__________ is a diagram that graphically depicts the steps that take place in a program?

A) flowchart

B) algorithm

C) source code

D) pseudocode

Answer: A

Q2) A(n)__________ character is a special character that is preceded with a backslash (\),appearing inside a string literal.

Answer: escape

Q3) In a print statement,you can set the __________ argument to a space or empty string to stop the output from advancing to a new line.

A) stop

B) end

C) separator

D) newLine

Answer: B

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. 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) Python uses the same symbols for the assignment operator as for the equality operator.

A)True

B)False

Answer: False

Q2) The decision structure that has two possible paths of execution is known as A) single alternative B) double alternative C) dual alternative D) two alternative

Answer: C

Q3) When using the __________ logical operator,one or both of the subexpressions must be true for the compound expression to be true. A) or B) and C) not D) maybe

Answer: A

Q4) The ___________ statement is used to create a decision structure.

Answer: if

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) Reducing duplication of code is one of the advantages of using a loop structure.

A)True

B)False

Q2) In Python,you would use the __________ statement to write a count-controlled loop.

Q3) Which of the following represents an example to calculate the sum of numbers (that is,an accumulator),given that the number is stored in the variable number and the total is stored in the variable total?

A) total + number = total

B) number += number

C) total += number

D) total = number

Q4) The acronym __________ refers to the fact that the computer cannot tell the difference between good data and bad data.

Q5) A variable used to keep a running total is called a(n)

A) accumulator

B) total

C) running total

D) summer

To view all questions and flashcards with answers, click on the resource link above. Page 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) A(n)__________ chart is a visual representation of the relationships between functions.

Q2) A(n)__________ chart is also known as a structured chart.

A) flow

B) data

C) hierarchy

D) organizational

Q3) The return values of the trigonometric functions in Python are in __________.

Q4) The main function contains a program's __________ logic which is the overall logic of the program.

Q5) In Python you can have a list of variables on the left side of the argument operator. A)True

B)False

Q6) A(n)__________ is any piece of data that is passed into a function when the function is called.

A) global variable

B) argument

C) local variable

D) parameter

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) Strings can be written directly to a file with the write method,but numbers must be converted to strings before they can be written.

A)True

B)False

Q2) Which of the following is the correct way to open a file named users.txt to write to it?

A) outfile = open('w', users.txt)

B) outfile = write('users.txt', 'w')

C) outfile = open('users.txt', 'w')

D) outfile = open('users.txt')

Q3) When a file has been opened using the 'r' mode specifier,which method will return the file's contents as a string?

A) write

B) input

C) get

D) read

Q4) Programmers usually refer to the process of __________ data in a file as writing data to the file.

Q5) When data is written to a file,it is described as a(n)__________ 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) Which method can be used to convert a list to a tuple?

A) append

B) tuple

C) insert

D) list

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

A) data

B) elements

C) items

D) values

Q3) Which of the following would you use if an element is to be removed from a specific index?

A) a del statement

B) a remove method

C) an index method

D) a slice method

Q4) The __________ function returns the item that has the lowest value in the sequence.

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

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) The __________ method returns a copy of the string with all the alphabetic letters converted to lower case.

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

A)True

B)False

Q3) What will be assigned to the string variable pattern after the following code executes?

I = 3

Pattern = 'z' * (5 * i)

A) 'zzzzzzzzzzzzzzz'

B) 'zzzzz'

C) 'z * 15'

D) Nothing; this code is invalid

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

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 10

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

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) If you try to retrieve a value from a dictionary using a nonexistent key,a KeyError exception is raised.

A)True

B)False

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

Q3) What is the value of the variable phones after the following code executes?

Phones = {'John' : '5555555','Julie' : '5557777'}

Phones['John'] = 5556666'

A) {'John' : '5555555', 'Julie' : '5557777'}

B) {'John' : '5556666', 'Julie' : '5557777'}

C) {'John' : '5556666'}

D) This code is invalid.

Q4) To determine whether or not a key is included in a dictionary,or if an element is included in a set,you can use the ___________ operator.

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

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

A)True

B)False

Q7) The __________ of two sets is a set that contains all the elements of both sets.

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) All class definitions are stored in the library so that they can be imported into any program.

A)True

B)False

Q2) All instances of a class share the same values of the data attributes in the class.

A)True

B)False

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

Q4) Procedures operate on data items that are separate from the procedures.

A)True

B)False

Q5) The self parameter need not be named self but it is strongly recommended to do so,to conform with standard practice.

A)True

B)False

Q6) In ___________ programming,the programming is centered on objects that are created from abstract data types that encapsulate data and functions together.

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

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

Q2) __________ has the ability to define a method in a subclass and then define a method with the same name in a superclass.

A) Inheritance

B) Encapsulation

C) Polymorphism

D) the 'is a' relationship

Q3) In the following line of code,what is the name of the subclass?

Class Rose(Flower):

A) Rose

B) Flower

C) Rose(Flower)

D) None of these

Q4) A subclass is also called a(n)__________ class.

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

Page 13

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) If a recursive solution is evident for a particular problem,and if the recursive algorithm does not slow system performance by an intolerable amount,then recursion would probably be a good design choice.

A)True

B)False

Q2) Recursive function calls are __________ efficient than loops.

Q3) When,in a recursive solution,function A calls function B which,in turn,calls function A,this is known as indirect recursion.

A)True

B)False

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

Q5) A function is called from the main function and then it calls itself five times. The depth of recursion is __________.

Q6) The base case does not require __________,so it stops the chain of recursive calls.

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

A)True

B)False

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) __________ are small windows that display information and allow the user to perform actions.

Q2) Which widget will display multiple lines of text?

A) Label

B) Canvas

C) Message

D) Text

Q3) In a(n)__________ interface,the user can determine the order in which things happen.

A) windows

B) command line

C) GUI

D) operating

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

Q5) The pack method determines where a widget should be positioned.

A)True

B)False

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

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

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

Turn static files into dynamic content formats.

Create a flipbook
Principles of Programming Final Test Solutions - 533 Verified Questions by Quizplus - Issuu