1/49
Flashcards covering key concepts from Java programming, including primitive types, boolean expressions, and coding problems.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
Default value of uninitialized int in Java
0
Primitive type for true/false values
Boolean
Declaration for a String variable named 'name'
String name;
Primitive type for decimal numbers
double
Result of 10 / 4 in integer division
2
Declaration for a boolean variable named 'isActive'
boolean isActive;
What happens when an int is divided by a double?
It auto casts to double.
Default value of a boolean in Java
false
Primitive types on the AP Test
int, double, boolean
Result of 3.0 / 2 in Java
1.5
Result of true || false
True
Result of true && false
False
Evaluation of !(x == 5) when x = 5
False
Boolean expression for x not between 10 and 20 inclusive
!(x >= 10 && x <= 20)
Result of !(a > 5 || b < 3) when a = 6 and b = 2
False
Simplification of !(x && y) using De Morgan's Law
!x || !y
Simplification of !(a || b) using De Morgan's Law
!a && !b
Simplification of !(x > 5 && y < 10) using De Morgan's Law
!x || y >= 10
Output of System.out.println(a / 2 * 2) when a = 7
6
Issue with 'double value = 3.7; int num = value;'
Cannot assign a double to an int without explicit casting.
Code to declare int variable 8, cast to double and print
int num = 8; double result = (double) num; System.out.println(result);
Boolean expression for x divisible by 3 but not by 5
x % 3 == 0 && x % 5 != 0
Output when x = 5 and x > 3 && x < 10
Orange
Result of ! (10 > 5 || 2 < 3)
False
Result when x = 8, y = 6 for x == 8 || y != 5 && y == 6
True
Default value of uninitialized int variable in Java
0
Primitive type for true/false values
Boolean
Valid declaration for a String variable
String name;
Primitive type for storing decimal numbers
double
Result of 10 / 4 in integer division
2
Declaration of a boolean variable
boolean isActive;
Result when dividing an int by a double
It auto casts to double.
Default value of a boolean in Java
false
Primitive types on the AP Test
int, double, boolean
Result of 3.0 / 2 in Java
1.5
Result of true || false
True
Result of true && false
False
Evaluation of !(x == 5) when x = 5
False
Boolean expression that checks if x is not between 10 and 20 inclusive
!(x >= 10 && x <= 20)
Result of !(a > 5 || b < 3) when a = 6 and b = 2
False
Simplified expression of !(x && y) using De Morgan's Law
!x || !y
Simplified expression of !(a || b) using De Morgan's Law
!a && !b
Simplified expression of !(x > 5 && y < 10) using De Morgan's Law
!x || y >= 10
Output of code int a = 7; System.out.println(a / 2 * 2);
6
Problem in code double value = 3.7; int num = value;
Cannot assign a double to an int without explicit casting.
Code to declare an int variable with value 8 and cast to double
int num = 8; double result = (double) num; System.out.println(result);
Boolean expression to check if x is divisible by 3 but not by 5
x % 3 == 0 && x % 5 != 0
Output of code int x = 5; if (x > 3 && x < 10)…
Orange
Output of code boolean result = ! (10 > 5 || 2 < 3); System.out.println(result);
false
Output of expression x == 8 || y != 5 && y == 6 when x = 8 and y = 6
true