

![]()


Programming for Engineers introduces the fundamental concepts and techniques of computer programming with a focus on solving engineering problems. Students will learn to design, write, and debug programs using a modern programming language such as Python, C, or MATLAB. Core topics include data types, control structures, functions, arrays, and an introduction to object-oriented programming. Emphasis is placed on algorithm development, logical thinking, and practical applications relevant to engineering disciplines, equipping students with essential computational skills necessary for analysis, modeling, and simulation in their future coursework and professional practice.
Recommended Textbook
Big Java Late Objects 1st Edition by Cay S. Horstmann
Available Study Resources on Quizplus
24 Chapters
2169 Verified Questions
2169 Flashcards
Source URL: https://quizplus.com/study-set/3769 Page 2
96 Verified Questions
96 Flashcards
Source URL: https://quizplus.com/quiz/75165
Q1) The programmer, not the compiler, is responsible for testing a program to identify A) Syntax errors
B) Compile-time errors
C) Run-time errors
D) Undefined symbols
Answer: C
Q2) Suppose you examine a simple Java program and the first line is public Class HelloPrinter. Is this the same thing in Java as the line public Class helloprinter?
A) No, because Java is case-sensitive, these are considered to be completely distinct
B) No, because "helloprinter" is misspelled, the Java compiler will reject it
C) Yes, because these Java symbols both have the same letters, they are considered to be the same
D) Yes, because all Java symbols must have exactly twelve characters.
Answer: A
To view all questions and flashcards with answers, click on the resource link above.

3

Available Study Resources on Quizplus for this Chatper
103 Verified Questions
103 Flashcards
Source URL: https://quizplus.com/quiz/75166
Sample Questions
Q1) What is the output of the following code snippet?
Int counter = 0;
Counter++;
System.out.print("The initial value of the counter is ");
System.out.println(count);
A) The initial value of the counter is 0
B) The initial value of the counter is 1
C) The code will not compile
D) The initial value of the counter is
Answer: C
Q2) In an airline reservation system, the number of available seats in an airplane is required. Which data type should be used to store this value?
A) double
B) float
C) int
D) long
Answer: C
To view all questions and flashcards with answers, click on the resource link above. Page 4

Available Study Resources on Quizplus for this Chatper
99 Verified Questions
99 Flashcards
Source URL: https://quizplus.com/quiz/75167
Sample Questions
Q1) Which statement about an if statement is true?
A) The condition in an if statement using relational operators will evaluate to a Boolean result
B) The condition in an if statement should make exact comparisons to floating-point numbers
C) The condition in an if statement should always evaluate to true
D) The condition in an if statement should never include integer variables
Answer: A
Q2) In a switch statement, if a break statement is missing
A) The break happens at the end of each branch by default
B) The statement will not compile
C) Execution falls through the next branch until a break statement is reached
D) The default case is automatically executed
Answer: B
Q3) Which of the following operators is NOT a relational operator?
A) <=
B) +=
C) !=
D) ==
Answer: B
To view all questions and flashcards with answers, click on the resource link above. Page 5
Available Study Resources on Quizplus for this Chatper
100 Verified Questions
100 Flashcards
Source URL: https://quizplus.com/quiz/75168
Sample Questions
Q1) Which of the loop(s) test the condition after the loop body executes?
I. for loop II. while loop III. do loop
A) I only
B) II only
C) III only
D) II and III
Q2) How many times does the following loop execute? For (double d = 1; d != 10; d++)
{
D = d / 3;
System.out.print(d + " ");
}
A) 10
B) 9
C) 8
D) An infinite number of times
To view all questions and flashcards with answers, click on the resource link above.

Page 6

Available Study Resources on Quizplus for this Chatper
94 Verified Questions
94 Flashcards
Source URL: https://quizplus.com/quiz/75169
Sample Questions
Q1) Which of the following is true about method return statements?
A) A method can hold multiple return statements, but only one return statement executes in one method call.
B) A method can hold only one return statement.
C) A method can hold multiple return statements, and multiple return statements can execute in one method call.
D) A method can have maximum of two return statements.
Q2) After the keywords "public static", what are the names (in order) of the parts of this method header?
Public static int myFun (double a)
A) Return type, method name, parameter variable type, parameter variable name
B) Return type, method name, parameter variable name, parameter variable type
C) Method name, method type, parameter variable type, parameter variable name
D) Method name, method type, parameter variable name, parameter variable type
Q3) Which of the following is NOT a good practice when developing a computer program?
A) Put as many statements as possible into the main method
B) Document the purpose of each method parameter
C) Decompose a program into many small methods
D) Place code that is used multiple times into a separate method
To view all questions and flashcards with answers, click on the resource link above. Page 7

