Back to marketplace

Variables

No description yet. This curated deck is ready for daily study.

Total cards: 7•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (7)

#1
Front (Question)

An int always takes ___ bytes

Back (Answer)

4

#2
Front (Question)

A fraction multiplied by an integer returns ____

Back (Answer)

zero

#3
Front (Question)

To avoid truncation (operation using two integers)….

Back (Answer)

cast one of them to a double BEFORE the operation is applied (i.e. “a / (double) b” NOT “(double) (a/b)*. If at least one of the operands is a double, there is no need to cast the other one–it is promoted to a double automatically

#4
Front (Question)

Simply saying (1/2) will return what?

Back (Answer)

• This is because when one divides two integers, the resulting double is rounded DOWN to an integer

#5
Front (Question)

== vs. .equals

Back (Answer)

== is true if and only if the two variables refer to exactly the same object (ADDRESSES). .equals compares the CONTENTS of the two objects (used for strings, primarily)

#6
Front (Question)

De Morgan’s Laws

Back (Answer)

!(a && b) is the same as !a || !b !(a || b ) is the same as !a && !b

#7
Front (Question)

Short-circuit evaluation

Back (Answer)

If the value of the first operand is sufficient to determine the result, then the second operand is NOT evaluated. For example: int x = 0, y = 3; String op = “/” if (op.equals(“/”) && (x!= 0) && (y/x > 2) do stuff else do other stuff This code WILL compile and execute without error because although y/x is undefined, we never get that far b/c the second operand fails