Computer Science Quiz 2 Manzoor
Q1. Another name of conditional operator is
(a) Unary Operator
(b) Binary operator
(c) Bitwise operator
(d) Ternary Operator
Q2. _______________structures is a selection structure:
(a) if
(b) If-else
(c) None
Q3. ______________structures is the simplest form of decision making structure:
(a) if-else
(b) switch
(c) nest if-else
(d) If
Notes: The if statement is the simplest example of a decision structure. In an if statement a logical test is made which can evaluate to either true or false. If the result of the test is true, the statements in the if branch are executed.
Q4. __________________ is used for making two-way decision:
(a) if-else
(b) If
(c) Conditional operator
(d) None of these
Notes: operator, useful for making two way decisions: Conditional
Q5. __________________ is not used for making two-way decision:
(a) if-else
(b) If
(c) Nested if
(d) None of these
Notes: Nested if for more than 2 decisions
A (c or d) or B ( e or f)
https://www.geeksforgeeks.org/decision-making-c-c-else-nested-else/
Q6. The conditional operator is an alternative of:
(a) if
(b) Simple if-else
(c) Nested if
(d) None
Notes: if: condition being true or false
https://www.geeksforgeeks.org/ternary-operator-in-python/
Answer Table
(a) Unary Operator
(b) Binary operator
(c) Bitwise operator
(d) Ternary Operator
Notes: ternary operator in C which is also called Conditional operator. The ‘?’ and ‘:” are called ternary operators because they take 3 arguments.
( condition) ? (Statement 1) : (Statement 2);
(a) if
(b) If-else
(c) None
Notes: if-else selection structures are used when only one boolean condition is necessary. In if-else structures, a specific action will be performed if the boolean condition is true and another action, if the condition is false.
Q3. ______________structures is the simplest form of decision making structure:
(a) if-else
(b) switch
(c) nest if-else
(d) If
Notes: The if statement is the simplest example of a decision structure. In an if statement a logical test is made which can evaluate to either true or false. If the result of the test is true, the statements in the if branch are executed.
Q4. __________________ is used for making two-way decision:
(a) if-else
(b) If
(c) Conditional operator
(d) None of these
Notes: operator, useful for making two way decisions: Conditional
Q5. __________________ is not used for making two-way decision:
(a) if-else
(b) If
(c) Nested if
(d) None of these
Notes: Nested if for more than 2 decisions
A (c or d) or B ( e or f)
https://www.geeksforgeeks.org/decision-making-c-c-else-nested-else/
Q6. The conditional operator is an alternative of:
(a) if
(b) Simple if-else
(c) Nested if
(d) None
Notes: if: condition being true or false
https://www.geeksforgeeks.org/ternary-operator-in-python/
Answer Table
Comments
Post a Comment