Available Study Resources on Quizplus for this Chatper
100 Verified Questions
100 Flashcards
Source URL: https://quizplus.com/quiz/75170
Sample Questions
Q1) Consider the following method:
Public static int mystery(int length, int n)
{ Int[] result = new int[length]; For (int i = 0; i < result.length; i++)
{
Result[i] = (int) (n * Math.random());
} Return result;
}
Which statement is correct about the code?
A) The method works perfectly
B) The method returns a random number
C) The method return type should be changed to int[]
D) The method has a bounds error when the array size is too large
Q2) When an array reading and storing input runs out of space
A) the program must be recompiled with a bigger size for the array.
B) the array must be "grown" using the growArray method.
C) it automatically resizes to accommodate new elements.
D) the array must be "grown" using the new command and the copyOf method.
To view all questions and flashcards with answers, click on the resource link above.
Page 8

Available Study Resources on Quizplus for this Chatper
100 Verified Questions
100 Flashcards
Source URL: https://quizplus.com/quiz/75171
Sample Questions
Q1) Insert the missing code in the following code fragment. This fragment is intended to read binary data.
Public static void main(String[] args) throws IOException
{
String address = "http://horstmann.com/bigjava.gif";
URL imageLocation = _________;
InputStream in = imageLocation.openStream());
) . .
}
A) new Scanner("http://horstmann.com/bigjava.gif")
B) new Scanner(address)
C) new imageLocation.openStream
D) new URL(address)
Q2) The Scanner class's ____ method is used to specify a pattern for word boundaries when reading text.
A) useDelimiter()
B) usePattern()
C) setDelimiter()
D) setPattern()
To view all questions and flashcards with answers, click on the resource link above. Page 9

Available Study Resources on Quizplus for this Chatper
101 Verified Questions
101 Flashcards
Source URL: https://quizplus.com/quiz/75172
Sample Questions
Q1) Which statement illustrates the invocation of a static method?
A) mySavings.deposit(100);
B) double s = Math.sqrt(100);
C) deposit(100).mySavings;
D) double s = 100.sqrt();
Q2) Consider the following code snippet: Public class Coin
{ Private String coinName; Public String getCoinValue()
{ ) . . }
}
Which of the following statements is correct?
A) The getCoinValue method can be accessed by any user of a Coin object.
B) The getCoinValue method can be accessed only by methods of the Coin class.
C) The getCoinValue method can be accessed only by methods of another class.
D) The getCoinValue method cannot be accessed at all.
To view all questions and flashcards with answers, click on the resource link above. Page 10
Available Study Resources on Quizplus for this Chatper
99 Verified Questions
99 Flashcards
Source URL: https://quizplus.com/quiz/75173
Sample Questions
Q1) Consider the following code snippet: If (anObject instanceof Auto)
{ Auto anAuto = (Auto) anObject; ) . . }
What does this code do?
A) This code tests whether anObject was created from a superclass of Auto.
B) This code creates a subclass type object from a superclass type object.
C) This class safely converts an object of any type to an object of type Auto.
D) This code safely converts an object of type Auto or a subclass of Auto to an object of type Auto.
Q2) Which of the following can potentially be changed when implementing an interface?
A) The parameters of a method defined by the interface.
B) The name of a method defined by the interface.
C) The return type of a method defined by the interface.
D) You cannot change the name, return type, or parameters of a method defined by the interface.
To view all questions and flashcards with answers, click on the resource link above.

11

