Skip to main content

Introduction to Programming Test Questions - 1208 Verified Questions

Page 1


Introduction to Programming Test Questions

Course Introduction

Introduction to Programming is designed to provide students with foundational knowledge and practical skills in computer programming. Through this course, students will learn essential concepts such as variables, data types, control structures, functions, and basic algorithms. The course typically utilizes a beginner-friendly programming language and emphasizes problem-solving and logical thinking. By completing hands-on exercises and projects, students will gain the ability to write, test, and debug simple programs, preparing them for more advanced studies 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) Programs that are embedded in a Web page are called Java ____.

A) consoles

B) applets

C) applications

D) windowed applications

Answer: B

Q2) In Java, the reserved keyword ____ means that a method is accessible and usable even though no objects of the class exist.

A) active

B) undefined

C) static

D) void

Answer: C

Q3) In programming, named computer memory locations are called ____________________ because they hold values that might vary.

Answer: variables

Q4) You use an import statement when you want to access a built-in Java class that is contained in a group of classes called a(n) ____________________.

Answer: package

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) final int COSTPERITEM = 10; double sales2012 = amtSold * COSTPERITEM; In the above statements, identify the named constant and describe how a programmer can recognize named constants.

Answer: The named constant identifier is COSTPERITEM.

Constant declaration statements use the final keyword. Constants are conventionally given identifiers in all uppercase letters.

Q3) Describe the variation types byte, short, and long of the integer type.

Answer: The types byte, short, and long are all variations of the integer type. The byte and short types occupy less memory and can hold only smaller values; the long type occupies more memory and can hold larger values.

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

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) To execute a method, you ____________________ it from another method. Answer: invoke call

Q2) A(n) ____ causes a value to be sent from a called method back to the calling method.

A) return statement

B) method statement

C) instantiation

D) inheritance relationship

Answer: A

Q3) How do you create an instance of a class? Provide an example.

Answer: A two-step process creates an object that is an instance of a class. First, you supply a type and an identifier-just as when you declare any variable-and then you allocate computer memory for that object. For example, you might define an integer as int someValue; and you might define an Employee as follows: Employee someEmployee;. In this statement, someEmployee stands for any legal identifier you choose to represent an Employee.

Q4) When you think in an object-oriented manner, everything is a(n)

Answer: object

Page 5

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

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) A(n) ____________________ is simply a folder that provides a convenient grouping for classes.

Q2) The compiler determines which version of a method to call by the method's ____.

A) name

B) signature

C) output

D) constructor

Q3) When you ____________________ methods, you risk creating an ambiguous situation-one in which the compiler cannot determine which method to use.

Q4) It is illegal to declare the same variable name more than once within a block.

A)True

B)False

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

A) packages

B) statements

C) fields

D) methods

Q6) Describe how a programmer can make a variable in or out of scope.

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) Create an if statement that will check if the variable salesAmt is greater than the constant SALES_QUOTA. If true, create a block statement that will calculate salesAmt * BONUS_PERCENT and store the result in a variable named bonusPay. The block statement will then compute totalPay by adding salesAmt to bonusPay. Outside of the if structure, add a println statement that will output the totalPay value.

Q2) The ____ operator is always evaluated before the OR operator.

A) Assignment

B) AND

C) Conditional

D) Logical

Q3) A ____ consists of written steps in diagram form, as a series of shapes connected by arrows.

A) pseudocode chart

B) flowchart

C) sequence structure

D) decision structure

Q4) List and explain the keywords used with the switch statement.

Q5) Describe how a sequence structure works.

Q6) Explain the use of the NOT operator.

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) Why would a loop with altered user input be considered a type of indefinite loop? Give an example.

Q2) Within parentheses are three sections separated by exactly two semicolons

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

Q3) How are indefinite loops used for validating data? Why is a loop structure typically the better choice for validating data than an if statement?

Q4) An indefinite loop is a(n) ____ loop.

A) counter-controlled

B) event-controlled

C) initialized

D) validating

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) Strings that cannot be changed are said to be immutable. What does this mean and how does it relate to values held in memory addresses?

Q2) The method header of the equals() method within the String class is ____.

A) public boolean equals(Strings)

B) private boolean equals(String s)

C) public boolean equals(String s)

D) public boolean equals(Character s)

Q3) The ____ method returns the length of a String.

A) getSize()

B) getLength()

C) size()

D) length()

Q4) To convert a String to an integer, you use the valueOf() method of the ____ class.

A) StringBuilder

B) String

C) Integer

D) Convert

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

Q6) Describe how a reference is used in Java.

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) You can declare an array variable by placing curly brackets after the array name.

A)True

B)False

Q2) Primitive type variables are always passed by ____.

A) value

B) reference

C) location

D) memory

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

Q4) String[] countyNames = {"Clark", "Delaware", "Madison"}; What will be the value of countyNames[0].length(), countyNames[1].length(), and countyNames[2].length()?

Q5) In which of the following statements is the value of myVals null?

A) int myVals = ""

B) int [] myVals;

C) myVals = int[null]

