100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

Unit 1: Code HS quiz with correct answers latest 2023

Rating
-
Sold
-
Pages
6
Grade
A+
Uploaded on
17-03-2023
Written in
2022/2023

Unit 1: Code HS quiz with correct answers latest 2023Which of the following is not a primitive type? A. int B. double C. String D. boolean E. char C. String Which of the following statements is true about variables? A. The memory associated with a variable of a primitive type holds an actual primitive value. B. When a variable is declared final, its value can only be changed through a direct reassignment. C. A variable originally created as an int can be changed to store a double through casting. D. All of these choices are true A. The memory associated with a variable of a primitive type holds an actual primitive value. What is the value of x after this code runs? int x = 5; x = 10; x = 4; A. 5 B. 10 C. 4 D. true C. 4 What is the proper syntax to declare and initialize a variable called temperature to have the value 70.4? A. int temperature = 70.4; B. double temperature = 70.4; C. temperature = 70.4; D. float temperature = 70.4; E. temperature = (double) 70.4 B. double temperature = 70.4; What is the result of this expression? (int) (5 + 2 / 3 + 1) A. 5 B. 6 C. 6.67 D. 7 E. 0 B. 6 Which expression returns the 1's place of an integer x? A. x % 10 B. x / 10 C. x % 100 D. x + 1 A. x % 10 What is the value of myInteger after this line of code is executed? int myInteger = (int) 5.6; A. 6 B. 5.6 C. 5 D. 9 C. 5 What output will be produced by Sln("Hello"); Sln("Karel"); A. Hello Karel B. HelloKarel C. Hello Karel D. Error C. Hello Karel Refer to the following code segment: double myDouble = 1/4; Sln("1 / 4 = " + myDouble); The output of the code is: 1 / 4 = 0.0 The student wanted the output to be: 1 / 4 = 0.25 Which change to the first line of their code segment would get the student the answer that they wanted? A. int myDouble = 1/4; B. double myDouble = (double) 1/4; C. double myDouble = (int) 1/4; D. double myDouble = (int) (1.0/4.0); B. double myDouble = (double) 1/4; What is the result of this expression? 4 + 8 * 3 / 4 + 5 % 2 A. 5 B. 6 C. 12 D. 11 D. 11 Joe's Pizza is creating a program that will calculate the total amount of money an employee earns each week. Employees are paid by the hour and only work in 1 hour increments. Salaries start at minimum wage, but employees get a $0.50 raise after the first month. Which variables would be the best to store the hours and salary of the employees? A. double hours int salary B. int hours double salary C. boolean hours double salary D. int hours int salary E. double hours boolean salary ... What will the following code print? int n = 5; n ++; n ++; n += n; Sln(n); A. 12 B. 40 C. 14 D. 18 C. 14 Which of the following would equal 2? I. int x = 0; x ++; x += x; II. int y = 4; y ++; y /= 2; III. int z = 4; z += 2; z /= 2; A. I Only B. II Only C. III Only D. I and II Only E. I, II, and III D. I and II Only Given a and b as properly initialized integers, which of the following will result in a correct calculation with a decimal answer? A. double y = (double) (a / b); B. double y = a / b * 1.0; C. double y = a / b; D. double y = 1.0 * a / b; D. double y = 1.0 * a / b; Assume y is a properly initialized positive integer. Which of the following will always result in a value of 1? A. y ++; B. y --; C. y += y; D. y /= y; E. y -= y; D. y /= y; The following code is intended to print 8. int x = 23; double y = 3; Sln((int)(x / y)); What is printed and why? A. 7 because the values of x and y are integers so 23 / 3 evaluated to 7 B. 7 because x / y calculates to 7.66 then the cast to an int results in the value getting truncated to 7 C. 8 because the values of x and y are integers so 23 / 3 evaluated to 8 D. 8 because x / y calculates to 7.66 then the cast to an int results in the value getting rounded up to 8 B. 7 because x / y calculates to 7.66 then the cast to an int results in the value getting truncated to 7 What will the output of the following lines of code be? int x = 10; int y = x / 4; S("x + y = "); S(x + y); A. x + y = 12 B. x + y = 12 C. x + y = 12.5 D. x + y = 12.5 E. x + y = 102 A. x + y = 12 Which of the following print: Hello Java! I. Sln("Hello Java!"); II. S("Hello Java!"); III. S("Hello"); S("Java!"); IV. Sln("Hello"); Sln("Java!"); A. I and II only B. I, II, and III only C. I and III only D. I, II, and IV only E. I, II, III, and IV A. I and II only How many lines will be printed with the following statement? Sln("Hello"); Sln(" World"); S("Welcome to"); S("Java."); A. 1 B. 2 C. 3 D. 4 C. 3

Show more Read less
Institution
Code HS
Course
Code HS









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Code HS
Course
Code HS

Document information

Uploaded on
March 17, 2023
Number of pages
6
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

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.
StuviaExamHub Havard School
View profile
Follow You need to be logged in order to follow users or courses
Sold
459
Member since
4 year
Number of followers
355
Documents
17286
Last sold
4 weeks ago
EXAM HUB (LATEST UPDATE)

QUALITY WORK OF ALL KIND OF QUIZ or EXAM WITH GUARANTEE OF AN A+ latest updates Im an expert on major courses especially; psychology,Nursing, Human resource Management & Project writing. Assisting students with quality work is my first priority. I ensure scholarly standards in my documents . I assure a GOOD GRADE if you will use my work. Feel free to purchase n recommend others for 100% pass EXAMS!

3.7

85 reviews

5
39
4
10
3
17
2
6
1
13

Recently viewed by you

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

Frequently asked questions