Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

VU Past Papers CS201-Most Importants MCQs on Logical Operators

Q#1: What is the purpose of the if/else structure in programming?
(A) To execute a block of statements when a condition is true
(B) To execute a block of statements when a condition is false
(C) To execute different blocks of statements based on whether a condition is true or false
(D) To skip the execution of statements when a condition is false
Answer: (C) To execute different blocks of statements based on whether a condition is true or false

Q#2: In the given program construct, what message will be displayed if Amer’s age is less than Amara’s?
(A) “Amer is older than Amara”
(B) “Amer is younger than Amara”
(C) “Amer is younger than or is of the same age as Amara”
(D) “Amer is greater than Amara”
Answer: (C) “Amer is younger than or is of the same age as Amara”

Q#3: What operator is used to check if Amer is greater than or is of the same age as Amara?
(A) >
(B) >=
(C) <
(D) <=
Answer: (B) >=

Q#4: According to the logical operators section, what does the && operator do?
(A) Combines conditions with OR
(B) Combines conditions with AND
(C) Negates a condition
(D) Reverses the meaning of a condition
Answer: (B) Combines conditions with AND

Q#5: How are logical operators AND (&&) and OR (||) used in programming?
(A) They are unary operators
(B) They are binary operators
(C) They work with numeric values
(D) They are used for looping
Answer: (B) They are binary operators

Q#6: In the truth table for the && operator, what is the result when both Expression 1 and Expression 2 are true?
(A) False
(B) True
(C) True only if Expression 1 is true
(D) False only if Expression 1 is false
Answer: (B) True

Q#7: Which operator has a higher precedence than the || operator?
(A) &&
(B) ||
(C) !
(D) <
Answer: (A) &&

Q#8: What is the purpose of the logical negation operator (!) ?
(A) To combine conditions with AND
(B) To reverse the meaning of a condition
(C) To create a truth table
(D) To check for equality
Answer: (B) To reverse the meaning of a condition

Q#9: In Sample Program 2, when does the program apply a 15% discount on the bill amount?
(A) When the bill amount is greater than 5000
(B) When the bill amount is less than or equal to 5000
(C) When the bill amount is exactly 5000
(D) When the bill amount is a multiple of 5000
Answer: (A) When the bill amount is greater than 5000

Q#10: What is the role of the if statement in Sample Program 2?
(A) To calculate the payable amount
(B) To declare variables
(C) To prompt the user for input
(D) To make a decision based on the bill amount
Answer: (D) To make a decision based on the bill amount

Q#11: What will be displayed if the user enters Amer’s age equal to Amara’s age?
(A) “Amer is older than Amara”
(B) “Amer is younger than Amara”
(C) “Amer is younger than or is of the same age as Amara”
(D) “Amer is greater than Amara”
Answer: (C) “Amer is younger than or is of the same age as Amara”

Q#12: How does the program handle the case when Amer’s age is the same as Amara’s age?
(A) It displays “Amer is older than Amara”
(B) It displays “Amer is younger than Amara”
(C) It displays “Amer is younger than or is of the same age as Amara”
(D) It does not handle this case properly
Answer: (C) It displays “Amer is younger than or is of the same age as Amara”

Q#13: In the logical operators section, what does the OR (||) operator do?
(A) Combines conditions with AND
(B) Combines conditions with OR
(C) Negates a condition
(D) Reverses the meaning of a condition
Answer: (B) Combines conditions with OR

Q#14: Which statement about logical operators is true?
(A) They are used for arithmetic operations
(B) They always return numeric values
(C) They are binary operators and take two operands
(D) They cannot be combined with relational operators
Answer: (C) They are binary operators and take two operands

Q#15: In the truth table for the || operator, what is the result when both Expression 1 and Expression 2 are false?
(A) True
(B) False
(C) True only if Expression 1 is true
(D) False only if Expression 1 is false
Answer: (B) False

Q#16: What is the purpose of the else part in the if/else structure?
(A) To execute when the condition in the if statement is true
(B) To execute when the condition in the if statement is false
(C) To combine conditions with AND
(D) To create a truth table
Answer: (B) To execute when the condition in the if statement is false

Q#17: How are logical operators used in decision-making in programming?
(A) They are used to declare variables
(B) They are used to calculate values
(C) They are used to combine conditions for decision-making
(D) They are used to create loops
Answer: (C) They are used to combine conditions for decision-making

Q#18: What does the if statement in Sample Program 2 test?
(A) The discount rate
(B) The net payable amount
(C) The amount entered by the user
(D) The total bill amount
Answer: (D) The total bill amount

Q#19: Which operator is used for logical negation in programming?
(A) &&
(B) ||
(C) !
(D) >=
Answer: (C) !

Q#20: How does the logical negation operator (!) affect a false condition?
(A) It remains false
(B) It becomes true
(C) It is not affected
(D) It depends on the other conditions in the expression
Answer: (B) It becomes true

Contents Copyrights Reserved By T4Tutorials