Programming Fundamentals Chapter Exam Questions - 1208 Verified Questions

Page 1


Programming Fundamentals

Chapter Exam Questions

Course Introduction

Programming Fundamentals introduces students to the foundational concepts of computer programming and problem-solving using high-level languages. The course covers core topics such as data types, variables, operators, control structures (selection and iteration), functions, arrays, and basic input/output operations. Emphasis is placed on algorithmic thinking, logical reasoning, and structured program development. Through hands-on exercises and projects, students will develop the skills necessary to write, debug, and test simple programs, preparing them for more advanced courses in computer science and software development.

Recommended Textbook

Java Programming 7th Edition by Joyce Farrell

Available Study Resources on Quizplus

17 Chapters

1208 Verified Questions

1208 Flashcards

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

Page 2

Chapter 1: Creating Java Programs

Available Study Resources on Quizplus for this Chatper

68 Verified Questions

68 Flashcards

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

Sample Questions

Q1) Whenever a method requires multiple arguments, the arguments are always separated with ____.

A) commas

B) periods

C) forward slashes

D) brackets

Answer: A

Q2) It is a tradition among programmers that the first program you write in any language produces "____" as its output.

A) Hi, your name!

B) Hello, world!

C) My first program!

D) Hello, your name!

Answer: B

Q3) It is best to use the ____ available text editor when writing Java programs.

A) most complex

B) simplest

C) best

D) latest

Answer: B

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

Chapter 2: Using Data

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

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

Sample Questions

Q1) public class YourGrade

{ public static void main(String[] args)

{ int projectPoints = 89; System.out.print("Your grade for this class is "); System.out.print(projectPoints); System.out.println("%"); } }

Given the above code, what will be the output at the command prompt?

Answer: Output will be as follows: Your grade for this class is 89% A blank line will follow the output.

Q2) You can create a confirm dialog box with five arguments. A)True

B)False

Answer: True

Q3) A(n) ____________________ is a simple data type. Answer: primitive type

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

Chapter 3: Using Methods, Classes, and Objects

Available Study Resources on Quizplus for this Chatper

68 Verified Questions

68 Flashcards

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

Sample Questions

Q1) An object is a ____ of a class.

A) constant

B) member

C) method

D) field

Answer: B

Q2) The first line of a method

A)return statement

B)header

C)instance variables

D)methods signature

E)formal parameters

F)static method

G)data fields

H)parameter type

I)class user

Answer: B

Q3) Access specifiers are also called access ____________________.

Answer: modifiers

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

Page 5

Chapter 4: More Object Concepts

Available Study Resources on Quizplus for this Chatper

67 Verified Questions

67 Flashcards

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

Sample Questions

Q1) When they have the same name, variables within ____ of a class override the class's fields.

A) packages

B) statements

C) fields

D) methods

Q2) You can use ____ arguments to initialize field values, but you can also use arguments for any other purpose.

A) object

B) constructor

C) data

D) field

Q3) If an integer is passed to a method with a double parameter, the double is promoted to an integer.

A)True

B)False

Q4) What is a reference and what is the meaning of the keyword this?

Q5) int aMethod(int x) void aMethod(int x)

In the above statements, explain why these two methods are illegal in the class.

Page 6

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

Chapter 5: Making Decisions

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

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

Sample Questions

Q1) Write a nested if statement that will check if the variable qtySold is greater than the QTY_QUOTA constant. If true, evaluate a second expression that will check if the variable totalSales is greater than the constant SALES_QUOTA. If the second expression is also true, create an assignment statement that will assign the constant BONUSAMT to the variable bonus. After BONUSAMT is assigned, the if structure ends.

Q2) A logical structure called a(n) ____ structure is when one step follows another unconditionally.

A) straight

B) decision

C) sequence

D) unconditional

Q3) Explain the difference between a single-alternative if structure and a dual-alternative if structure. When would it be necessary to use a dual-alternative if structure?

Q4) Why would a programmer execute more than one statement that depends on the evaluation of a Boolean expression, and how could he or she do it in Java?

Q5) Describe how a sequence structure works.

Q6) Why would a programmer need to use a range check? Give an example.

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

Chapter 6: Looping

Available Study Resources on Quizplus for this Chatper

72 Verified Questions

