(Paper) Class XII Informatics Practices: Chapter Wise Papers (VISUAL BASIC REVISION TOUR AND CONTROL STRUCTURE)

Disclaimer: This website is NOT associated with CBSE, for official website of CBSE visit - www.cbse.gov.in

Class XII Informatics Practices Paper (Chapter Wise With Answer)


VISUAL BASIC REVISION TOUR AND CONTROL STRUCTURE

Q1. Change the following code using FOR loop without effecting the output
Dim count as integer
ans = 1
count = 20
DO
ans = ans * count
count = count -2
LOOP UNTIL count < = 10
Print ans
Ans. Dim count as integer
ans = 1
for count=20 to 11 step -2
ans = ans * count
next
Print ans

Q2 Find the errors from the following code segment and rewrite the corrected code.
Dim num=10, las Integer
I = I
Do While 1 < 5
          1 = 1 + 2
If num > 15
         num = 0
Else
         num = num — 3
Endlf
End While
Ans. Dim num=10 as Integer
I = 1
DO While I < 5
          I = I + 2
If num > 15
          num = 0
      Else
          num = num — 3
       Endlf
LOOP

Q3. Rewrite the following code segment using Select Case statement :
If ch = “A” Then
countA = countA + 1
Elself ch = “B” Then
countB = countB + 1
Elself ch = “C” Then
countC = countC + 1
Else
countE = countE + 1
End If
Ans. Select case ch
case “A”
countA=countA+1
case “B”
countB=countB+1
case “C”
countC=countC+1
case else
countE=countE+1
End Select


Q4 Write the output that the following code segment will generate :
x=”Class”
Print Mid (LTrim( “Computer Science” ),1,4)+”One”
Print(7*4>8+3) And (3^2 < 6/2)
Print InStr(“Computers”, “ut”)
Ans
CompOne
False
5

Q5 Write the following code segment using For Loop :
I=6
x=I
Do While I>=1
x=x-2
If x=0 Then
Print "Zero"
End If
Print I
I=I-2
Loop
Ans.
1=6
x=I
for I=6 to 1 step -2
x=x-2
if x=0 Then
Print “Zero”
End If
Print I
Next

Download Full Paper Here!