Introduction to Programming Exam Materials - 1208 Verified Questions

Page 1


Introduction to Programming

Exam Materials

Course Introduction

Introduction to Programming provides students with foundational knowledge and practical skills for writing computer programs. The course introduces core programming concepts such as variables, data types, control structures (such as loops and conditionals), functions, and basic data structures. Through hands-on exercises and projects, students learn to solve problems methodically and develop logical thinking. Emphasis is placed on writing clear, well-documented code and understanding how software is created, debugged, and maintained. By the end of the course, students will be able to design, implement, and test simple programs using a contemporary programming language.

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) A(n) ____ defines the circumstances under which a class can be accessed and the other classes that have the right to use a class.

A) identifier

B) access specifier

C) parameter

D) Pascal casing

Answer: B

Q2) A low-level programming language

A)literal string

B)high-level programming languages

C)dialog box

D)syntax

E)whitespace

F)compiler

G)attributes

H)Machine language

I)Java virtual machine (JVM)

Answer: H

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) You may declare an unlimited number of variables in a statement as long as the variables are ____.

A) the same data type

B) initialized to the same value

C) properly commented

D) floating point numbers

Answer: A

Q2) A(n) ____ variable can hold only one of two values: true or false.

A) integer

B) boolean

C) true

D) comparison

Answer: B

Q3) You use the ____ data type to hold any single character.

A) single

B) char

C) byte

D) float

Answer: B

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) Parentheses - may contain data to be sent to the method, but may be empty if no outside data is required

Answer: The predictRaise method calls the calculateBonus() method. However, you do not know how the calculateBonus() method actually works. You only know that it accepts a double as a parameter (because newAmount is passed into it) and that it must return either a double or a type that can automatically be promoted to a double. In this way, the method acts as a black box.

Q2) When a variable ceases to exist at the end of a method, programmers say the variable ____.

A) is undeclared

B) is out of memory range

C) goes out of scope

D) is lost

Answer: C

Q3) Access specifiers are also called access ____________________.

Answer: modifiers

Q4) A(n) ____________________ is a number appended to a field, typically an ID number or account number.

Answer: check-digit

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) Another name for a nonstatic member class is a(n) ____.

A) static member class

B) inner class

C) local class

D) anonymous class

Q2) Describe and provide an example of overloading.

Q3) public class StudentScores

{ private int ScoreOne; private int ScoreTwo; private int ScoreThree;

Using the code above, fill in the blank lines provided to create a constructor that will require parameters for the three score data fields. Be sure to include the necessary brackets and semicolons.

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

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) A double equal sign

A)relational operator

B)conditional operator

C)Boolean values

D)equality

E)switch statement

F)pipes

G)dual-alternative

H)!

I)AND operator

Q2) When you place a block within an if statement, it is crucial to place the ____ correctly.

A) periods

B) angle brackets

C) commas

D) curly braces

Q3) Why do programmers use pseudocode?

Q4) You are never required to use a switch structure; you can always achieve the same results with nested ____________________ statements.

Q5) Describe how a sequence structure works.

Page 7

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

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) A counter-controlled loop

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

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) What is the purpose of the substring() method and how do you use it?

Q2) Determines whether a specific character occurs within a String

A)parseDouble()

B)toLowerCase()

C)substring()

D)String variable

E)append()

F)buffer

G)setLength()

H)indexOf()

I)insert()

Q3) The String class ____ method evaluates the contents of two String objects to determine if they are equivalent.

A) equals()

B) toString()

C) charAt()

D) replace()

Q4) Why would you use the append() method? Provide an example.

Q5) What is a wrapper and why would you use it?

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

Page 9

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

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) When any ____ type (boolean, char, byte, short, int, long, float, or double) is passed to a method, the value is passed.

A) array

B) dummy

C) element

D) primitive

Q2) You use a ____ following the closing brace of an array initialization list.

A) .

B) ;

C) :

D) ,

Q3) A(n) ____________________ is a named list of data items that all have the same type.

Q4) When working with arrays, why is it beneficial to use a loop with a declared symbolic constant equal to the size of the array?

Q5) When populating an array with an initialization list, you do not need to use the new keyword or provide an array size. Explain why this is the case.

Q6) Write the statement to declare an array of integers that will hold studentScores.

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

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) Regarding enumerations, the ____ method returns the name of the calling constant object.

A) toString

B) constName

C) ordinal

D) nameOf

Q2) How can you sort arrays of objects?

Q3) You can think of the single dimension of a single dimensional array as the height of the array.

A)True

B)False

Q4) int[][] myVals = {{2, 4, 6}, {1, 3, 5, 7}}; Using the above array, what is the value of myVals.length?

A) 1

B) 2

C) 4

D) 5

Q5) The Arrays class ____________________ method assigns the specified value to each element of the specified array.

Q6) What are some of the advantages of the ArrayList class over the Arrays class?

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) What are virtual method calls?