Available Study Resources on Quizplus for this Chatper
54 Verified Questions
54 Flashcards
Source URL: https://quizplus.com/quiz/75174
Sample Questions
Q1) Which of the following statements should be added to this code fragment to set the frame size to a width of 400 and a height of 200?
Final int FRAME_WIDTH = 400; Final int FRAME_HEIGHT = 200; JFrame frame = new JFrame();
A) frame.size = (FRAME_WIDTH, FRAME_HEIGHT);
B) frame.addSize(FRAME_WIDTH, FRAME_HEIGHT);
C) frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
D) frame.setSize(FRAME_HEIGHT, FRAME_WIDTH);
Q2) The Graphics class is part of the ____________________ package.
A) java.swing
B) java.awt
C) javax.swing
D) javax.awt
Q3) Which java package must be imported if a program wishes to respond to button events?
A) javax.swing.event.ActionListener
B) java.awt.event.ActionListener
C) javax.swing.JButton
D) java.awt.JButton
To view all questions and flashcards with answers, click on the resource link above. Page 12

Available Study Resources on Quizplus for this Chatper
91 Verified Questions
91 Flashcards
Source URL: https://quizplus.com/quiz/75175
Sample Questions
Q1) The statement that would add smallButton to the button group in the following code is _________.
JRadioButton smallButton = new JRadioButton("Small"); ButtonGroup group = new ButtonGroup();
A) group.add(new smallButton);
B) group.add(smallButton);
C) smallButton.add();
D) You cannot add smallButton to the button group.
Q2) Which layout manager allows you to add components in different orders, with the result being the same GUI appearance?
I FlowLayout
II BorderLayout
III GridLayout
A) I
B) II
C) I and III
D) II and III
To view all questions and flashcards with answers, click on the resource link above. Page 13

Available Study Resources on Quizplus for this Chatper
100 Verified Questions
100 Flashcards
Source URL: https://quizplus.com/quiz/75176
Sample Questions
Q1) You are designing a software solution for a veterinary clinic. The clinic provides various services for each pet on each visit. You have decided that the following classes are needed: Customer, Address, Pet, and Visit. Which of these should be represented as aggregation?
A) Customer class aggregates Address, Pet, and Visit classes.
B) Visit class aggregates Address class.
C) Pet class aggregates Address class.
D) Pet class aggregates Customer class.
Q2) Which of the following statements will correctly put the Auto class into a package named VehiclePkg?
A) import VehiclePkg;
B) import VehiclePkg.*;
C) package VehiclePkg;
D) package VehiclePkg.*;
Q3) Aggregation denotes that ____.
A) Objects of one class inherit from objects of its superclass.
B) Objects of one class can be inherited by its subclasses.
C) Objects of one class contain references to objects of its superclass.
D) Objects of one class contain references to objects of another class.
To view all questions and flashcards with answers, click on the resource link above.
Page 14

Available Study Resources on Quizplus for this Chatper
100 Verified Questions
100 Flashcards
Source URL: https://quizplus.com/quiz/75177
Sample Questions
Q1) A unique permutation is one that is different from any other generated permutation. How many unique permutations does the string "aaa" have?
A) 0
B) 1
C) 2
D) 3
Q2) If recursion does not have a special terminating case, what error will occur?
A) Index out of range
B) Illegal argument
C) Stack overflow
D) Out of memory
Q3) Recursion will take place if any of the following happen:
I method A calls method B, which calls method C
II method A calls method B, which calls method A
III method A calls method A
A) I
B) I and II
C) II
D) II and III
To view all questions and flashcards with answers, click on the resource link above.
Page 15
Available Study Resources on Quizplus for this Chatper
99 Verified Questions
99 Flashcards
Source URL: https://quizplus.com/quiz/75178
Sample Questions
Q1) The performance of an algorithm is most closely related to what?
A) The total number of element visits
B) The total number of elements
C) The type of elements
D) The number of lines of code in the method
Q2) Suppose objects a and b are from a user-defined class that implements the Comparable interface. What must be true about the return value of a.compareTo(b) for the compareTo method that this class implements?
A) It must return 1 if a comes before b, 0 if they are the same, and -1 if a comes after b.
B) It must return -1 if a comes before b, 0 if they are the same, and 1 if a comes after b.
C) It must return a positive value if a comes before b, 0 if they are the same, and a negative value if a comes after b.
D) It must return a negative value if a comes before b, 0 if they are the same, and a positive value if a comes after b.
To view all questions and flashcards with answers, click on the resource link above.

