QBASIC Output Questions (with answer key)
By Sir. Subhendu
Output Questions:
1. 2.
a = 25: b = a \ 10 a = 2574
c = a Mod 10 b = (a Mod 100) \ 10
d = Int(a / 10) c = (a Mod 1000) \ 100
Print a + b; c + d; d = (a Mod 10)
If (a > b Or c <> d) Then a = Int(a \ 100)
Print "a"; Select Case a
Else Case 4
If (a <> c) Then a = a \ 10
a=a+b Case 2
Else a=a*2
c=c-a Case Else
End If Print "Hi"; a
Print "a+b"; End Select
End If Print a;
Print a - b; c + d; Print b
Print c; d
3. 4.
x=3^2+2 p = -23: q = p Mod 2
y = x ^ (2 - 1) + -3 ^ 2 * 2 q = q + Int(p / 10)
Print x; y p = p + Int(13 / -10)
x=x+y p = -p + -1 * (p + q)
y=y-x Print p; "q"; p; "p"; q
x=x+y
If (x Mod 2 = y Mod 2) Then
Print x; -y
Else
Print -x; y
Print "Bye";
End If
5. 6.
A = 28416 a = 3474
If (A Mod 2 = 0) Then b = a Mod 2
A = Int(-A / 100) c = Int(-a / 10)
If (A Mod 2 = 0) Then a = a \ 10
A = Int(A / 10) a=a-b
If (A Mod 2 = 0) Then Print a; b;
A = Int(A \ 10) If (a <> b Or a Mod 2 = 0) Then
End If a=a+b
Print "A"; Print "Okay";
End If Else
Print A; c=c+a
End If End If
Print A; Print Int(-a \ 10) + a \ 10
QBASIC Output Questions (with answer key)
By Sir. Subhendu
7. 8.
If (a Mod 2 = 0) Then ch = -13 Mod 3 + 3
a = -26 Select Case ch
Else Case 3
b = 12 a = ch
Print a + b; Case 1
End If a = -2 ^ 3 + 2
Print a - b; Case 2
If (a > b And b Mod 2 = 0) Then a = a Mod ch
b = a \ 10 Case Else
End If Print "QB"; ch
Print a + b; End Select
If (a > b Or b <> 0) Then Print ch; "="; ch + a
Print "a*b" If (ch > 0) Then
Else Print ch - a
Print "QBASIC Fun" Else
End If ch = a
Print a; b End If
Print a; ch
9. 10.
x = 15: y = 13: z = Int(-x / 2) a = -13
w = x * 2 \ 3 + y / 13 - 4 + 6 ^ 2 b = a * 2 Mod 3
Print w; c = Int(a / 10) + b \ 10
x=x+w Print a; b; c
w=x-w a = a + Int(-314 / 100) + Int(-72 / 100)
x=x-w Print a
y=y+z b = -a
z=y-z b = b + Int(3 / 10) + Int(-3 / -77)
y=y-z Print b;
Print x; y; z; w c = c - Int(22 / -7) - Int(7 / 22)
Print c;
QBASIC Output Questions (with answer key)
By Sir. Subhendu
Answer key:
Question No. Output
1 27 7 a 23 7
2 Hi 25
25 7
54
3 11 -7
-7 11
4 54 q 54 p-4
5 -285 -285
6 347 0 Okay 0
7 -26 -26 QBASIC Fun
-26 0
8 2=2
2
02
9 43 43 -8 13 15
10 -13 -2 -2
-18
18 2