Introduction to Programming Question Bank - 620 Verified Questions

Page 1


Introduction to Programming Question Bank

Course Introduction

Introduction to Programming provides students with the foundational knowledge and practical skills necessary to begin developing computer programs. Through hands-on exercises and guided instruction, students learn core concepts such as variables, control structures, loops, functions, and basic data structures using a contemporary programming language. Emphasis is placed on problem-solving techniques, logical thinking, and writing clear, well-documented code. By the end of the course, students will be able to design, implement, and test simple programs, preparing them for more advanced studies in computer science and related fields.

Recommended Textbook

Starting Out with Java Early Objects 5th Edition by Tony Gaddis

Available Study Resources on Quizplus

16 Chapters

620 Verified Questions

620 Flashcards

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

Page 2

Chapter 1: Introduction to Computers and Java

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) One of the design tools used by programmers when creating a model of the program is

A) ALU.

B) pseudocode.

C) byte code.

D) syntax.

Answer: B

Q2) Internally, the central processing unit (CPU) consists of two parts:

A) the input and output devices.

B) the control unit and the arithmetic and logic unit (ALU).

C) the control unit and main memory.

D) the arithmetic and login unit (ALU) and main memory.

Answer: B

Q3) A procedure is a set of programming language statements that, together, perform a specific task.

A)True

B)False

Answer: True

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

3

Chapter 2: Java Fundamentals

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The simplest way you can use the System.out.printf method is

A) with a format string, and one format specifier.

B) with only a format string, and no additional arguments.

C) with a format string, and one or more format specifiers.

D) with only one format specifier, and no format string.

Answer: B

Q2) In the following Java statement what value is stored in the variable name? String name = "John Doe";

A) "name"

B) the memory address where "John Doe" is located

C) the memory address where name is located

D) "John Doe"

Answer: B

Q3) Named constants are initialized with a value, and that value cannot change during the execution of the program.

A)True

B)False

Answer: True

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

4

Chapter 3: A First Look at Classes and Objects

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The scope of a local variable is

A) inside the parentheses of a method header.

B) the method in which they are defined.

C) inside the class, but not inside any method.

D) the entire class.

Answer: B

Q2) A method that stores a value in a class's field or in some other way changed the value of a field is known as a mutator method.

A)True

B)False

Answer: True

Q3) What does the following UML diagram entry mean? + setHeight(h : double) : void

A) a public method with a parameter of data type double that does not return a value

B) a private field called Height that is a double data type

C) a private method with no parameters that returns a double data type

D) a public field called Height that is a double data type

Answer: A

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

5

Chapter 4: Decision Structures

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A ________ is a boolean variable that signals when some condition exists in the program.

A) sentinel

B) flag

C) block

D) case

Q2) What will be displayed after the following statements are executed?

Int hours = 30;

Double pay, payRate = 10.00; Pay = hours <= 40 ? hours * payRate : hours * payRate * 2.0; System.out.println(pay);

A) 300.0

B) 600.0

C) 400.0

D) The code contains an error and will not compile.

Q3) A block of code is enclosed in a set of

A) parentheses.

B) brackets.

C) braces.

D) double quotes.

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

Chapter 5: Loops and Files

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) What will be the value of x after the following code is executed?

Int x = 10;

For (int y = 5; y < 20; y +=5)

X += y;

A) 25

B) 30

C) 50

D) 40

Q2) If a loop does not contain within itself a way to terminate, it is called

A) a for loop.

B) an infinite loop.

C) a while loop.

D) a do-while loop.

Q3) How many times will the following for loop be executed?

For (int count = 10; count <= 21; count++)

System.out.println("Java is great!");

A) 0

B) 12

C) 10

D) 11

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

Chapter 6: A Second Look at Classes and Objects

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) When a method's return type is an object, what is actually returned to the calling program?

A) a reference to an object of that class

B) only the values in the object that the method accessed

C) an object of that class

D) a null reference

Q2) Of the following, which would be considered the no-arg constructor for the Rectangle class?

A) public Rectangle(int len, int width)

B) public Rectangle(double len, double width)

C) public Rectangle()

D) All of the above

Q3) If you write a toString method for a class, Java will automatically call the method any time you concatenate an object of the class with a string.

A)True

B)False

Q4) enum constants have a toString method.

A)True

B)False

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

Chapter 7: Arrays and the ArrayList Class

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) What will be the result of the following code?

Final int ARRAY_SIZE = 5;

Float[] x = float[ARRAY_SIZE];

For(int i = 1; i <= ARRAY_SIZE; i++)

{ X[i] = 10.0;

}

A) A runtime error will occur.

B) All the values in the array will be initialized to 10.0.

C) All the values in the array, except the first, will be set to 10.0.

D) The code contains a syntax error and will not compile.

Q2) The binary search algorithm

A) is less efficient than the sequential search algorithm.

B) will cut the portion of the array being searched in half each it fails to locate the search value.

C) will have a maximum number of comparisons equal to the number of elements in the array.

D) will have an average number of comparisons that is half the number of elements in the array.

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

Chapter 8: Text Processing and Wrapper Classes

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) StringBuilder objects are not immutable.

A)True

B)False

Q2) You cannot assign a value to a wrapper class object.

A)True

B)False

