Skip to main content

Introduction to Programming Final Exam - 758 Verified Questions

Page 1


Introduction to Programming Final Exam

Course Introduction

Introduction to Programming is a foundational course designed to teach students the core concepts of computer programming using a high-level language such as Python or Java. The course emphasizes problem-solving techniques, algorithmic thinking, and structured programming principles. Students will learn about basic data types, control structures, functions, loops, conditionals, and simple data structures. Through hands-on coding exercises and projects, learners will develop the skills necessary to write, test, and debug simple programs, preparing them for further study in computer science and related fields.

Recommended Textbook

Absolute Java 5th Edition by Walter Savitch

Available Study Resources on Quizplus

20 Chapters

758 Verified Questions

758 Flashcards

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

Page 2

Chapter 1: Getting Started

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) The Java programming language allows you to concatenate two strings using the plus sign.

A)True

B)False

Answer: True

Q2) The result of integer division is truncated in Java.

A)True

B)False

Answer: True

Q3) Java uses the ASCII character set.

A)True

B)False

Answer: False

Q4) The syntax that declares a Java named constant named SALES_TAX is:

A)double SALES_TAX = 7.50;

B)public double SALES_TAX = 7.50;

C)public static double SALES_TAX = 7.50;

D)public static final double SALES_TAX = 7.50;

Answer: D

Page 3

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

Chapter 2: Console Input and Output

Available Study Resources on Quizplus for this Chatper

29 Verified Questions

29 Flashcards

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

Sample Questions

Q1) Why is echoing user input a good programming practice?

Answer: Echoing input is a technique that is commonly used to allow the user to check their input for accuracy before it is actually sent to the program for processing.This technique reduces the chances of errors in the program.

Q2) What does it mean to prompt the user?

Answer: Prompting the user means to display a meaningful message to the user asking for some type of input.An example of prompting the user would be displaying a JOptionPane to ask the user to input their name.

Q3) If a hyphen is added after the % in a format specifier,the output will be _________.

A)Left justified

B)Right justified

C)Centered

D)None of the above

Answer: A

Q4) Write a Java statement to create and initialize a Scanner object named input.

Answer: Scanner input = new Scanner(System.in);

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

4

Chapter 3: Flow of Control

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) What is short-circuit evaluation of Boolean expressions?

Answer: Short-circuit evaluation is a mechanism in Java that allows the early termination of the evaluation of a compound Boolean expression.This occurs when two Boolean expressions are joined by the && operator when the first expression evaluates to false.The evaluation short-circuits because no matter what the value of the second expression is,the expression will evaluate to false.When two Boolean expressions are joined by the || operator,if the first expression evaluates to true,then the evaluation will short circuit because the expression will always evaluate to true no matter what the second expression evaluates to.

Q2) The ____________ operator has the highest precedence. A)* B)dot C)+= D)decrement

Answer: B

Q3) Write Java code that uses a while loop to print even numbers from 2 through 10.

Answer: int evenNumber = 2; while(evenNumber <= 10) { System.out.println(evenNumber); evenNumber += 2; }

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

Page 5

Chapter 4: Defining Classes I

Available Study Resources on Quizplus for this Chatper

44 Verified Questions

44 Flashcards

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

Sample Questions

Q1) Write a method called power the computes x<sup>n</sup> where x and n and positive integers.The method has two integer parameters and returns a value of type long.

Q2) Write a method called Greeting that displays a personalized greeting given a first name.

Q3) A variable whose meaning is confined to a method definition is called an/a

A)instance variable

B)local variable

C)global variable

D)none of the above

Q4) A more eloquent approach in implementing mutator methods is to return a ________ value.

A)int

B)char

C)boolean

D)double

Q5) Java supports operator overloading.

A)True

B)False

Q6) Write a driver program to test your Student class created in question #14.

Page 6

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

Chapter 5: Defining Classes Ii

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) What is the purpose of Java's wrapper classes?

