Contents in this page: 1) Tutorial on Operators and Expressions
2) MCQS on Operators
Scroll down to browse the content.
Q) What will be the output of the following code statements? [Amcat]
integer a = 50, b = 25, c = 0
print ( a > 45 OR b > 50 AND c > 10 )
Op 1: 1
Op 2: 0
Op 3: -1
Op 4: 10
Correct Op : 1
Q) What will be the output of the following code statements? [Amcat]
integer a = 50, b = 25, c = 5
print a * b / c + c
Op 1: 120
Op 2: 125
Op 3: 255
Op 4: 250
Correct Op : 3
Q) What will be the output of the following code statements? [Amcat]
integer a = 10, b = 35, c = 5
print a * b / c - c
Op 1: 65
Op 2: 60
Op 3: Error
Op 4: 70
Correct Op : 1
Q) integer a = 10, b = 35, c = 5 [Amcat]
Comment about the output of the two statements?
print a * b + c / d
print c / d + a * b
Op 1: Differ due to left-to-right precedence
Op 2: Differ by 10
Op 3: Differ by 20
Op 4: Same
Correct Op : 4
Q) integer a = 40, b = 35, c = 20, d = 10 [Amcat]
Comment about the output of the following two statements:
print a * b / c - d
print a * b / (c - d)
Op 1: Differ by 80
Op 2: Same
Op 3: Differ by 50
Op 4: Differ by 160
Correct Op : 1
Q) integer a = 60, b = 35, c = -30 [Amcat]
What will be the output of the following two statements:
print ( a > 45 OR b > 50 AND c > 10 )
print ( ( a > 45 OR b > 50 ) AND c > 10 )
Op 1: 0 and 1
Op 2: 0 and 0
Op 3: 1 and 1
Op 4: 1 and 0
Correct Op : 4
Q) What will be the output of the following pseudo-code statements:[Amcat]
integer a = 984, b=10
//float is a data-type to store real numbers.
float c
c = a / b
print c
Op 1: 984
Op 2: 98.4
Op 3: 98
Op 4: Error
Correct Op : 3
Q) What will be the output of the following pseudo-code statements:[Amcat]
integer a = 984
//float is a data-type to store rational numbers.
float b= 10, c
c = a / b
print c
Op 1: 984
Op 2: Error
Op 3: 98.4
Op 4: 98
Correct Op : 3