16

Available Study Resources on Quizplus for this Chatper
100 Verified Questions
100 Flashcards
Source URL: https://quizplus.com/quiz/75179
Sample Questions
Q1) Which method is NOT part of the ListIterator interface?
A) delete
B) add
C) next
D) previous
Q2) The nodes of a(n) ____ linked list class store two links: one to the next element and one to the previous one.
A) array
B) singly
C) doubly
D) randomly
Q3) A collection that allows items to be added only at one end and removed only at the other end is called a ____.
A) list
B) stack
C) set
D) queue
To view all questions and flashcards with answers, click on the resource link above. Page 17
Available Study Resources on Quizplus for this Chatper
94 Verified Questions
94 Flashcards
Source URL: https://quizplus.com/quiz/75180
Sample Questions
Q1) Array lists and linked lists both have the same ____.
A) add/remove efficiency
B) concrete implementations
C) random element access efficiency
D) linear traversal step efficiency
Q2) Complete the following code, which is intended to add an element to the top of a stack implemented as a linked list. Node newNode = new Node(); NewNode.data = element;

A) first = newNode; NewNode.next = first; B) newNode.next = first; First = newNode; C) newNode.previous = first; First.next = newNode; D) first = newNode; NewNode.previous = first;
To view all questions and flashcards with answers, click on the resource link above. Page 18

Available Study Resources on Quizplus for this Chatper
100 Verified Questions
100 Flashcards
Source URL: https://quizplus.com/quiz/75181
Sample Questions
Q1) Which of the following is NOT a property of a red-black tree?
A) All nodes must be red or black.
B) All child nodes of a red node must be black.
C) The root is black.
D) All paths from root to null have the name number of nodes.
Q2) Which of the following may occur as a result of an add operation, on a non-empty binary search tree?
I a new root is created
II the new node becomes the left child of the root
III the new node has a right child upon insertion
A) I
B) II
C) III
D) II and III
Q3) The height h of a completely filled binary tree with n nodes is ____.
A) h = log2(n) - 1
B) h = log2(n) + 1
C) h = log2(n - 1)
D) h = log2(n + 1)
To view all questions and flashcards with answers, click on the resource link above.
Page 19

Available Study Resources on Quizplus for this Chatper
78 Verified Questions
78 Flashcards
Source URL: https://quizplus.com/quiz/75182
Sample Questions
Q1) Which of the following satisfies the wildcard ? extends Object?
I String
II JComponent
III Scanner
A) I
B) II
C) I and II
D) I, II and III
Q2) Consider the following code snippet:
ArrayList<BankAccount> accounts1 = new ArrayList<BankAccount>(); //Line 1 LinkedList accounts2 = new LinkedList(); //Line 2
Accounts1.add("my Salary"); //Line 3
Accounts2.addFirst("my Salary"); //Line 4
Which of the above lines will cause a run-time error when the object is retrieved elsewhere in the program?
A) Line 1
B) Line 2
C) Line 3
D) Line 4
To view all questions and flashcards with answers, click on the resource link above. Page 20

Available Study Resources on Quizplus for this Chatper
82 Verified Questions
82 Flashcards
Source URL: https://quizplus.com/quiz/75183
Sample Questions
Q1) Caesar cipher uses a shift of each character by a key with a value between 1 and 255. An a with a shift equal to 3 becomes a d. A z would become a c, wrapping around the alphabet. Which is the encryption of shadow for a key = 3?
A) ukdgry
B) vkdgrz
C) adowsha
D) vjegrz
Q2) You use _________ and FileOutputStream objects to write data to a disk file in text or binary form respectively.
A) FileReader
B) PrintWriter
C) OutputStreamWriter
D) ObjectOutputStream
Q3) If you store information in binary form, as a sequence of bytes, you will use the ____ class(es) and their subclasses.
A) InputStream and OutputStream
B) Serializable
C) PrintWriter
D) Reader and Writer
To view all questions and flashcards with answers, click on the resource link above. Page 21
Available Study Resources on Quizplus for this Chatper
82 Verified Questions
82 Flashcards
Source URL: https://quizplus.com/quiz/75184
Sample Questions
Q1) Stale data occurs in multi-CPU machines when one thread modifies shared data and a second thread accesses that data later, but sees the data value before the change took place. What is required to guarantee that the second thread sees the updated data, not stale data when access to the shared data occurs in two different methods?
A) One method needs to acquire then release the lock after modifying the data.
B) Both methods need to acquire then release the lock after modifying or reading the data.
C) Never change any shared object data in multi-CPU machines.
D) Never use locks for any shared data in multi-CPU machines.
Q2) Which are ways that a thread can be blocked?
I when it is sleeping
II waiting for a lock to be available
III waiting after calling the await method
A) I
B) I and II
C) I and III
D) I, II and III
To view all questions and flashcards with answers, click on the resource link above.