72 Flashcards

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

Sample Questions

Q1) A shortcut for incrementing and accumulating

A)prefix ++

B)block

C)definite loop

D)loop control variable

E)binary operators

F)loop fusion

G)decrementing

H)for loop

I)sleep() method

Q2) When loops are nested, each pair contains a(n) ____________________ loop and an outer loop.

Q3) You can initialize more than one variable in a for loop by placing a(n) ____ between the separate statements.

A) semicolon

B) equal sign

C) period

D) comma

Q4) Describe how a loop is controlled by a Boolean expression.

Q5) How are nested loops implemented in a loop structure?

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

Chapter 7: Characters, Strings, and the Stringbuilder

Available Study Resources on Quizplus for this Chatper

73 Verified Questions

73 Flashcards

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

Sample Questions

Q1) How can you use String methods to change the case of a string? Provide an example.

Q2) Methods that return information about an object are called accessor methods.

A)True

B)False

Q3) The String class ____________________ method is similar to the equals() method. As its name implies, this method ignores case when determining if two Strings are equivalent.

Q4) How can you change the length of a String in a StringBuilder object?

Q5) The ____ method lets you add characters at a specific location within a StringBuilder object.

A) charAt()

B) insert()

C) append()

D) setCharAt()

Q6) The terms "literal string" and "string literal" are entirely different in Java programming.

A)True

B)False

Q7) Explain what is needed to declare a String variable and provide an example.

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

Chapter 8: Arrays

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

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

Sample Questions

Q1) The length ____ contains the number of elements in the array.

A) box

B) field

C) area

D) block

Q2) An instance variable or object field is also called a(n) ____________________ of the object.

Q3) double[] studentScores; double studentScores[];

Are both of the above statements valid for declaring an array variable? Why or why not?

Q4) How can you use the enhanced for loop?

Q5) A ____ array is one with the same number of elements as another, and for which the values in corresponding elements are related.

A) cloned

B) parallel

C) property

D) two-dimensional

Q6) When any primitive type is passed to a method, the ____________________ is passed.

Page 10

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

Chapter 9: Advanced Array Concepts

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

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

Sample Questions

Q1) You can add an item at any point in a(n) ____ container and the array size expands automatically to accommodate the new item.

A) ArrayList

B) Array

C) ResizableArray

D) array

Q2) When you start with the object that has the largest value, you are sorting in ____________________ order.

Q3) double[][] empSales = new double[5][]; The above statement declares a(n) ____ array.

A) insertion

B) sort

C) ragged

D) boolean

Q4) Regarding enumerations, the ____ method returns an array of the enumerated constants.

A) valueOf

B) values

C) ordinal

D) toArray

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

Chapter 10: Introduction to Inheritance

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

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

Sample Questions

Q1) It is useful to override the parent class members when the superclass data fields and methods are not completely appropriate for the subclass objects.

A)True

B)False

Q2) A mechanism that enables one class to assume both the behavior and the attributes of another class

A)information hiding B)inheritance

C)super()

D)superclass

E)instanceof F)virtual method call

G)inlining

H)class diagram

I)derived class

Q3) When you instantiate an object that is a member of a subclass, how many constructors are called?

Q4) What are the parts of a class diagram and how would you use them?

Q5) The term ____________________ means "many forms."

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

Chapter 11: Advanced Inheritance Concepts

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

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

Sample Questions

Q1) public abstract class Shape

{ private int length; private int width; private int height;

}

Using the above code, create the statement in the shaded line that will create an abstract calculateArea() method in the abstract Shape class.

Q2) The java.lang package contains the Object class and is imported automatically each time a program is written.

A)True

B)False

Q3) What is the toString() method used for and how is it used?

Q4) Describe the two method types programmers of an abstract class can include.

Q5) In other programming languages, such as C++, abstract classes are known as ____________________ classes.

Q6) How is the Object class equals() method implemented?

Q7) Why do many programmers consider multiple inheritance to be a difficult concept?

Page 13

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

Chapter 12: Exception Handling

Available Study Resources on Quizplus for this Chatper

65 Verified Questions

65 Flashcards

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

Sample Questions

Q1) To use a method to its full potential, you must know the method name, return type, type and number of arguments required, and type and number of exceptions the method throws.

