Chapter 9 More on VB 2010 Express
Brain Developers
A. Fill in the blanks:
1. A Variable refers to a memory location where data is stored temporarily.
2. Date data type is used to store date and time values.
3. Operators are special symbols that are used to perform calculations, make comparisons and check logical conditions.
4. Relational operators are used to compare two values.
5. Logical operators are used to combine two or more conditions.
6. Control statements are used to control the execution of a program.
7. For Next makes repetitive works easier in a program.
8. Do While statement is used to repeat a set of statements a fixed number of times.
B. State True or False:
1. Every variable has a unique name, by using it we can identify it in a program. (True)
2. Relational operators are used to arithmetic operations. (False)
Correct Answer: Relational operators are used to combine two or more conditions.
3. Looping statements are used to control the execution of a program. (False)
Correct Answer: Control statements are used to control the execution of a program.
4. If…Then…Else is used to make decisions by checking some conditions. (True)
5. For…Next loop is used to repeat a task for a finite number of times. (True)
6. Control Structures make repetitive work easier. (True)
C. Application Based Questions:
1. Ravi has written a program in Visual Basic 2010. He wants to combine two or more conditions in a program. Which operator will you suggest him to use for this purpose?
Answer: Ravi should use Logical operator to combine two or more conditions in a program.
2. Monika has designed a program in Visual Basic 2010 to perform basic functions of a calculator. She wants to execute the statements based on different choices. Suggest her as to which control statement she should use to get the correct output.
Answer: Monika should use Select Case to execute the statements based on different choices.
D. Multiple Choice Questions:
1. Which property of PictureBox is used to display the picture?
a) Image
b) Picture
c) Visible
Answer: b) Picture
2. Name the term that refers to a memory location that is used to store data temporarily.
a) Variables
b) Constants
c) Integers
Answer: a) Variables
3. Which statement is used to declare a variable in Visual Basic?
a) Val
b) Gim
c) Dim
Answer: c) Dim
4. Which data type is used to store integer values, ranging from -32768 to +32768?
a) Integer
b) String
c) DOB
Answer: a) Integer
5. Name the control in which the user can choose only one item out of the given items.
a) Command button
b) RadioButton
c) CheckBox
Answer: b) RadioButton
6. Which property of CheckBox control indicates whether the CheckBox is checked or not?
a) Name
b) Enabled
c) Checked
Answer: c) Checked
7. Which statement of Visual Basic is used to execute the statements based on different choices/conditions?
a) Select Case
b) If Else
c) Case
Answer: a) Select Case
E. Answer the following:
1. What is a Variable? How will you declare variables in Visual Basic 2010?
Answer: Variable refers to a memory location used to store data temporarily. It has a unique name, which is used to identify it in a program. Every variable has an associated data type, such as string, integer, etc., to specify the type of the data to be stored. Dim statement is used to declare a variable in Visual Basic.
2. What are Operators? Write any two different categories of operators that can be used in Visual Basic.
Answer: Operators are special symbols used to perform calculations, make comparisons, and check logical conditions in a program. Two different categories of operators that can be used in Visual Basic are: Arithmetic Operators and Relational Operators.
3. Write a short note on Control Statements. Name all the decisions of Control Statements.
Answer: The statements in a program are executed in a sequence. They are used to control the execution of a program, either by repeating or by skipping the execution of a statement, or a set of statements. All the decisions of Control Statements are: If…Then…Else Statement, Select Case Statement, Do While Statement, For…Next Statement.
4. What do you mean by Implicit and Explicit variable declaration?
Answer: When the data type and value for a variable is defined by Visual Basic itself, then it is called Implicit declaration, whereas, Explicit declaration allows the users to define the data type and value for a variable by using “Option Explicit” Statement.
5. What is the use of Dim statement?
Answer: Dim statement is used to declare a variable in Visual Basic.
6. When do we use ListBox?
Answer: The ListBox represents a list of items to a user. A user can select an item from the list. It allows the programmer to add items at design time by using the properties window or at the runtime.
F. Differentiate between the following pairs of terms:
1. Relational and Logical operators
Answer:
• Relational operators: These operators are used to compare two values and return True or False as a result.
• Logical operators: These operators are used to combine two or more conditions, and display the result accordingly.
2. Do While and For…Next statements
Answer:
• Do While statement: It is used to repeatedly execute a set of statement(s), till the specified condition remains true. It stops executing the statements as the condition becomes false.
• For…Next statement: It is used to repeat a set of statements a fixed number of times. It uses a counter to count the number of execution.
3. Enabled and Visible property of CheckBox Control
Answer:
• Enabled property: This property sets True or False at run time display.
• Visible property: This property determines whether the control is visible or hidden.
No comments:
Post a Comment