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 2 out of 10 pages
Exam (elaborations)

CS 1400 MIDTERM EXAM QUESTIONS WITH VERIFIED ANSWERS

Document preview thumbnail
Preview 2 out of 10 pages

CS 1400 MIDTERM EXAM QUESTIONS WITH VERIFIED ANSWERS

Content preview

CS 1400 MIDTERM EXAM QUESTIONS WITH VERIFIED
ANSWERS

What does the combination of a double and an integer get you? - Answers - A decimal

What is the output of the following code segment?
System.out.println( (double) () ); - Answers - 2.0

What is the result of the Modulus Division?
System.out.println( 11 % 4 ) - Answers - 3

What is the output of the following code segment?
System.out.println(1 + 2 + "abc" + 3 + 4); - Answers - 3abc34

What is the code called that is written in English and is used to help you work out the
logic in an algorithm? - Answers - Pseudocode

Which is the best name for a variable in camel case that will store a person's first
name? - Answers - firstName

What is the best data type for a variable that will store a street name - Answers - String

What is the output of the following code segment?
System.out.println(3 + 4 % 3); - Answers - 4

What type of programming error will allow your program to run, but give incorrect
output? - Answers - Logic Error

What is the correct syntax for a single line comment? - Answers - //

What is the correct syntax for a Multi-line comment in Java? - Answers - /* */

What is the result of the Floating Point Division?
System.out.println( 11. ); - Answers - 2.75

What type of code are you writing when you are coding in Java? - Answers - Source
Code

What is the result of the Integer Division?
System.out.println( ) - Answers - 2

What is the best name for a variable to store the number of computers in a room? -
Answers - numComputers

, What is the best data type to store the number of computers in a room? - Answers - int

Which would correctly read a value an int value from the keyboard given the following
Scanner?
Scanner keyboard = new Scanner(System.in); - Answers - int num = keyboard.nextInt();

Which would correctly read the entire line of text from the keyboard given the following
Scanner?
Scanner keyboard = new Scanner(System.in); - Answers - String line =
keyboard.nextLine();

What is the purpose of the following line of code?
Scanner keyboard = new Scanner(System.in); - Answers - Creates an object that will
allow you to read in from the keyboard

What is the best data type to store the state of a light bulb (on or off)? - Answers -
boolean

What would be displayed by the following code segment?
int num = 5;
num += 3;
System.out.println(num); - Answers - 8

What is the best data type to represent PI or 3.14159? - Answers - double/float

What is the best data type to store a persons' street address? - Answers - String

The following code segment is shown both with an IF structure and an IF Else structure.
What is the final output of num in both situations?

(If Series)
int num = 0;
int test = 7;
if(test == 7){num++;}
if(test > 0) {num++;}

(If Else Structure)
int num = 0;
int test = 7;
if(test == 7){num++;}
else if(test > 0) {num++;} - Answers - If Series: 2
If Else Structure: 1

What is the difference between = and == in Java? - Answers - = is to assign a value, ==
is to compare

Document information

Uploaded on
July 24, 2026
Number of pages
10
Written in
2025/2026
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.
GEEKA
3.8
(361)
Sold
2138
Followers
1448
Items
58662
Last sold
10 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