Section 1

Preview this deck

Write a long integer literal that has the value thirty-seven

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (20)

Section 1

(20 cards)

Write a long integer literal that has the value thirty-seven

Front

37L

Back

Given two int variables , firstPlaceWinner and secondPlaceWinner, write some code that swaps their values . Declare any additional variables as necessary.

Front

int x; x = firstPlaceWinner; firstPlaceWinner = secondPlaceWinner; secondPlaceWinner = x;

Back

Given the variables taxablePurchases and taxFreePurchases (already declared and assigned values ), write an expression corresponding to the total amount purchased.

Front

taxablePurchases + taxFreePurchases

Back

Consider this code: "int s = 20; int t = s++ + --s;". What are the values of s and t?

Front

s is 20 and t is 40

Back

Declare a short variable named patientsAge.

Front

short patientsAge;

Back

Consider this code: "int v = 20; --v; System.out.println(v++);". What value is printed, what value is v left with?

Front

19 is printed, v ends up with 20

Back

Which of the following names in a program is equivalent to the name int?

Front

int

Back

Before a variable is used it must be

Front

declared

Back

Given an integer variable bridgePlayers, write a statement that increases the value of that variable by 4.

Front

bridgePlayers = bridgePlayers + 4

Back

Assume that children is an integer variable containing the number of children in a community and that families is an integer variable containing the number of families in the same community. Write an expression whose value is the average number of children per family.

Front

(double) children/families

Back

Assume that an int variable x that has already been declared , and initialized to a non-negative value . Write an expression whose value is the last (rightmost) digit of x.

Front

x%10

Back

An identifier that cannot be used as a variable name is a ...... word

Front

reserved

Back

Declare an integer variable named degreesCelsius.

Front

int degreesCelsius;

Back

Each of the walls of a room with square dimensions has been built with two pieces of sheetrock, a smaller one and a larger one. The length of all the smaller ones is the same and is stored in the variable small. Similarly, the length of all the larger ones is the same and is stored in the variable large. Write a single expression whose value is the total area of this room. DO NOT any method invocations.

Front

(small + large) * (small +large)

Back

Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced.

Front

(double) distance/ speed

Back

Given an integer variable strawsOnCamel, write a statement that uses the auto-increment operator to increase the value of that variable by 1.

Front

strawsOnCamel ++ ;

Back

Given an integer variable profits, write a statement that increases the value of that variable by a factor of 10.

Front

profits = profits * 10

Back

Which token is a literal?

Front

names for one specific value (Ie 2 and 3.1459)

Back

Declare a double variable named netWeight.

Front

double netWeight;

Back

Which token is NOT a keyword (language-determined identifier)?

Front

sum

Back