Q2) A main method can be placed inside a class definition.

A)True

B)False

Q3) Does an object created with a copy constructor reference the same memory location that the original object references? Explain.

Q4) The String class is a mutable class.

A)True

B)False

Q5) All of the following are wrapper classes except:

A)String

B)Integer

C)Character

D)Double

Q6) A bit may have the value of either a 1 or 0.

A)True

B)False

Q7) Write ONE Java statement that computes and displays a random number between 1 and 25.

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

Q8) Write ONE Java statement that computes and displays the value of 2<sup>5</sup>.

Chapter 6: Arrays

Available Study Resources on Quizplus for this Chatper

47 Verified Questions

47 Flashcards

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

Sample Questions

Q1) Write a Java statement that declares and creates an array of Strings named Breeds.Your array should be large enough to hold the names of 100 dog breeds.

Q2) The correct syntax for accessing the length of an array named Numbers is:

A)Numbers.length()

B)Numbers.length

C)both A and B

D)none of the above

Q3) The individual variables that together make up the array are referred to as:

A)indexed variables

B)subscripted variables

C)elements of the array

D)all of the above

Q4) How are arrays tested to see if they contain the same contents?

Q5) Arrays are objects that are created with new just like class objects.

A)True

B)False

Q6) A collection class is a class whose objects store a collection of values.

A)True

B)False

Q7) Explain what the main methods array parameter,args,is used for.

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

Chapter 7: Inheritance

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) Inheritance is the process by which a new class - known as a _________ - is created from another class,called the _____________.

A)base class,derived class

B)derived class,base class

C)inherited class,base class

D)base class,inherited class

Q2) What is an "is a" relationship? How does it apply to the world of objects?

Q3) An instance variable (or method)that is private in a base class is accessible by name in the definition of a method in any other class.

A)True

B)False

Q4) What is a "has a" relationship?

Q5) The keyword extends indicates polymorphism.

A)True

B)False

Q6) Overriding is when a derived class redefines a method from the base class.

A)True

B)False

Q7) What does the instanceof operator do?

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

Chapter 8: Console Input and Output

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) A class with no abstract methods is called a A)concrete class

B)encapsulated class

C)abstract class

D)private class

Q2) An abstract class must have the modifier ___________ included in the class heading.

A)static

B)abstract

C)final

D)private

Q3) Write a decision statement to determine if an object should be downcast.

Q4) The principals of object oriented programming include:

A)encapsulation

B)inheritance

C)polymorphism

D)all of the above

Q5) Java allows an instance of an abstract class to be instantiated.

A)True

B)False

Page 10

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

Chapter 9: Exception Handling

Available Study Resources on Quizplus for this Chatper

45 Verified Questions

45 Flashcards

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

Sample Questions

Q1) A runtime exception is a/an:

A)checked exception

B)unchecked exception

C)offending exception

D)none of the above

Q2) The catch block has ________ parameters.

A)zero

B)one

C)two

D)three

Q3) The throw operator causes a change in the flow of control.

A)True

B)False

Q4) ArrayIndexOutOfBoundsException is a descendent of the class

RuntimeException.This means:

A)the exception must be caught

B)a finally block must be included

C)the exception does not have to be explicitly caught

D)none of the above

Q5) What is the purpose of the finally block?

11

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

Chapter 10: File IO

Available Study Resources on Quizplus for this Chatper

46 Verified Questions

46 Flashcards

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

Sample Questions

Q1) Write a Java statement that creates a stream that provides read/write access to the file named autos.txt.

Q2) The preferred stream classes for processing binary files are ObjectInputStream and ObjectOutputStream.

A)True

B)False

Q3) Use the output stream to the file autos.txt created above in number 2 to write the line "Mercedes" to the file.

Q4) The output stream connected to the computer screen is:

A)System.exit

B)System.quit

C)System.in

D)System.out