22

Available Study Resources on Quizplus for this Chatper
74 Verified Questions
74 Flashcards
Source URL: https://quizplus.com/quiz/75185
Sample Questions
Q1) To connect to the HTTP port (80) of the server yahoo.com, you use:
A) Socket s = new Socket(80, yahoo.com);
B) Socket s = connect("yahoo.com", 80);
C) Socket s = new Socket("yahoo.com", 80);
D) java yahoo.com 80
Q2) To close a connection, which of the following statements can you use?
A) URL u = new URL("http://www.yahoo.com");
URLConnection conn = u.close();
B) URL u = new URL(str);
URLConnection conn = new URLConnection(u);
C) URL u = new URL(str);
URLConnection conn = u.closeURLConnection();
D) There is no need to close the connection.
Q3) A page not found has status code _______________.
A) 200 not found.
B) 404 not found.
C) 0 not found.
D) 100 not found.
To view all questions and flashcards with answers, click on the resource link above. Page 23
Available Study Resources on Quizplus for this Chatper
75 Verified Questions
75 Flashcards
Source URL: https://quizplus.com/quiz/75186
Sample Questions
Q1) The following command will compile a Java program called TestDB:
A) java TestDB.class
B) java TestDB.java
C) javac TestDB.java
D) javac TestDB.class
Q2) In SQL, ____ is used to test for equality.
A) EQUAL
B) ==
C) =
D) EQUALS
Q3) If your program needs to look at several result sets at the same time, _____.
A) you need to create multiple Statement objects.
B) you can reuse the Statement or PreparedStatement objects
C) you should close the ResultSet before creating a new one.
D) you are not able to see several sets at the same time.
Q4) Which import statement will allow you to use a SQLException object?
A) import javax.swing.SQLException;
B) import java.sql.SQLException;
C) import java.util.SQLException;
D) import java.io.SQLException;

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

Available Study Resources on Quizplus for this Chatper
74 Verified Questions
74 Flashcards
Source URL: https://quizplus.com/quiz/75187
Sample Questions
Q1) When referencing an external DTD (one not on the current file system), you must supply a(n) ____ for locating the DTD.
A) URL
B) domain name
C) IP address
D) element
Q2) To write a DOM document, you need to use an object that implements the _________ interface.
A) DocumentBuilder
B) Serializable
C) Serializer
D) LSSerializer
Q3) In XML, a DTD is introduced with the ___________ declaration.
A) FIXED
B) REQUIRED
C) IMPLIED
D) DOCTYPE
To view all questions and flashcards with answers, click on the resource link above. Page 25
Available Study Resources on Quizplus for this Chatper
74 Verified Questions
74 Flashcards
Source URL: https://quizplus.com/quiz/75188
Sample Questions
Q1) To query a database, a JavaBean needs a(n) ____________ object.
A) Table
B) Connection
C) Bean
D) HTML
Q2) Name one of the requirements for a Java class to become a JavaBean?
A) A JavaBean must have get, set, and command action methods.
B) A JavaBean must have only get and set methods.
C) A JavaBean must have a public constructor with one or more arguments.
D) A JavaBean must have a public constructor with no arguments.
Q3) The user interface of a JSF application is described by ________.
A) a set of HTML-only pages.
B) a set of JSF servers.
C) a set of JSF events.
D) a set of JSF pages.
Q4) Swing differs from JSF in that it ________.
A) handles form-posting events.
B) paints pixels in a frame.
C) paints by emitting HTML code.
D) hides high-level details.

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