Digital Learning

Wednesday, December 25, 2024

Computer-Science-Class-7 Chapter-8(2024-25):

Computer Science
Class-7
Chapter-8 Introduction to Visual Basic

A. Tick the correct option:
1. A project consists of many _________________.
a. controls        b. forms                c. programs
Answer: forms
2. ______ displays the position of the form on screen.
a. forms layout window    b. project window        c. properties window
Answer: forms layout window
3. ________ define the characteristics of the form or an object.
a. methods        b. properties        c. events
Answer: properties
4. The _________ helps you to browse the various properties, events and methods.
a. properties window    b. project window        c. object browse
Answer: object browse
5. When the user clicks on the form, _________ event is triggered.
a. form click        b. form load            c. show
Answer: form click


B. Write T for true and F for false:
1. Text box can handle only text and numeric data.
Answer: F
2. Label provides instructions and guides to the users.
Answer: T
3. An event associated with the command button is click.
Answer: T
4. We can use the built in control names of visual basic as the name of text boxes and other controls.
Answer: F
5. You can press <F2> key to run the application.
Answer: F
6. The command button is used to execute commands.
Answer: T

C. Match the following:
1. Click                        i. A method
2. Caption                  ii. An event
3. Print                      iii. A statement
4. Text box                iv. A property
5. Form I.show         v. A control
Answer: 
1. ii
2. iv
3. i
4. v
5. iii


D. Answer the following questions:
1. How Visual Basic is different from BASIC?
Answer: Visual basic differs from basic in many ways:
1. Visual Basic is an object oriented programming language that supports events handling, while BASIC is a procedure oriented language.
2. In BASIC programming is done in a text only environment, however in visual basic programming is done in a graphical environment.

2. Define the following terms:
a. Properties        b. Methods            c. Events
Answer: 
a. Properties: Properties define the characteristics of the form or an object. The common properties of the form are as follows: Name, Caption, Appearance, Font, Fore colour, Back colour
b. Methods: Methods are the actions performed on the form or objects. The common methods of the form are as follows:
1. Show
2. Hide
3. Print
c. Events: An event is a message sent by an object indicating that something has happened. The common events of the form are as follows:
1. Form click
2. Form load

3. Write the three steps to create an application in Visual Basic.
Answer: In  Visual Basic, an application is developed in three steps:
1. Design the interface
2. Set properties of the controls
3. Write the event procedures

4. Write the event procedure to calculate the area of square.
Answer: 
Imports System
Module Module1
    Class Figure
        Public length As Double
        Public width As Double
    End Class
    Sub Main()
        Dim square As Figure=New Figure()
        Dim area As Double=0.0
        square.length=8.0
        square.width=8.0
        area=square.length*square.width
        Console.WriteLine("Area of square is:{0}", area
    Console.ReadKey()
End Sub
End Module

5. Write the event procedure to accept two strings and concatenate them.
Answer: 
Dim s, s1, t As String
Dim i As Integer
s1="Hello"
i=1
s=s1 & i
t=s1+i
If s=t then
        MessageBox.Show("Equal.....")
End If


No comments:

Post a Comment