A)True

B)False

Q2) The keyword catch followed by an Exception type in the method header is used when a method throws an exception that it will not catch but that will be caught by a different method.

A)True

B)False

Q3) When you have actions you must perform at the end of a try catch sequence, you can use a ____ block.

A) finally

B) catch

C) throw

D) try

Q4) The code within a finally block cannot execute if the preceding try block identifies an exception.

A)True

B)False

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

Chapter 13: File Input and Output

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

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

Sample Questions

Q1) import java.util.Scanner; import java.nio.file.*; public class PathDemo2

{ public static void main(String[] args)

{ String name; Scanner keyboard = new Scanner(System.in); System.out.print("Enter a file name >> "); name = keyboard.nextLine(); Path inputPath = Paths.get(name);

System.out.println("Full path is " + fullPath.toString()); } }

Using the above code, complete the shaded line with a statement that creates an absolute path by assigning the file to the current directory.

Q2) What is the difference between volatile and nonvolatile storage in Java programming? Give examples of different storage situations.

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

Chapter 14: Introduction to Swing Components

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

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

Sample Questions

Q1) Require interaction with the local operating system

A)point size

B)layout manager

C)lightweight components

D)window decorations

E)editable

F)tool tips

G)heavyweight components

H)fonts

I)event handler

Q2) Write the code to build a JComboBox named sideDish with no arguments. Then, create the addItem() methods to provide options for "Fries", "Salad", and "Fruit".

Q3) Create the statements to construct two JFrames. One JFrame should be declared as welcomeFrame and have the title "Welcome", and the second JFrame should be declared as noTitleFrame and have no title.

Q4) Write the statement to create a layout manager named myLayout that centers components in each row.

Q5) Write the statement to add a tool tip that displays "Submit your form" to a button named submit.

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

Chapter 15: Advanced Gui Topics

Available Study Resources on Quizplus for this Chatper

69 Verified Questions

69 Flashcards

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

Sample Questions

Q1) When components in a Swing UI require more display area than they have been allocated, you can use a ____ container to hold the components and allow the user to display the components using scroll bars.

A) JScrollingPane

B) ScrollLayout

C) JPanel

D) JScrollPane

Q2) What is a mnemonic? Provide an example of adding a mnemonic.

Q3) If you do not specify alignment, Components are right-aligned in a FlowLayout Container by default.

A)True

B)False

Q4) The ____________________ manager is the default manager class for all content panes.

Q5) A(n) _________________________ is a tree of components that has a top-level container as its root (that is, at its uppermost level).

Q6) List and describe the four constructors that can be used when creating a JPanel object.

Q7) Describe the difference between an ActionEvent and a MouseEvent.

Page 17

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

Chapter 16: Graphics

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

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

Sample Questions

Q1) ____ is the amount of space between the bottom of the descent of one line and the top of the characters in the successive line of type.

A) Descent

B) Ascent

C) Leading

D) Height of a line

Q2) Works best with lighter drawing colors

A)fill pattern

B)GREEN

C)acyclic gradient

D)3D method

E)Line2D.Float class

F)fillPolygon()

G)getScreenResolution()

H)GeneralPath

I)descent

Q3) List the six arguments you need to provide for the drawArc() method.

Q4) Why would a programmer use the repaint() method?

Q5) How do you use the drawOval() method to draw an oval?

Q6) What are the constructors for the Dimension class?

Page 18

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

Chapter 17: Applets, Images, and Sound

Available Study Resources on Quizplus for this Chatper

72 Verified Questions

72 Flashcards

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

Sample Questions

Q1) The applet can be run within a page on the Internet or an intranet, but you do not have to connect to the Internet to run an applet in your browser-you can simply use the browser locally.

A)True

B)False

Q2) The tag that begins every HTML document is ____.

A) <object>

B) <browser>

C) <doc>

D) <html>

Q3) The ____ method is used to load an Image into the named Image in the applet.

A) get()

B) loadImage()

C) load()

D) getImage()

Q4) Applets can delete, read, or create files on the user's system.

A)True

B)False

Q5) What are the two forms of the play() method?

Q6) How do you view an applet?

Page 19

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

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Programming Fundamentals Chapter Exam Questions - 1208 Verified Questions by Quizplus - Issuu