Q3) Which of the following are used as delimiters if the StringTokenizer class's constructor is called and a reference to a String object is passed as the only argument?

A) space

B) tab

C) newline

D) All of the above.

Q4) The term ________ commonly is used to refer to a string that is part of another string.

A) nested string

B) literal

C) substring

D) delimiter

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

Page 10

Chapter 9: Inheritance

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A ________ member's access is somewhere between private and public.

A) package

B) final

C) protected

D) static

Q2) Which of the following statements correctly specifies two interfaces?

A) public class ClassA implements [Interface1, Interface2]

B) public class ClassA implements (Interface1, Interface2)

C) public class ClassA implements Interface1 | Interface2

D) public class ClassA implements Interface1, Interface2

Q3) If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method.

A)True

B)False

Q4) Because the subclass is more specialized than the superclass, it is sometimes necessary for the subclass to replace inadequate superclass methods with more suitable ones.

A)True

B)False

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

Chapter 10: Exceptions and Advanced File I/O

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Look at the following code:

FileInputStream fstream = new FileInputStream("info.dat"); DataInputStream inputFile = new DataInputStream(fstream);

This code could also be written as

A) DataInputStream inputFile = new DataInputStream(new FileInputStream("info.dat"));

B) DataInputStream inputFile = new DataInputStream("info.txt");

C) FileInputStream inputFile = new FileInputStream(new DataInputStream("info.dat"));

D) FileInputStream fstream = new DataInputStream("info.txt");

Q2) If a class has fields that are objects of other classes, those classes must implement the Serializable interface in order to be serialized.

A)True

B)False

Q3) When an object is serialized, it is converted into a series of bytes that contain the object's data.

A)True

B)False

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

Chapter 11: GUI Applications Part 1

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) When a class is instantiated ________, the class is created in memory, but its address is not assigned to any reference variable.

A) lightly

B) referentially

C) anonymously

D) dynamically

Q2) A GUI program automatically stops executing when the end of the main method is reached.

A)True

B)False

Q3) The ActionListener interface is in this package.

A) java.awt.event

B) javax.swing.event

C) java.lang.event

D) java.action.event

Q4) A modal dialog box

A) suspends execution of any other statements until the dialog box is closed.

B) is displayed for a short period of time and then disappears from the screen.

C) always appears in the center of the screen.

D) determines the mode your program runs in.

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

Chapter 12: GUI Applications Part 2

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) You can create a label with an image or text, but you cannot create a label with both an image and text.

A)True

B)False

Q2) If null is passed as an argument to the JFileChooser class's showOpenDialog method,

A) the dialog box will be created in memory, but it will not be displayed.

B) the dialog box will be displayed in the lower-right corner of the screen.

C) the dialog box will be displayed in the upper-left corner of the screen.

D) the dialog box will be displayed in the center of the screen.

Q3) What is returned by the JList class's getSelectedIndex method?

A) the index of the selected item

B) -1 if no item is selected

C) Both A and B

D) None of the above

Q4) If multiple items have been selected in a list component, you should use the getSelectedValues or getSelectedIndices methods to retrieve the selected items.

A)True

B)False

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

Chapter 13: Applets and More

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) An application can use this object to execute code automatically at regular time intervals.

A) Clock

B) Regulator

C) Meter

D) Timer

Q2) This method draws a string as a graphic.

A) displayString

B) stringDraw

C) paintString

D) drawString

Q3) Applets are important because they can be used to extend the capabilities of a stand-alone Java application.

A)True

B)False

Q4) This method clears the surface of the component and then calls the paint method.

A) resurface

B) clear

C) repaint

D) refresh

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

Chapter 14: Creating GUI Applications with JavaFX

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) This is a markup language that describes the components in a JavaFX scene graph.

A) SGML

B) HTML

C) XML

D) FXML

Q2) This section of the Inspector Panel allows you to register the controller class and event listeners with the GUI.

A) Code

B) Properties

C) Layout

D) Content

Q3) You can use this component to display images in an application's GUI.

A) Label

B) ImageView

C) AnchorPane

D) ComboBox

Q4) In JavaFX, the components that are in a GUI are organized as a UML diagram.

A)True

B)False

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

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

20 Verified Questions

20 Flashcards

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

Sample Questions

Q1) The number of times that a method calls itself is known as

A) the call count.

B) the cyclic identity.

C) the method heap.

D) the depth of recursion.

Q2) Without a base case, a recursive method will call itself only once and stop.

A)True

B)False

Q3) Whereas a recursive algorithm might result in faster execution time, the programmer might be able to design an iterative algorithm faster.

A)True

B)False

Q4) The actions performed by the JVM that take place with each method call are sometimes referred to as this.

A) overhead

B) allocation

C) overflow

D) retention

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

Page 17

Chapter 16: Databases

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) What term refers to data that describes other data?

A) Pseudo-data

B) Micro data

C) Abstract data

D) Meta data

Q2) In a transaction, all updates to database must be successfully executed.

A)True

B)False

Q3) The columns in a table are assigned SQL data types.

A)True

B)False

Q4) This type of SQL statement is used to retrieve the rows from a table.

A) GET

B) SELECT

C) READ

D) RETRIEVE

Q5) No two rows in a table can have the same value in the primary key column.

A)True

B)False

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

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 Question Bank - 620 Verified Questions by Quizplus - Issuu