Q5) Every input file and every output file used by your program has only one name which is the same name used by the operating system.

A)True

B)False

Q6) Write a Java statement to create an input stream to a file named "statistics.dat".

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

Chapter 12: Uml and Patterns

Available Study Resources on Quizplus for this Chatper

22 Verified Questions

22 Flashcards

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

Sample Questions

Q1) Draw a UML class diagram for a class that represents a savings account.

Q2) Draw a UML inheritance diagram for possible classes used to represent a bank account.

Q3) Class diagrams must contain all class members.

A)True

B)False

Q4) Pseudocode is a mixture of programming language and English.

A)True

B)False

Q5) UML was designed to be used with structured programming methodology.

A)True

B)False

Q6) In a UML class diagram,the sharp (#)indicates:

A)public access

B)protected access

C)private access

D)package access

Q7) Define pseudocode.

Page 13

Q8) Draw a UML class diagram for a class that represents a sphere.

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

Chapter 13: Interfaces and Inner Classes

Available Study Resources on Quizplus for this Chatper

32 Verified Questions

32 Flashcards

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

Sample Questions

Q1) A class that implements an interface but only gives definitions for some of the method headings given in the interface is called a/an:

A)concrete class

B)abstract class

C)discrete class

D)friendly class

Q2) A common use of inner classes is :

A)clean up

B)set up

C)helper

D)all of the above

Q3) Java source code that contains a class with an inner class,when compiled,will produce a separate .class file for the inner class.

A)True

B)False

Q4) The Serializable interface is like all the other Java interfaces in that it contains defined constants and method headings.

A)True

B)False

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

Chapter 14: Generics and the Arraylist Class

Available Study Resources on Quizplus for this Chatper

31 Verified Questions

31 Flashcards

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

Sample Questions

Q1) The compiler option -Xlint is good for debugging.

A)True

B)False

Q2) Inheritance is the reason why some parameters of the ArrayList class are of type

Base_Type and others of type Object.

A)True

B)False

Q3) All of the following are search methods of the ArrayList class except:

A)isEmpty()

B)lastIndexOf()

C)indexOf()

D)contains()

Q4) You can plug in a primitive type for a type parameter.

A)True

B)False

Q5) The Type parameter is always indicated as a T.

A)True

B)False

Q6) Write Java statements to display the size of the resulting ArrayList from question 5 above.

Page 15

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

Chapter 15: Linked Data Structures

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) Redraw the diagram created in number 4 above after deleting the head node.

Q2) A deep copy of an object is a copy that has references in common with the original object.

A)True

B)False

Q3) What is the result of a preorder traversal of the binary search tree created in question 12 above?

Q4) Recursively visiting the root node,left subtree and then the right subtree describes:

A)preorder processing

B)inorder processing

C)postorder processing

D)none of the above

Q5) The first node in a linked list is commonly referred to as the ________ node.

A)head

B)tail

C)predecessor

D)successor

Q6) What is the function of the variable head when used with a linked list? What is the data type of the head variable?

Page 16

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

Chapter 16: Collections and Iterators

Available Study Resources on Quizplus for this Chatper

44 Verified Questions

44 Flashcards

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

Sample Questions

Q1) Create a for loop to initially set the values of the vector created in number 1 above to the value of negative 1.0.

Q2) The interface SortedSet and the concrete class _________ is designed for implementations of the Set interface that provide for rapid retrieval of elements.

A)Vector< T >

B)LinkedList< T >

C)HashSet< T >

D)TreeSet< T >

Q3) The method ___________ can be used to determine the number of elements in an ArrayList.

A)length()

B)vectorLength()

C)size()

D)vectorSize()

Q4) When an interface lists a method as "optional," you do not need to implement it when defining a class that implements the interface.

A)True

B)False

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

17

Chapter 17: Swing I

Available Study Resources on Quizplus for this Chatper

37 Verified Questions

