Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

1. Boolean opeartors are also known as logical operators.
a) True
b) False

View Answer

Answer: a [Reason:] Boolean operators result in boolean values like true or false.

2. Which of the following is a valid boolean operator?
a) and(&&)
b) or(||)
c) not(!)
d) All of the mentioned

View Answer

Answer: d [Reason:] We have three boolean operators which are and, or, not.

3. The boolean operator && only result in true when both the values are true?
a) True
b) False

View Answer

Answer: a [Reason:] The && operator only results in true when both the values are true rest all cases it evaluates to false.

4. What will the following expression evaluate to?
true && false
a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: b [Reason:] Boolean operator && evaluates to true only when both the values are true.

5. What will be the output of the given code?

boolean_1 = 77 < 78 && 77 < 77
puts boolean_1

a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: b [Reason:] 77<78 is true but 77<77 is false hence the overall expression will evaluate to false.
Output:
False

6. What will the following expression evaluate to?
true || false
a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: a [Reason:] Boolean operator || evaluates to true only when both the values are true or one is true and other is false.

7. What will the following expression evaluate to?
(true && false) || (!true)
a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: b [Reason:] Boolean operator && evaluates to true only when both the values are true and !true means false hence the whole expression will evaluate to false.

8. What will the following expression evaluate to?
!true && !false
a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: b [Reason:] Boolean operator && evaluates to true only when both the values are true.

9. What will be the output of the given code?

 boolean_1 = (3 < 4 || false) && (false || true)
puts boolean_1

a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: a [Reason:] 3<4 is true and true or false will evaluate to true hence the overall expression will evaluate to true.
Output:
True

10. What will be the output of the given code?

 boolean_1 = !(3 < 4 || false) && (false || true)
puts boolean_1

a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: b [Reason:] 3<4 is true and true or false will evaluate to true hence the overall expression will evaluate to true but the ! used will make the whole expression evaluate to false.
Output:
False

11. What will be the output of the given code?

 boolean_1 = 2**3 != 3**2 || true
puts boolean_1

a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: a [Reason:] 2**3=8 and 3**2=9 both the values are not equal is true and true or true will evaluate to true hence the overall expression will evaluate to true.

Output:
True

12. What will be the output of the given code?

 boolean_1 = false || -10 > -9
puts boolean_1

a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: a [Reason:] -10 is not greater than -9 hence the output will be false || false which is false.

Output:
False

13. What will be the output of the given code?

 boolean_1 = !(700 / 10 == 70)
puts boolean_1

a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: b [Reason:] 700/10=70 which is true but the ! before 700/10==70 will evaluate to false hence the overall expression will evaluate to false.

Output:
False

14. What will be the output of the given code?

 boolean_1 = !true
puts boolean_1  
boolean_2 = !true && !true
puts boolean_2

a) True True
b) False False
c) True False
d) None of the mentioned

View Answer

Answer: c [Reason:] !true = false and !true and !true will evaluate to false.

Output:
False
False

15. What will be the output of the given code?

 boolean_2 = !true && (!true || 100 != 5**2)
puts boolean_2

a) True
b) False
c) Error
d) None of the mentioned

View Answer

Answer: b [Reason:] 100 != 5**2 is true and true || false is true but true and !true is false hence the overall expression will evaluate to false.

Output:
False

Synopsis and Project Report

You can buy synopsis and project from distpub.com. Just visit https://distpub.com/product-category/projects/ and buy your university/institute project from distpub.com

.woocommerce-message { background-color: #98C391 !important; }