• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 9 pages
Exam (elaborations)

Java with Data Structures Questions With Correct Answers Already Passed 2025|2026!!!!

Document preview thumbnail
Preview 2 out of 9 pages

Java with Data Structures Questions With Correct Answers Already Passed 2025|2026!!!!

Content preview

Java with Data Structures Questions
With Correct Answers Already Passed
2025|2026!!!!
Data object CORRECT ANSWERS a box in memory that holds one value

Type CORRECT ANSWERS the range of values that a data object can hold (int, float,
double, boolean, char,string)

Variable CORRECT ANSWERS the name of a data object

Identifier CORRECT ANSWERS used to name something (variables, classes,
packages, interfaces) must start with a letter, underscore, or dollar sign. Can contain
numbers. May not contain spaces. Variables start with lower-case letters, classes start
with upper-case letters, literals are all upper-case.

Definition CORRECT ANSWERS creates a data object and assigns it a type

declaration CORRECT ANSWERS binds a variable to a data object

Initialization CORRECT ANSWERS giving a variable a value

Primative data types CORRECT ANSWERS atomic, values not divisible into smaller
parts (int, double, boolean, char, byte, short, long, and float)

Assignment Statement CORRECT ANSWERS used to change the value stored in a
data object

Expressions CORRECT ANSWERS combine operators, variables, literals, and method
invocations. They evaluate to a single value

Literals CORRECT ANSWERS a symbol that evaluates to itself

Constants CORRECT ANSWERS a named literal (ex PI = 3.1415926)

Relational operators CORRECT ANSWERS compare two values ( int, boolean, or
double) and return true or false depending on how they compare

Conditional Evaluation CORRECT ANSWERS ex. if-else statement

Compound statement CORRECT ANSWERS doing more than a single statement within
an if else statement, you create a block of statements or compound statement

, Multi-way statement CORRECT ANSWERS if{} else if {} statements

Switch Statement CORRECT ANSWERS implements multi-way branches based on the
value of an expression.
switch (class) {
case 1: System.out.println("COSC 150"); break;
case 2: System.out.println("COSC 160"); break;

}

Multi-way If vs Switch CORRECT ANSWERS The switch statement is more compact
than the multi-way if statement.
It should be used when the code to be done is based on the value of an int or char
expression.
However, the switch statement cannot be floating point expressions and so the multi-
way if statement must be used.
The switch statement may be used for strings in Java SE 7 and later.

Count controlled loops CORRECT ANSWERS when you know ahead of time how many
times to loop (for)

Sentinel controlled loops CORRECT ANSWERS when reading until a special value, the
sentinel (While)

general condition loops CORRECT ANSWERS arbitrary loops, loops while a condition
is true

iterations CORRECT ANSWERS number of times the loops is to be executed

break statement CORRECT ANSWERS can be used to jump out of a loop prematurely

continue statement CORRECT ANSWERS will cause the program to skip over any
remaining part of the loop body and begin the next iteration of the loop

return statement CORRECT ANSWERS will exit the method that the loop is in

arrays CORRECT ANSWERS a data object that can hold multiple objects all of the
same type that use static allocation of space

for each statement CORRECT ANSWERS enhanced for statement, designed to iterate
through collections and arrays int[] numbers;
for(int item : numbers)

Selection Sort CORRECT ANSWERS we select the smallest element and put it in the
right place. O(n) swaps; O(n^2) comparisons; Best for small values of N.

Document information

Uploaded on
August 6, 2025
Number of pages
9
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$13.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.
ElevatedExcellence
3.8
(178)
Sold
955
Followers
505
Items
18436
Last sold
3 days 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