37 Flashcards

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

Sample Questions

Q1) Write a Java statement to create a menu with the title "Drawing Template".

Q2) GUIs are windowing interfaces that handle user input and output.

A)True

B)False

Q3) Write Java statements to add menu items named "Circle","Square",and "Rectangle" to the menu created in number 7 above.

Q4) The getText()method of a JTextField object returns an object of type:

A)Double

B)Integer

C)Boolean

D)String

Q5) Standard layout managers are defined in the ____________ package.

A)javax.swing

B)java.util

C)java.awt

D)java.lang

Q6) The actionPerformed method of the ActionListener interface returns a Boolean value. A)True

B)False

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

Chapter 18: Swing II

Available Study Resources on Quizplus for this Chatper

31 Verified Questions

31 Flashcards

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

Sample Questions

Q1) Java uses a coordinate system whose origin point (0,0)is located at the upper-left corner of the screen area.

A)True

B)False

Q2) An imaginary _____________ is used for drawing all shapes on the screen.

A)bounding box

B)view port

C)container

D)none of the above

Q3) The class JColorChooser can be used to produce a dialog window that allows you to choose a color by looking at color samples.

A)True

B)False

Q4) Write a Java statement that uses a Graphics object to display "Hello World" at position 50,100.

Q5) Write Java statements to add the icon created in number 1 above to a label that says "Love".

Q6) Write a Java statement that draws a filled oval at position (150,100)with a height of 100 and a width of 50.

Page 19

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

Chapter 19: Java Never Ends

Available Study Resources on Quizplus for this Chatper

18 Verified Questions

18 Flashcards

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

Sample Questions

Q1) A thread's start method invokes the thread's run method.

A)True

B)False

Q2) Threads execute in a ___________ fashion.

A)parallel

B)serial

C)complex

D)none of the above

Q3) ____________ refers to a framework that facilitates software building by connecting software components from diverse sources.

A)JavaBeans

B)Threads

C)SQL

D)all of the above

Q4) An InterruptedException is a checked exception.

A)True

B)False

Q5) What is a JavaBean?

Q6) Discuss the components of the JavaBean model.

Q7) What are Enterprise JavaBeans?

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

Chapter 11: Recursion

Available Study Resources on Quizplus for this Chatper

43 Verified Questions

43 Flashcards

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

Sample Questions

Q1) How does the computer system handle a recursive method call?

Q2) What is an activation record?

Q3) Write a recursive method to print a string backwards.

Q4) Explain how a sequential search works.

Q5) The underlying data structure used by the computer during recursion is a:

A)queue

B)linked list

C)tree

D)stack

Q6) A base case must include a recursive call.

A)True

B)False

Q7) All recursive methods must have a/an:

A)starting case

B)intermediate case

C)stopping case

D)none of the above

Q8) What is a base case?

Q9) Explain how the binary search works.

Q10) What is a stack overflow? Page 21

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

Page 22

Chapter 20: Applets

Available Study Resources on Quizplus for this Chatper

25 Verified Questions

25 Flashcards

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

Sample Questions

Q1) HTML stands for:

A)Hyperlink Making Language

B)Hyper Markup Language

C)Hypertext Markup Language

D)Homepage Markup Language

Q2) Write an HTML statement to create a hyperlink to HYPERLINK "http://www.java.sun.com" www.java.sun.com.The link should read "Java Doc".

Q3) Applets normally do not contain a main method.

A)True

B)False

Q4) The class ___________ converts a digital picture to an icon for us in an applet.

A)ImageIcon

B)JAppletIcon

C)IconImage

D)IconJApplet

Q5) The purpose of the address tag is to contain the e-mail address for contacting the document's maintainer as well as the date that the document was last modified.

A)True

B)False

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

Turn static files into dynamic content formats.

Create a flipbook
Introduction to Programming Final Exam - 758 Verified Questions by Quizplus - Issuu