(Paper) Class XII Informatics Practices: Chapter Wise Papers (PROCEDURES, FUNCTIONS & MODULES IN VB)

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)


PROCEDURES, FUNCTIONS & MODULES IN VB

Q1. Name & explain the usage of all three types of modules available in Visual Basic.
Sol.:
(i) Form Module- it is a module that stores all the procedures & declaration pertaining to single form. Extension of from module is .frm.
(ii)Standard Module- It stores general purpose code of the application that is the code & declaration that are not specific to one form of application. Extension of standard module .bas.
(iii)Class Module- it is a special code module that stores the blueprint for user created custom objects. Extension of class module is .cls.

Q2. What is the difference between a function and a sub procedure? Write one example of each.
Sol.:
Function Procedure & Sub Procedure share the characterstics with one difference , function returns the value to the caller while procedure never trturns the value
e.g
private sub sum (a as integer, b as integer)
dim s as integer
s=a+b
print “sum of two nos is “& s
end sum

private function sum( a as integer, b as integer) as integer
dim s as integer
s= a+b
sum=s
End function

Q3. How many value(s) does a Procedure and a Function return?
Sol.:
Procedure doesn’t return any value while Function can return only one value.

Q4. Write a Procedure in VB to accept number and add number with 400 and display result
Sol.:
the function is as:
Private sub Procedure Result (num As Integer)
Result=num+400
MsgBox (“the result is:”&str (Result)
End Function

Q5. Write a procedure that receives a day number and print day of the week.
Sol.:
private sub display ( dd as integer)
Dim day as string
Select case dd
Case 1
Day=”Monday”
Case 2
Day=”Tuesday”
Case 3
Day =”Wednesday”
Case 4
Day =”Thursay”
Case 5
Day= “Friday”
Case 6
Day=”Saturday”
Case 7
Day=”Sunday”
Case else
Day=“Enter the no. from 1 between 7”
Select end
Print “day of the week is “& Day
End sub

Download Full Paper Here!