AP Computer Science 1-8
What is casting in Java?
Casting is turning a value of one type into another type.
Which of the below is not a primitive type in Java?
apple
Which of the following is a proper way to declare and initialize a variable in Java?
int myNumber = 10;
What does this Java expression evaluate to?
true
What does this Java expression evaluate to? 80 >= 80
true
Which of the below is an example of a boolean?
true
Which of the below is a logical operator?
!
Which of the below is NOT a Java arithmetic operator?
#
What is the result of this expression? 150 % 100
50
What will this code segment output? System.out.println("Hello"); System.out.println("World");
Hello World
Which code segment will print "Hello Karel" to the screen in Java?
System.out.println("Hello Karel");
Which of the following is NOT a comparison operator?
?
What will this code segment output if the user inputs the number 10? int yourInteger = readInt("Please input a number"); System.out.println(yourInteger);
10
What will this java expression evaluate to? (int) 9.9
9
What is a boolean in Java?
A true or false value
Which of these input methods was not introduced in the video?
readChar