Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 52 pages
Exam (elaborations)

CSE 310 ARIZONA STATE UNIVERSITY - FOR DATA STRUCTURE AND ALGORITHM - ASU COMPREHENSIVE STUDY GUIDE 2026 FULL QUESTIONS AND SOLUTIONS GRADED A+

Document preview thumbnail
Preview 4 out of 52 pages

CSE 310 ARIZONA STATE UNIVERSITY - FOR DATA STRUCTURE AND ALGORITHM - ASU COMPREHENSIVE STUDY GUIDE 2026 FULL QUESTIONS AND SOLUTIONS GRADED A+

Content preview

CSE 310 ARIZONA STATE UNIVERSITY -
FOR DATA STRUCTURE AND ALGORITHM -
ASU COMPREHENSIVE STUDY GUIDE 2026
FULL QUESTIONS AND SOLUTIONS
GRADED A+

◍ What does the following statement sequence print?final String str =
"Java";str += " is powerful"; System.out.println(str);a) Java is powerfulb)
Java + is powerfulc) is powerfuld) Nothing; compile-time error.
Answer: d) Nothing; compile-time error
◍ 87) Which statement is true about the code snippet
below?ArrayList<String> names = new
ArrayList<String>();names.add("John");names.add("Jerry");ArrayList<String>
friends = names;friends.add("Harry");a) The final size of names is 2; the
final size of friends is 3b) The final size of names is 3; the final size of
friends is 2c) The final size of names is 3; the final size of friends is 3d)
Compilation error.
Answer: c) The final size of names is 3; the final size of friends is 3
◍ The average running time for binary search is O(logn), where the worst-case
running time is O(n)..
Answer: False, the worst time for binary search is O(logn).
◍ A name defined in an inner scope is not available outside that block.
Answer: True
◍ 89) Is the following code snippet legal?boolean b = false;do{
System.out.println("Do you think in Java?");} while (b != b);a) Yes, it is
legal but does not print anything.b) Yes, it is legal and prints "Do you think

, in Java?" once.c) Yes, it is legal and prints "Do you think in Java?" twice.d)
No, it is not legal and gives a compilation error..
Answer: Answer: b) Yes, it is legal and prints "Do you think in Java?" once.
◍ 59) Which of the following for loops is illegal?a) for (int i = 0; ; ) { }b) for
(int i = 0) { }c) for (int i = 0, k = 1; ; i++) { }d) for ( ; ; ).
Answer: Answer: b) for (int i = 0) { }
◍ 26) How many times does the code snippet below display "Hello"?int i =
0;while (i != 15){ System.out.println("Hello"); i++;}a) Infinite timesb) 14
timesc) 15 timesd) 16 times.
Answer: Answer: c) 15 times
◍ 89) Which choice indicates that a string variable refers to no string?a) nilb)
""c) nulld) empty.
Answer: c) null
◍ order of operations (python).
Answer: ( ) parentheses. ** exponentiation - negation * multiplication/
division, % remainder + additionsubtraction
◍ 10) Which of the following statements about encapsulation is correct?a) To
use encapsulation, you must provide a set of private methods in the class.b)
To use encapsulation, the class must contain only public methods in the
class.c) To use encapsulation, the implementation details must be public.d)
To use encapsulation, you must provide a set of public methods in the class
and hide the implementation details..
Answer: d) To use encapsulation, you must provide a set of public methods
in the class and hide the implementation details.
◍ 91) Which statement is true about the code snippet
below?ArrayList<String> names = new
ArrayList<String>();names.add("John");names.add("Jerry");ArrayList<String>
friends = new ArrayList<String>(names);names.add("Harry");a) The final
size of names is 2; the final size of friends is 3b) The final size of names is
3; the final size of friends is 2c) The final size of names is 3; the final size of

, friends is 3d) Compilation error.
Answer: b) The final size of names is 3; the final size of friends is 2
◍ 52) Consider the following code snippet:public class Vehicle{ private String
type; private int numAxles; public Vehicle() { } . . .}Which statement
reflects the action performed when the constructor to Vehicle is called?a)
The variable type will be initialized to "" and the variable numAxles will be
initialized to 0.b) The variable type will be initialized to "null" and the
variable numAxles will be initialized to 0.c) The variable type will not be
initialized but the variable numAxles will be initialized to 0.d) The variable
type will be initialized to null and the variable numAxles will be initialized
to 0..
Answer: d) The variable type will be initialized to null and the variable
numAxles will be initialized to 0.
◍ At what point in the problem-solving process should one write
pseudocode?a) After writing Java code, as a way to summarize the code's
algorithmb) Before writing Java code, as a guide for a general solutionc)
After defining Java variables so that the pseudocode and data types make
sensed) Before working out examples by hand in order to guide those
examples.
Answer: b) Before writing Java code, as a guide for a general solution
◍ In java, a two dimensional array in Java is really an "array of arrays.".
Answer: True
◍ 61) Consider the following code snippet:int[][] arr = { { 13, 23, 33 }, { 14,
24, 34 }};Identify the appropriate statement to display the value 24 from the
given array?a) System.out.println(arr[1][2]);b)
System.out.println(arr[2][2]);c) System.out.println(arr[1][1]);d)
System.out.println(arr[2][1]);.
Answer: c) System.out.println(arr[1][1]);
◍ 1) Which of the following loops executes the statements inside the loop
before checking the condition?a) forb) whilec) dod) do-for.
Answer: Answer: c) do

, ◍ 61) Consider the following code snippet:public class Employee{ private
String empID; private boolean hourly; public Employee(String employeeID,
boolean isHourly) { . . . }}Which of the following statements can be used to
create an object of type Employee?a) Employee anAuto = new Employee();
b) Employee anAuto = new Employee(10548, true);c) Employee anAuto =
new Employee("10548", true);d) Employee anAuto = new Employee(10548,
"true");.
Answer: c) Employee anAuto = new Employee("10548", true);
◍ III only.
Answer: 16) Which of the following statements is (are) true about an if
statement?I. It guarantees that several statements are always executed in a
specified order.II. It repeats a set of statements as long as the condition is
true.III. It allows the program to carry out different actions depending on the
value of a condition.
◍ When a compiler finds a syntax error in a program, what happens?.
Answer: The compiler continues and may report about other errors but does
not produce a Java class file
◍ Which of the following is a major functional limitation of arrays?.
Answer: arrays have a fixed size
◍ 84) Insert the missing code in the following code fragment. This fragment is
intended to implement a method to increase the speed of the motor by one
step if possible.public class Motor{ public static final STOPPED = 0; public
static final SLOW = 1; public static final MEDIUM = 2; public static final
FAST = 3; private int motorSpeed; . . . public void increaseMotorSpeed() {
if(motorSpeed < FAST) { ________ } }}a) motorSpeed ++;b) motorSpeed
= SLOW;c) motorSpeed = MEDIUM;d) motorSpeed = FAST;.
Answer: a) motorSpeed ++;
◍ 102) What is the output of the code snippet given below?int i = 0;while (i !=
11){ System.out.print(i + " "); i = i + 3;}a) No outputb) 0 3 6 9 12 15 18c) 0
1 3 5 7 9d) 0 3 6 9 .... (infinite loop).

Document information

Uploaded on
August 25, 2026
Number of pages
52
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$14.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TopGradeInsider
4.2
(13)
Sold
165
Followers
2
Items
55375
Last sold
11 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions