Fundamentals of Programming Mock Exam - 488 Verified Questions

Page 1


Fundamentals of Programming

Mock Exam

Course Introduction

Fundamentals of Programming introduces students to the core concepts and principles underlying computer programming. The course covers topics such as algorithms, control structures, data types, variables, input/output operations, and functions. Through hands-on practice, students will learn to write, test, and debug simple programs using a contemporary programming language. Emphasis is placed on logical thinking, problem-solving strategies, and the development of readable, maintainable code. The course serves as a foundation for more advanced studies in computer science and related disciplines.

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) Which computer language uses short words known as mnemonics for writing programs?

A) Assembly

B) Java

C) Pascal

D) Visual Basic.

Answer: A

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

A) DVD drive

B) solid state drive

C) floppy disk

D) hyper drive

Answer: B

Q3) Which language from the following list is referred to as a low-level language?

A) C++

B) Assembly language

C) JAVA

D) Python

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) The program development cycle is made up of _____ steps that are repeated until no errors can be found in the program.

A) five

B) four

C) three

D) six

Answer: A

Q2) The _______________ specifier is a special set of characters that specify how a value should be formatted.

Answer: Formatting

Q3) After the execution of the following statement, the variable sold will reference the numeric literal value as a(n) _____ data type: sold = 256.752

A) int

B) float

C) str

D) currency

Answer: B

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) A(n) _______________ expression is made up of two or more Boolean expressions.

Answer: compound

Q2) The not operator is a unary operator and it must be a compound expression.

A)True

B)False

Answer: False

Q3) A(n) _____ structure is a logical design that controls the order in which a set of statements execute.

A) function

B) control

C) sequence

D) iteration

Answer: B

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

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

Answer: conditionally

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

A)True

B)False

Q2) A better way to repeatedly perform an operation is to write the statements for the task once, and then place the statements in a loop that will repeat the statements as many times as necessary.

A)True

B)False

Q3) The first line in the while loop is referred to as the condition clause.

A)True

B)False

Q4) What is the structure that causes a statement or a set of statements to execute repeatedly?

A) Sequence

B) Decision

C) Module

D) Repetition

Q5) 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) Python function names follow the same rules for naming variables.

A)True

B)False

Q2) The _______________ chart is an effective tool that programmers use for designing and documenting functions.

Q3) A value-returning function has a(n) _______________ statement that returns a value back to the part of the program that called it.

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

A) flow

B) data

C) hierarchy

D) organizational

Q5) A(n) _______________ chart is a visual representation of the relationships between functions.

Q6) Arguments are passed by _______________ to the corresponding parameter variables in the function.

Q7) The return values of the trigonometric functions in Python are in _______________.

Q8) A variable is visible only to statements in the variable's _______________.

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

34 Verified Questions

34 Flashcards

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

Sample Questions

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

Q2) A(n) _______________ file contains data that has been encoded as text, using a scheme such as ASCII.

Q3) The term _______________ file is used to describe a file to which data is written.

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

A)True

B)False

Q5) Which mode specifier will erase the contents of a file if it already exists and create it if it does not exist?

A) 'w'

B) 'r'

C) 'a'

D) 'e'

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

35 Verified Questions

35 Flashcards

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

Sample Questions

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

A)True

B)False

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

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

Q4) The _______________ exception is raised when a search item is not in the list being searched.

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

A)True

B)False

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

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

Q8) What method can be used to convert a list to a tuple?

A) append

B) tuple

C) insert D) list

Q9) A(n) _______________ is an object that holds multiple items of data.

Q10) 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 is the return value of the string method lstrip()?

A) The string with all whitespace removed

B) The string with all leading spaces removed

C) The string with all leading tabs removed

D) The string with all leading whitespaces removed

Q2) What is the value of the variable string after the execution of the following code?

String = 'Hello'

String += ' world'

A) 'Hello'

B) ' world'

C) 'Hello world'

D) Invalid code

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

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

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

35 Verified Questions

35 Flashcards

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

Sample Questions

Q1) In order to avoid KeyError exceptions, you can check whether a key is in the dictionary using the _____ operator.

A) included

B) of

C) in

D) not in

Q2) In a dictionary, you use a(n) _____ to locate a specific value.

A) datum

B) element

C) item

D) key

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

Q4) Which method would you use to return the value associated with a specified key and remove that key-value pair from the dictionary?

A) list

B) items

C) popitem

D) pop

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

35 Verified Questions

35 Flashcards

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

Sample Questions

Q1) A class definition is stored in the library so that it can be imported into any program.

A)True

B)False

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

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

A)True

B)False

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

A)True

B)False

Q5) What is another name for the accessor methods?

A) Setters

B) Getters

C) Instances

D) Attributes

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

Q7) A(n) _______________ method in a class initializes an object's data attributes.

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

35 Verified Questions

35 Flashcards

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

Sample Questions

Q1) New attributes and methods may be added to a subclass.

A)True

B)False

Q2) Examine the following piece of code:

Class Potato (Vegetable):

In a UML diagram, what would the open arrowhead point to?

A) Potato

B) Vegetable

C) class

D) Potato(Vegetable)

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

A) Encapsulation

B) Domain

C) Methods

D) Inheritance

Q4) When a subclass method has the same name as a superclass method, it is often said that the subclass method _______________ the superclass method.

Q5) Superclasses are also called _______________ classes.

Q6) A subclass is also called a(n) _______________ class.

Q7) _______________ is used to create an 'is a' relationship among classes.

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

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) Each time a function is called, the system incurs _______________ that is not necessary with a loop.

Q2) Recursive algorithms are more concise and efficient than iterative algorithms.

A)True

B)False

Q3) The process of calling a function requires _____.

A) a long memory access

B) a quick memory access

C) several actions to be performed by the computer

D) one action to be performed by the computer

Q4) In many cases a solution using recursion is more evident than a solution using a loop.

A)True

B)False

Q5) A recursive function includes _____ which are not necessary in a loop structure.

A) function calls

B) conditional clauses

C) overhead actions

D) object instances

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 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) The _______________ module allows you to create GUI programs in Python.

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

A)True

B)False

Q3) Which widget will create an area that displays one line of text or an image?

A) Label

B) Frame

C) Canvas

D) Message

Q4) Python does not have GUI programming features built into the language itself.

A)True

B)False

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

Q6) What types of programs are event-driven?

A) GUI programs

B) Command line programs

C) Procedural programs

D) Modular programs

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

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