Q1medium
A school grading system assigns 'A' for ≥ 90, 'B' for ≥ 80, and 'C' for ≥ 70. What is the most efficient control flow structure to determine a single student's grade?
Topic-wise practice questions for Problem Solving & Analytical Skills. Test your knowledge, check solutions on demand, and pace your preparation.
i = 1
while (i < 5):
print(i)
i = i + 1
What is the logical error in this code?
if (userRole = "Admin") { ... }
x = 10
if (x > 5):
if (x == 10):
print("A")
print("B")
else:
print("C")
What will this output?
for i from 1 to 4:
for j from 1 to 3:
print("Hello")
sum = 0
for i from 1 to 3:
sum = sum + i
print(sum)
color = "Red"
switch (color):
case "Red":
print("Stop")
case "Green":
print("Go")
In languages like C, Java, or JS, what is printed?
A = 5
B = 10
A = A + B
B = A - B
A = A - B
What are the final values of A and B?