Visual Basic Level 200 by Akiola
Visual Basic Level 200 by Akiola
Date of examination: 27th March, 2024 Time Allowed: .. . 3hrs .... ....
INSTRUCTIONS:
1. Answer ALL Questions in Section A and THREE (3) questions in Section B.
ii. Answer all questions into the ANSWER BOOKLET provided.
111. Do all rough work on the ANSWER BOOKLET where necessary.
1v. Write your INDEX NUMBER clearly on each page of the paper.
v. Make sure you have signed the attendance sheet before leaving the exams room.
S. Alhassan, Page 1 of 7
S E C T IO N A
INSTRUCTIO (40 M A R K S }
N: In this sectio
appropriate answ n, there are 40 h o se th e m o st
er from the op multiple choic
tions lettered A e questions, P
to D. All ques 1 ;: e ~ k s -
tions ca rr y e q
l. _ _is a data type th rn
declare a text at ca n be u sed to 7. Option button ca n be gro u p e d in a
o f maximum l s
characters. O million con tro l.
- -
A. tex-
A. Long tbox
B. Date B . label
C. Double C. panel
D. String. D. co m
2. What is th 8 Which b o b o x • te s
e result o f th · st at em en t an
e te rn u n a &.
expression: b = following application that · on lY o n e .Lonn•,.,
13 > 12 A contains
5. n d 6 < A. Me.CloseO
A. True B . Me.DoneO
B. False C. Me.Finish()
C. Both A. and D. Me.Stop()
B. 9. In visual bas •
D. None ic _ __ is the extension to
Which o f the represent project
following statem file.
equivalent to th ents is A.. fnn
e statement
iC o u n t = iC 8 .. els
o u n t + 8?
A. iCount =+ 8 C ..tx t
B. iCount += 8 D.. vbp
C. 8 += iCount 10. Which prop
erty determine
D. 8 =+ iCount o f the text insid s th e p o si ti o n
e a label c o n
tr o l?
A. Align
Which o f the fo B. Alignment
llo
evaluate to True wing If clauses will C. AlignText
when the Bonu
box is selected? s check D. TextAlign
A. If chkBonus. 11. The _ _ _
Check = True T control used to
B. If chkBonus. hen to the fonn. in se rt imaoe
Checked Then
C. If chkBonus.C A. textbox
0
hecked = True T
D. Both b and C hen B. panel
.
f ariables are nam
ed storage locati C. shape
nemory, ~ e val ons in D. picture.
hange dunng proue o f which does not
gram ........................ 12. ~o::: many
"· design • .. times will the
H 1 appear strino •
• modification •
the below codin the lblM c:, li
1 debug
•. D. . es
·
is e
sg control wtehra
en
l
execution • x
im in tC o u n t ecuted?
Do W h il e . A •
hlch ~ d o w list s Inte
luded 1n a soluti s the projects and files
in tC o u nt > g 4
er
on? lb lM lb lM s g T
Object s g .T . ext
>roject C o n tr o lC he x t -
. &
•ropert1e•
s in tC
a r s .N e w L in " H i" &
Loop o u n t +- 1 e
olution Explore -
r A. zero
B. one
Nl1EX NUMBER: ................................................................................... .
C. four C. function
D. five D. ByRef
13. Which of the following methods is used 20. Which property is used to specify a
to add items to a list box? combo box's style?
A. Add A. ComboBoxStyle
B. AddList B. DropDownStyle
C. Iten1 C. DropStyle
D. ItemAdd D. Style
21. Which is not a proper looping structure?
14. The _ _ keyword refers to current A. Do Until
form in Vb.Net project. B. Loop Until
A. this C. For Next
B. current D. For each Next
C.me 22. Which of the following assigns the
D. new number of characters in the strAddress
15. If a radio button is selected, its variable to the intNum variable?
_ _ _ _ _ _ property contains the A. intNum = strAddress.Length
Boolean value True. B. intNum = strAddress.LengthOf
A. Checked C. intNum = Length(strAddress)
B.On D. intNum = LengthOf(strAddress)
C. Selected 23. Which of the following methods can be
D. Selection used to determine whether the strRate
16. What are the items that appear within variable contains the percent sign?
parentheses in a procedure header called? A. blnResult = strRate.Contains("¾")
A. arguments B. intResult = strRate.IndexOf("¾")
B. parameters C. intResult = strRate.IndexOf("¾", 0)
C. passers D. All of the above.
D. None of the above. 24. The strName variable contains the string
17. The IDE stands for _ _ _ _ __ "Joyce". Which of the following
A. Informal Development Environment statements changes the contents of the
B. Internal Development Environment variable to the string "Joy"?
C. Integrated Development Environment A. strName = strName.Remove(3)
D. Integrated Deployment Environment 8. strName = strName.Remove(4)
18. Which of the following statements C. strName = strName.Remove(4, 2)
invokes the GetArea Sub procedure, D. strName = strName.Remove(2, 3)
passing it two variables by value? 25. Which of the following statements sends
A. GetArea(dblLength, dblWidth) As the focus to the btnClear control?
Double A. btnClear.Focus()
B. GetArea(ByVal dblLength, 8yVal B. btnClear.Focus() = True
dbl Width) C. btnClear.SendFocus()
C. GetArea 8yVal(dblLength, dblWidth) D. btnClear.SetFocus()
D. GetArea(dblLength, dblWidth) 26. Which property specifies the number of
19. Which type of procedure returns a value characters that a text box will accept?
to the caller code? A. Length
A. sub B. MaxLength
8. property C. LengthMax
S. Alhassan, Page 3 of 7
\NDEX NU~\\3ER: ........................... ..
' '' ' ' ' ' ' ' ' ' ' ' ' ' ' ' .' ' '
•••••••••••••••••••···········
D Muxinmm f \'~- C. And. Or. Not
"'7 ,~:hich of the following Jcdai:es a I
... •
~l~ment on~-dim.~ns\onul ,lTT'l....
' I \ ) o. And. Or. [f . .
A. Dim intSolJ{4) As lnteger , . '\, How can an appltcat
"' .. •)1on access the f>ri~ ~
13. Din, intSold(5) As h,t~g~r == vuriubles in u clus:s.
... . ) I I
S. A.ihassa ~. Page 4 of .,
). rfB'C
D •
............
•~Dnx N\J \..'I l (LJ l'... . • ... • ... • • • ••••• • • ••••• .... .. , , , , . , , .. , , • • • • • • • • • • • • • • • •
••• •• • ' •• •• ••••
z = (x An dy) Or No t(x )
-A- cou nt As
--
B
I S. Alhassan, Page 5 of 7
IN D E X NUM
BER·.. .. .. .. ..
-
.. .. .. .. .. .. .. .. ..
.. .. .• •• •• •• •• • t
•• •• •• ••
• • •. t.
t t I It t t t I It I
I It
It t t It I It t I I
c) What is the va .
lue of the vana ble x a er the following statement have
ft
marks) been executed. (6
Dim x a s In
te g e r
i) x = 8 Xor 1
ii ) X = 8
Or 1
ii i) x = 8
And 1
2. Consider a
form which ha
s two text bo x
(lOmarks) controls tx tS
tu d e n ti
a. Write a D d an d tx tE x
im statement amScore.
that declares
(lmark) a String vari
able na m ed
b. Write a Dim s tr S tu d e n
statement that ti d .
c. Write a st declares a Sin
atement that as gle variable na
signs the cont m ed sn gE xa m
and without an ent o f the tx tS S co re . (l mar
y leading or tr tu d e n ti d co nt k)
d. Write a st ailing spaces ro l in up pe rc as
atement that as to the variable e
signs the cont s tr S tu d e n
sn g E x a m S co ent o f tx tE x ti d . (lmark)
re . (lmark) a m S co re co
e. Write an lf nt ro l to the va
clause that de riable
is empty. (2.S termines whe
marks) ther the text in
f. Write an If the s tr S tu
clause that de d e n ti d va ri
termines wheth ab le
greater than 70 er th e va
. (2.Smarks) lue in the sn g
g. Write a st E x a m .S co re
atement that cl variable
tx tE x a m S co ears the text co
re controls. (l nt en ts o f the tx tS tu
mark) d e n ti d an d
3. Consider
a VB.Net prog
for this purpos ram that proces
e and one list s the prices o f
box control (n food items. A
(l 0m ar ks ) amed ls tP r form ha s be en
ic e ) has been created
a. Write a st placed on it.
atement that de
sn g P r ic e . clares a proced
The array shou ure-level one-
b. Write a st ld contain 10 dimensional si
atement that as elements. (2m ngle array na
signs the valu arks) med
array. (2marks e 5.50 to the th
) ir d el ement in the sn
c. Write a st g P r ic e
atement that ad
(2marks) ds the number
7 to the first el
d. Write a st ement in the sn
atement that as g P r ic e arra
si gns the numbe y.
intCount variab r o f elements
le. ( l mark) in th e
e. Write a st sngPrice array
atement that as to the
intLastFood va signs the high
riable. (lmark) est subscript in
f. Write a For the sn g P r ic
.. .. Next block e array to the
control. (2mar to add all the elem
ks) ents of sn g P
4. r ic e into the
ls tP r ic e
a. W ha t is a variable?
b. State tw o ( l mark)
(2) rules for na
C. Consider a data
ming variables.
base table nam (2marks)
field contains ed Foo dS tu ff
text while It em that contains tw
P ri ce field is
numeric. o fields.
The It em N am
e
S. Alhassan, Pa
ge 6 of 7
--------
MBER: ....................................................... ' ... . •••••••
• • • • If • •
•••
:t NU
•••••••
e
. L INSE RT statem ent tha t ad ds the food ~,wAKYE" with pric
l. Wri~e an SQ marks)
15 .:,0 to the FoodStuff table. (2 the price of ..BANKU" to 20.
.. tem en t tha t chan ges
n. Write an SQL UPDATE sta
(2marks) ds all the food items and
... that display the recor
111. Write an SQL SELECT query
their Prices. (lmark) oves the record for the ItemName
. statemen t that rem
lV. Write an SQL DELETE
~'FRIED YAM". (2marks)
ed to de termi ne the obesi ty status of a person. BMI
l) value is us
5. The Body Mass Index (BM ei gh t) / (h eig ht) 2 ; where weight is in kg an
d
rm ula (w
can be calculated using ~e fo
n ca lled GE T _B M I of typ e single that takes as its
.Net func tio
height is in meters. Write ·a VB e sin gle of a body and return the BMI va
lue in 2
igh t of typ
argument the weight and he
ld be ab le to tak e care of the situation where height may
n shou
decimal places. Your functio
be zero. (lOmarks)
\
\ !