Lecture: Quiz 1 Flashcards
Lessons tackled in Lecture of BIT 112: Fundamentals of Programming. About statements
What is the purpose of the if-else-if statement in Java?
To handle multiple complex selections
What does the if-statement check?
If a Boolean expression is true
Which statement correctly initializes a BufferedReader?
BufferedReader dataln = new BufferedReader(new InputStreamReader(System.in));
What does the else-if statement allow you to do?
Chain multiple conditions
What must be included when using BufferedReader to handle input?
try-catch block
Which class is used to read character input from a byte stream in Java?
InputStreamReader
Which of the following is a valid way to declare a variable in Java?
int number1;
Which method is used to read a line of text from the keyboard using BufferedReader?
readLine()
Which of the following statements is true about the if statement?
It can evaluate expressions.
What will be the output of the following code if score is 75:
if (score >= 70)
System.out.println(“Good”);
else
System.out.println(“Needs Improvement);?
Good
What is the purpose of the try-catch block in Java?
To handle exceptions
Which of the following is NOT a decision control structure?
For loop
What is the output of the following code if x is 10:
if (x < 5)
System.out.println(“Low”);
else
System.out.println(“High”); ?
High
What is the output of the following code if grade is 50:
if (grade > 60)
System.out.println(“Passed”);
else
System.out.prinln(“Failed”); ?
Failed
What is the purpose of JOptionPane in Java?
To pop up dialog boxes