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 3 out of 16 pages
Exam (elaborations)

CS 1400 MIDTERM EXAM 2025 QUESTIONS AND ANSWERS

Document preview thumbnail
Preview 3 out of 16 pages

What does the combination of a double and an integer get you? - ANS A decimal What is the output of the following code segment? Sln( (double) (5 / 2) ); - ANS 2.0 What is the result of the Modulus Division? Sln( 11 % 4 ) - ANS 3 What is the output of the following code segment? Sln(1 + 2 + "abc" + 3 + 4); - ANS 3abc34 What is the code called that is written in English and is used to help you work out the logic in an algorithm? - ANS Pseudocode Which is the best name for a variable in camel case that will store a person's first name? - ANS firstName What is the best data type for a variable that will store a street name - ANS String What is the output of the following code segment? CS 1400 MIDTERM EXAM 2025 QUESTIONS AND ANSWERS Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 2 Sln(3 + 4 % 3); - ANS 4 What type of programming error will allow your program to run, but give incorrect output? - ANS Logic Error What is the correct syntax for a single line comment? - ANS // What is the correct syntax for a Multi-line comment in Java? - ANS /* */ What is the result of the Floating Point Division? Sln( 11.0 / 4 ); - ANS 2.75 What type of code are you writing when you are coding in Java? - ANS Source Code What is the result of the Integer Division? Sln( 11 / 4 ) - ANS 2 What is the best name for a variable to store the number of computers in a room? - ANS numComputers What is the best data type to store the number of computers in a room? - ANS int Which would correctly read a value an int value from the keyboard given the following Scanner? Scanner keyboard = new Scanner(S); - ANS int num = Int(); Which would correct

Content preview

CS 1400 MIDTERM EXAM 2025
QUESTIONS AND ANSWERS




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


What is the output of the following code segment?

System.out.println( (double) () ); - ANS 2.0


What is the result of the Modulus Division?

System.out.println( 11 % 4 ) - ANS 3


What is the output of the following code segment?

System.out.println(1 + 2 + "abc" + 3 + 4); - ANS 3abc34


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


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



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


What is the output of the following code segment?
Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 1

,System.out.println(3 + 4 % 3); - ANS 4


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



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



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


What is the result of the Floating Point Division?

System.out.println( 11. ); - ANS 2.75



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


What is the result of the Integer Division?

System.out.println( ) - ANS 2


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



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


Which would correctly read a value an int value from the keyboard given the following
Scanner?

Scanner keyboard = new Scanner(System.in); - ANS int num = keyboard.nextInt();


Which would correctly read the entire line of text from the keyboard given the following
Scanner?
Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 2

, Scanner keyboard = new Scanner(System.in); - ANS String line = keyboard.nextLine();


What is the purpose of the following line of code?

Scanner keyboard = new Scanner(System.in); - ANS 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)? - ANS boolean


What would be displayed by the following code segment?
int num = 5;
num += 3;

System.out.println(num); - ANS 8



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



What is the best data type to store a persons' street address? - ANS 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)

Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 3

Document information

Uploaded on
May 27, 2025
Number of pages
16
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.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.
Brightstars
3.3
(38)
Sold
253
Followers
7
Items
13601
Last sold
1 week 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