230647224
TROF05D 20240
Test: {O}
Date: 26 Aug 2024 Time: 08:35 39s
Section: 1 Max Marks[10]
QUESTION 1
INSTRUCTIONS FOR ANSWERING THIS QUESTION:
• State whether the following statements are TRUE or FALSE
Question: 1 (Multi) Max Marks = [1]
1.3 The start and end points of a flowchart are typically represented by ovals.
1) True [1]
2) False [0]
Your Answer True Your Mark = [1]
Question: 2 (Multi) Max Marks = [1]
1.10 In Java, identifiers should be meaningful.
1) True [1]
2) False [0]
Your Answer True Your Mark = [1]
Question: 3 (Multi) Max Marks = [1]
1.7 The equalsIgnoreCase() method is case-sensitive.
1) True [0]
2) False [1]
Your Answer True Your Mark = [0]
Question: 4 (Multi) Max Marks = [1]
1.6 An if statement must always have an accompanying else statement.
1) True [0]
2) False [1]
Your Answer False Your Mark = [1]
Question: 5 (Multi) Max Marks = [1]
1.5 The condition in an if statement must always evaluate to a boolean value.
1) True [1]
2) False [0]
Your Answer True Your Mark = [1]
Question: 6 (Multi) Max Marks = [1]
1.9 The logical AND operator (&&) returns true if both conditions are true.
1) True [1]
2) False [0]
Your Answer True Your Mark = [1]
Question: 7 (Multi) Max Marks = [1]
1.2 An else block is mandatory after an if block.
1) True [0]
2) False [1]
Your Answer True Your Mark = [0]
Question: 8 (Multi) Max Marks = [1]
1.1 Flowcharts are used to represent the logic of a program or process in a visual manner.
1) True [1]
2) False [0]
Your Answer True Your Mark = [1]
1/7
230647224
TROF05D 20240
Test: {O}
Question: 9 (Multi) Max Marks = [1]
1.8 You can use relational operators (<, <=, >, >=) within the condition of a switch statement.
1) True [0]
2) False [1]
Your Answer False Your Mark = [1]
Question: 10 (Multi) Max Marks = [1]
1.4 An else statement can exist without a preceding if statement.
1) True [0]
2) False [1]
Your Answer False Your Mark = [1]
Section: 2 Max Marks[10]
QUESTION 2 - MULTIPLE CHOICE
INSTRUCTIONS FOR ANSWERING THIS QUESTION:
• Select the correct answer for the following questions.tion here
Question: 1 (Multi) Max Marks = [1]
2.8 The following code section will display the word DONE only if which of the following options is true? if (a == 1 && b
== 3 && c != 5) System.out.print(“DONE”);
A) a is one, B is 3, C is 5. [0]
B) either a is 1 or b is 3 and c is not [0]
5.
C) either a is 1 and b is 3, or C is [0]
five.
D) a is 1, b is 3 and c is less or [1]
greater than 5.
Your Answer a is 1, b is 3 and c is less or Your Mark = [1]
greater than 5.
Question: 2 (Multi) Max Marks = [1]
2.4 In an expression a || b && c, if a is true, b is false, and c is true, what will be the result of the expression?
A) True [1]
B) False [0]
C) Compilation error [0]
D) Depends on context [0]
Your Answer True Your Mark = [1]
Question: 3 (Multi) Max Marks = [1]
2.6 Which of the following is a correct Boolean expression?
A) (iAge => 18 && cDept == “D”) [0]
B) (iAge >= 18 and cDept == “D”) [0]
C) (iAge >= 18 && cDept == ‘D’) [1]
D) (iAge >= 18 and cDept == ‘D’) [0]
Your Answer (iAge >= 18 && cDept == ‘D’) Your Mark = [1]
Question: 4 (Multi) Max Marks = [1]
2.7 In a Boolean expression, which operator is used to perform logical negation?
A) && [0]
B) || [0]
C) ! [1]
D) ^ [0]
Your Answer ! Your Mark = [1]
Question: 5 (Multi) Max Marks = [1]
2/7
230647224
TROF05D 20240
Test: {O}
2.2 When comparing Strings in Java, which method is recommended for content equality?
A) == operator (equality operator). [0]
B) equals( ) method of the String [1]
class.
C) stringCompareTo( ) method of [0]
the String class (used for
alphabetical order).
D) There's no built-in method for [0]
String comparison, because
strings are primitive data type.
Your Answer equals( ) method of the String Your Mark = [1]
class.
Question: 6 (Multi) Max Marks = [1]
2.10 Which of the following is a selection control structure?
A) for loop [0]
B) if statement [1]
C) DecimalFormat [0]
D) main [0]
Your Answer if statement Your Mark = [1]
Question: 7 (Multi) Max Marks = [1]
2.3 Which operator is commonly used to compare values in an if statement?
A) Assignment (=) [0]
B) Relational (==, !=, <, >, <=, >=) [1]
C) Arithmetic (+,-, *, /) [0]
D) Logical (&&, ||, !) [0]
Your Answer Relational (==, !=, <, >, <=, >=) Your Mark = [1]
Question: 8 (Multi) Max Marks = [1]
2.5 What is the role of the else block in an if-else statement?
A) To execute code when the if [0]
condition is true.
B) To create a loop. [0]
C) To define a function. [0]
D) To execute code when the if [1]
condition is false.
Your Answer To define a function. Your Mark = [0]
Question: 9 (Multi) Max Marks = [1]
2.9 Which of the following expressions is equivalent to (x > 5)&&(x < 10) ?
A) !(x <= 5) && (x >= 10) [0]
B) (x > 5) || (x < 10) [0]
C) !(x <= 5 || x >= 10) [1]
D) !(x > 5) || (x < 10) [0]
Your Answer !(x <= 5 || x >= 10) Your Mark = [1]
Question: 10 (Multi) Max Marks = [1]
2.1 What is the purpose of an if statement?
A) To execute a block of code [0]
unconditionally
B) To create a loop [0]
C) To make decisions based on [1]
conditions
D) To define a function [0]
3/7
230647224
TROF05D 20240
Test: {O}
Your Answer To make decisions based on Your Mark = [1]
conditions
Section: 3 Max Marks[5]
QUESTION 3
INSTRUCTIONS FOR ANSWERING THIS QUESTION:
• This is a short answer question. Provide only the answer required.
• Answers should be straight forward.
• No long programs or code snippets are expected.
Question: 1 (CodeFrag) Max Marks = [2]
3.1 What is the difference between and if statement and the if-else?
Question: 2 (CodeFrag) Max Marks = [1]
3.2 What will be the exact output of the following segment of code? boolean bChoice = false; if (!bChoice)
System.out.println("Go"); else System.out.println("Stop");
Question: 3 (CodeFrag) Max Marks = [2]
3.3 What will be the exact output of the following segment of code? int x = 18; System.out.print(“1. ”); if (x > 10)
System.out.print(x + " is greater. "); if (x < 20) System.out.print(x + " is less. ");
Section: 4 Max Marks[5]
QUESTION 4 - CONVERT FLOWCHART INTO JAVA CODE
4/7
230647224
TROF05D 20240
Test: {O}
INSTRUCTIONS FOR ANSWERING THIS QUESTION:
• Refer to the Question Paper for the question.
• Use Notepad++ to write your pseudocode.
• Copy and paste here.
Question: 1 (CodeFrag) Max Marks = [5]
QUESTION 4: PASTE YOUR ANSWER HERE.
Section: 5 Max Marks[15]
QUESTION 5 - WRITE JAVA PROGRAM
INSTRUCTIONS FOR ANSWERING THIS QUESTION:
• Refer to the Question Paper for the question.
• Use Notepad++ to write your code.
• Compile and fix all errors, then paste on EC.
Question: 1 (CodeFrag) Max Marks = [15]
QUESTION 5: PASTE YOUR ANSWER HERE.
5/7
230647224
TROF05D 20240
Test: {O}
Section: 6 Max Marks[15]
QUESTION 6 - WRITE JAVA PROGRAM
INSTRUCTIONS FOR ANSWERING THIS QUESTION:
• Refer to the Question Paper for the question.
• Use Notepad++ to write your code.
• Compile and fix all errors, then paste on EC.
Question: 1 (CodeFrag) Max Marks = [15]
QUESTION 6: PASTE YOUR ANSWER HERE.
6/7
230647224
TROF05D 20240
Test: {O}
- = end = -
Total Marks [39 / 60]
7/7
Powered by TCPDF (www.tcpdf.org)
Powered by TCPDF (www.tcpdf.org)