Q2) You are never aware that ____ is taking place; the compiler chooses to use this procedure to save the overhead of calling a method.

A) information hiding

B) polymorphism

C) overriding

D) inlining

Q3) The classes you create in ____________________ programming languages can inherit data and methods from existing classes.

Q4) Sometimes the superclass data fields and methods are not entirely appropriate for the subclass objects; in these cases, you want to ____ the parent class members.

A) negate

B) overrule

C) override

D) hide

Q5) What does polymorphism mean in Java programming?

Q6) How are real-life examples of inheritance similar to object-oriented programming inheritance?

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) In the Java programming language, a package or class library is often delivered to users as a(n) ____________________ file.

Q2) Java does not allow a class to inherit directly from two or more parents.

A)True

B)False

Q3) When you create a new subclass in Java, neither the superclass source code nor the superclass _____ is changed.

A) bytecode

B) object

C) argument

D) possession

Q4) The ___ method is useful in debugging a program because it can be used to display and examine values.

A) finalize()

B) toString()

C) notify()

D) equals()

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

Q6) What is an abstract class? Give an example and explain how it works.

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) What is the correct syntax of an assert statement?

A) assert AssertionError : optionalErrorMessage

B) assert booleanExpression : optionalErrorMessage

C) assert stringExpression : optionalErrorMessage

D) assert booleanExpression = optionalErrorMessage

Q2) Placing data conversion attempts in a try block allows you to handle potential data conversion errors caused by careless user entry.

A)True

B)False

Q3) Constructs a new exception with the specified detail message

A)Throwable

B)Exception(String message)

C)exception handling

D)syntactic salt

E)mission critical

F)Exception(Throwable cause)

G)fault-tolerant

H)assert statement

I)try block

Q4) What is an Exception class? Give an example.

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) You can use Java's ____ class to create objects that contain information about files or directories, such as their locations, sizes, creation dates, and whether they even exist.

A) Directory

B) Property

C) Path

D) File

Q2) Java's Path class is used to create objects that contain information about files and directories, while the Files class performs operations on files and directories.

A)True

B)False

Q3) How can you write the system's newline character to a file in Java?

Q4) When you use the BufferedReader class, you must import the ____ package into your program.

A) java.nio.file

B) java.io

C) java.nio

D) java.io.input

Q5) Random files are also called ____________________ files.

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) Within an event-driven program, a component on which an event is generated is the ____ of the event.

A) handler

B) driver

C) listener

D) source

Q2) What are the four JFrame constructors?

Q3) An object that is interested in an event is called a source.

A)True

B)False

Q4) When creating a Font object, the typeface name must be enclosed in double quotation marks because it is a String.

A)True

B)False

Q5) Write the statement to create a JCheckBox object named feeWaived that is selected. Include the label "Fee Waived".

Q6) Write the statement to create a JLabel named welcome that holds the words "Welcome Home".

Q7) Write the statement to clear out a JTextField named myText.

Page 16

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

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) The state of a JCheckBoxMenuItem or JRadioButtonMenuItem can be determined with the ____ method.

A) state()

B) getState()

C) getSelected()

D) isSelected()

Q2) You use the ____________________ interface when you are interested in actions the user initiates from the keyboard.

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

A)True

B)False

Q4) The following statement produces a dark purple color that has green and blue components, but no red:

Color darkPurple = new Color(100, 0, 100);

A)True

B)False

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

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

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) A rectangle is drawn with the following statement: tool.drawRect(50, 50, 100, 60); An oval is drawn with the following statement: tool.drawOval(50, 50, 100, 60);

Describe the resulting output, and describe how the four arguments are used to draw the objects.

Q2) Write the statement to draw a rectangle that begins at position 30, 100 and is 150 pixels wide by 40 pixels tall.

Q3) The getFontMetrics() method can be used to discover a font's statistics. Describe the getLeading(), getAscent(), getDescent(), and getHeight() methods, and how they are used with the getFontMetrics() method.

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

Q5) The ____________________ method can be used when a window needs to be updated, such as when it contains new images or you have moved a new object onto the screen.

Q6) What are the constructors for the Dimension class?

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

Q8) The ____________________ method returns an object of type Dimension, which specifies the width and height of the screen in pixels.

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

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) How is an applet different from a Java application?

Q2) Use the ____ applet method to perform initialization tasks, such as setting variables to initial values or placing applet components on the screen.

A) initialize()

B) begin()

C) init()

D) start()

Q3) The extension of an HTML document should be .html or ____. A).htm

B).app

C).java

D).class

Q4) Invoking the ____ method after adding one or more JComponents to an applet ensures that the Components draw themselves on the screen.

A) draw()

B) paint()

C) repaint()

D) validate()

Q5) A(n) ___________________ is a likeness of a person or thing.

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

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.
Introduction to Programming Exam Materials - 1208 Verified Questions by Quizplus - Issuu