D) int[null] = myVals

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) Java provides a(n) ____ class, which contains many useful methods for manipulating arrays.

A) Object

B) Arrays

C) Table

D) Sort

Q2) What are some of the advantages of creating an enumeration type?

Q3) How can you sort arrays of objects?

Q4) The ArrayList class ____ method removes an item from an ArrayList at a specified location.

A) delete

B) get

C) erase

D) remove

Q5) int[][] myVals = {{10, 15, 20, 25}, {30, 35, 40, 45, 50, 55, 60}, {65, 70, 75, 80, 85, 90}}; Using the above array, what is the value of myVals.length? What is the value of myVals[1].length? What is the value of myVals[2].length? Explain how you determined these values.

Page 11

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

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) Within a subclass, you can think of the keyword ____ as the opposite of super.

A) sub

B) this

C) protected

D) not

Q2) Keeps data private

A)information hiding

B)inheritance

C)super()

D)superclass

E)instanceof

F)virtual method call

G)inlining

H)class diagram

I)derived class

Q3) How is the keyword protected used?

Q4) What is the process of inlining and how is it accomplished in Java?

Q5) A static method cannot be overridden in a subclass.

A)True

B)False

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) Java does not allow a class to inherit directly from two or more parents.

A)True

B)False

Q2) Compare and contrast abstract classes and interfaces.

Q3) Data fields in an interface

A)dynamic method binding

B)collision

C)GregorianCalendar

D)multiple inheritance

E)equals() method

F)-d option

G)java.lang

H)public, static, and final

I)interface

Q4) If you provide an empty method within an abstract class, the method is an abstract method even if you do not explicitly use the keyword ____________________ when defining the method.

Q5) When you create a useful, extendable superclass, you and other future programmers gain what advantages?

Q6) What is dynamic method binding and why is it used?

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

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) Which of the following is NOT a component of a try block?

A) a closing curly brace

B) the keyword try

C) executable statements

D) a throw statement

Q2) When you catch an Exception object, you can call ____________________ to display a list of methods in the call stack so you can determine the location of the statement that caused the exception.

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

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

Q5) What is the first program statement in a catch block?

A) the keyword catch

B) an opening curly brace

C) the keyword Exception

D) the statements that take the action you want to use to handle the error condition

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) Provide an example of batch processing.

Q2) Functions as a pipeline or channel between a Java program and an input device

A)batch processing

B)root

C)buffer

D)flushing

E)stream

F)System.getProperty("line.separator")

G)data file

H)close the files

I)BufferedWriter

Q3) While System.err and System.out are both directed by default to the monitor command line, System.err is usually reserved for error messages and System.out is reserved for valid output.

A)True

B)False

Q4) When you perform input and output operations in an application, what is actually occurring with the bytes of information?

Q5) A(n) ____________________ object is an avenue for reading and writing a file.

Page 15

Q6) Random files are also called ____________________ files.

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

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) How do you modify whether or not a JTextField can be edited?

Q2) What are the four JFrame constructors?

Q3) Provide an example of an event-driven program.

Q4) Java provides you with a Font class from which you can create an object that holds typeface and size information.

A)True

B)False

Q5) How can you customize the appearance of a JFrame?

Q6) The measurement between lines of text in a single-spaced text document

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

Q7) Write the statement to provide a JTextField object named myInfo that allows enough room for a user to enter 15 characters.

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) Use the ____ layout manager when you need to add components that are displayed one at a time.

A) BorderLayout

B) GridLayout

C) GridBagLayout

D) CardLayout

Q2) Clicking a component results in a(n) ____.

A) ItemEvent

B) WindowEvent

C) ActionEvent

D) MouseEvent

Q3) Any component you place on the screen has a vertical, or x-axis, position as well as a horizontal, or y-axis, position in the window.

A)True

B)False

Q4) How do you find the red, green, and blue components of a color?

Q5) Using a FlowLayout object named myLayout, write the statement to set the layout of a content pane to left.

Q6) What is an adapter class?

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) The ____ method draws what appears to be an empty rectangle.

A) clearRect()

B) emptyRect()

C) fillRect()

D) drawRect()

Q2) Draws a solid shape

A)fill pattern

B)GREEN

C)acyclic gradient

D)3D method

E)Line2D.Float class

F)fillPolygon()

G)getScreenResolution()

H)GeneralPath

I)descent

Q3) Describe what happens when the update() method is called.

Q4) The FontMetrics class methods return an integer value representing the font size in points, with one point measuring 1/72 of an inch.

A)True

B)False

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) You can use an overloaded version of the Image class method drawImage() to output a scaled image.

A)True

B)False

Q2) Write the statement to retrieve and play the myTune.au sound file that will be stored in the same place as the applet.

Q3) What are the four steps involved in creating an applet?

Q4) There are four methods inherited from JApplet that make up the life cycle of an applet.

A)True

B)False

Q5) Usually, you place three attributes within the <object> tag: code, width, and ____.

A) codebase

B) size

C) length

D) height

Q6) ___________________ is a Swing class from which you can inherit to create your own 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