0% found this document useful (0 votes)
4 views5 pages

Option II - Programming Using Visual Basic

The document is a solved model paper for the Computer Science Paper II for the Board of Intermediate Education, Karachi, covering multiple choice questions, short-answer questions, and detailed-answer questions related to programming using Visual Basic. It includes explanations of concepts such as database management systems, data types, loops, and built-in functions, along with example programs. The paper is structured into three sections, with specific marks allocated for each section.

Uploaded by

darainahmer18
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Option II - Programming Using Visual Basic

The document is a solved model paper for the Computer Science Paper II for the Board of Intermediate Education, Karachi, covering multiple choice questions, short-answer questions, and detailed-answer questions related to programming using Visual Basic. It includes explanations of concepts such as database management systems, data types, loops, and built-in functions, along with example programs. The paper is structured into three sections, with specific marks allocated for each section.

Uploaded by

darainahmer18
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Solved Model Paper 2026 - Computer

Science Paper II
Board: Board of Intermediate Education, Karachi Subject: Computer Science Option: II -
Programming Using 'Visual Basic'

SECTION 'A' (Multiple Choice Questions)


Marks: 15
(i) The cancel button property belongs to this object:
●​ Answer: Form
○​ Explanation: The CancelButton property is a property of a Form object, used to
determine which button is clicked when the user presses the 'Esc' key.
(ii) In the For...Next statement, the default value for the step is:
●​ Answer: 1
○​ Explanation: If the Step keyword is omitted, the loop increments the counter by 1
automatically.
(iii) In a table, a row is also called a:
●​ Answer: Record
○​ Explanation: In relational databases, a row represents a single, implicitly structured
data item (a record) in a table.
(iv) This object in MS-Access is used to display and print data:
●​ Answer: Report
○​ Explanation: Reports are designed specifically to format, calculate, print, and
summarize selected data.
(v) This key uniquely identifies a record:
●​ Answer: Primary Key
○​ Explanation: A Primary Key is a specific choice of a minimal set of attributes
(columns) that uniquely specify a tuple (row) in a relation (table).
(vi) This is used to choose only one option yes (1) or No (0):
●​ Answer: Check Box
○​ Explanation: While Option buttons are for mutually exclusive lists, a Check Box is
traditionally used for binary (Boolean) choices like Yes/No or True/False.
(vii) Comparison operators are also termed as:
●​ Answer: Relational
○​ Explanation: Relational operators (e.g., =, >, <, <>) represent the relationship
between two values.
(viii) Passing a copy of the variable is referred to as:
●​ Answer: Pass by value
○​ Explanation: ByVal (Pass by value) passes a copy of the data. Changes to the
parameter inside the procedure do not affect the original variable.
(ix) This statement is the last statement in the function:
●​ Answer: End Function (Note: If restricted strictly to the options visible [Footer, Header,
Return, Call], "Return" is the closest logical answer for exiting, but syntactically End
Function closes the block).
○​ Correction based on options: Return (Contextually, it is the exit action).
(x) In database, columns are called:
●​ Answer: Attributes
○​ Explanation: A column in a table represents an attribute of the entity described by
the table.
(xi) The database model organizes data into a tree like structure:
●​ Answer: Hierarchical model
○​ Explanation: This model uses a parent-child relationship where a child can have
only one parent, forming a tree.
(xii) This control selects a single choice from a data group:
●​ Answer: Option Button
○​ Explanation: Also known as Radio Buttons, they allow the user to select only one
option from a group.
(xiii) A sub program which returns a value is called:
●​ Answer: Function
○​ Explanation: A Sub procedure performs an action, while a Function procedure
performs an action and returns a value.
(xiv) Reserve word DIM explicitly declares:
●​ Answer: Variable
○​ Explanation: Dim stands for Dimension. It is used to declare variables and allocate
storage space.
(xv) This database model allows Query through SQL is:
●​ Answer: Relational
○​ Explanation: Structured Query Language (SQL) is the standard language for
dealing with Relational Databases.

SECTION 'B' (Short-Answer Questions)


Marks: 30 (Note: Students are required to answer 10, but solutions for all are provided below)
2. (i) Write any four advantages of DBMS.
1.​ Data Independence: The application programs are protected from changes in the
hardware or data storage structures.
2.​ Minimal Data Redundancy: DBMS minimizes file duplication, saving storage and
ensuring consistency.
3.​ Data Consistency: Since data appears once, updates happen in one place, preventing
mismatching data.
4.​ Data Security: DBMS provides tools (passwords, access levels) to ensure only
authorized users access data.
(ii) What is a Combo Box? List its properties. A Combo Box is a control that combines a text
box with a list box. It allows the user to type in a selection or choose one from a drop-down list.
Properties: List, Text, Sorted, Style, ListCount, ListIndex.
(iii) How can a variable be defined as variant type? A Variant is the default data type in
Visual Basic if no type is specified.
Dim myVariable ' No type specified, defaults to Variant​
' OR​
Dim myVariable As Variant​

(iv) Define one-to-many relationship with diagram. A one-to-many relationship exists when
one record in Table A can be related to one or more records in Table B, but one record in Table
B is related to only one record in Table A. Example: One Teacher teaches many Students.
Diagram Description: [Teacher Table (1)] ----< [Student Table (Many)]
(v) Define any four objects in MS-Access.
1.​ Table: The basic unit where data is stored in rows and columns.
2.​ Query: A request for data results, or action on data (retrieving, filtering).
3.​ Form: An interface used to enter, edit, and view data comfortably.
4.​ Report: Formatted output of data suitable for printing.
(vi) Write the structure of Select Case.
Select Case test_expression​
Case expression_list1​
' Statements to run if match found​
Case expression_list2​
' Statements to run if match found​
Case Else​
' Statements to run if no match found​
End Select​

(vii) Who is Database Administrator? Write any three of his responsibilities. A Database
Administrator (DBA) is an IT professional responsible for the installation, configuration,
upgrading, administration, monitoring, maintenance, and security of databases.
Responsibilities:
1.​ Designing and implementing database schemas.
2.​ Managing data backup and recovery procedures.
3.​ Granting user permissions and ensuring data security.
(viii) What are basic ActiveX controls in VB? Standard controls found in the Toolbox, such
as:
1.​ CommandButton
2.​ TextBox
3.​ Label
4.​ ListBox
5.​ CheckBox
(ix) Write the full form of any three of the following:
●​ ADO: ActiveX Data Objects
●​ MDI: Multiple Document Interface
●​ SQL: Structured Query Language
●​ DBA: Database Administrator
●​ OLE: Object Linking and Embedding
(x) Write the properties of Text Box. Common properties include: Name, Text, MaxLength,
MultiLine, PasswordChar, Enabled, Visible, Alignment.
(xi) Write the VB equivalent expression for any Three of the following:
1.​
○​ VB: X = ((2 * a * b) ^ 2) / (3 * c)
2.​
○​ VB: Y = (4 / 3) * 3.142 * (r ^ 3)
3.​ Y = (a^2 + b^3)^{\frac{1}{6}} (Assuming 6th root based on image)
○​ VB: Y = (a ^ 2 + b ^ 3) ^ (1 / 6)
4.​
○​ VB: a = 0.5 * base * height
(xii) What is error? Define its types. An error (or bug) is a flaw or fault in a computer program
that produces an incorrect or unexpected result. Types:
1.​ Syntax Error: Grammatical errors in code (e.g., typo in keyword). Occurs at compile time.
2.​ Runtime Error: Occurs during execution (e.g., dividing by zero).
3.​ Logical Error: Program runs but produces wrong results (e.g., using + instead of -).
(xiii) Write a program in VB to generate all even numbers from 0-50 (use loop).
Private Sub Command1_Click()​
Dim i As Integer​
For i = 0 To 50 Step 2​
Print i​
Next i​
End Sub​

(xiv) Write a program in VB to calculate the sum and average of tea inputted numbers.
(Note: Assuming 'ten' inputted numbers based on context)
Private Sub Command1_Click()​
Dim i As Integer​
Dim num As Double​
Dim sum As Double​
Dim avg As Double​

sum = 0​
For i = 1 To 10​
num = Val(InputBox("Enter number " & i))​
sum = sum + num​
Next i​

avg = sum / 10​
Print "Sum = " & sum​
Print "Average = " & avg​
End Sub​

(xv) What is the difference between Primary Key and Foreign Key?
●​ Primary Key: A field (or group of fields) that uniquely identifies every record in a table. It
cannot be Null. (e.g., StudentID in Student Table).
●​ Foreign Key: A field in one table that refers to the Primary Key of another table. It
establishes a link between two tables. It can accept duplicate values and Nulls. (e.g.,
StudentID in CourseEnrollment Table).

SECTION 'C' (Detailed-Answer Questions)


Marks: 30 (Note: Answer any Three)
3. Explain Array and its types with examples. Definition: An array is a collection of variables
of the same type that are referred to by a common name and an index number. Types:
1.​ Fixed-Size Array: The size is determined at compile time and cannot change.
○​ Example: Dim Names(5) As String (Holds 6 names, index 0-5).
2.​ Dynamic Array: The size can be changed during runtime using the ReDim statement.
○​ Example:​
Dim Marks() As Integer​
ReDim Marks(10)​

3.​ Control Array: A group of controls that share the same name and type, distinguished by
an index.
4. What is a Loop? Define any two types with examples. Definition: A loop is a control
structure that repeats a block of code until a specific condition is met. Types:
1.​ For...Next Loop: Used when the number of iterations is known beforehand.
○​ Example:​
For i = 1 To 5​
Print "Iteration " & i​
Next i​

2.​ Do...Loop (While/Until): Used when the number of iterations is not known and depends
on a condition.
○​ Example:​
Dim count As Integer​
count = 0​
Do While count < 5​
count = count + 1​
Print count​
Loop​

5. What is built-in function in VB? Explain with any program. Definition: Built-in functions
are predefined procedures provided by the Visual Basic language to perform common tasks
(math, string manipulation, date conversion, etc.) without the user needing to write the code
logic. Examples: MsgBox(), InputBox(), Val(), Len(), UCase().
Program Example (Using String and Math functions):
Private Sub Command1_Click()​
Dim rawInput As String​
Dim numVal As Double​
Dim squareRoot As Double​

' InputBox is a built-in function​
rawInput = InputBox("Enter a positive number:")​

' Val converts string to number​
numVal = Val(rawInput)​

If numVal > 0 Then​
' Sqr is a math built-in function​
squareRoot = Sqr(numVal)​
' MsgBox displays output​
MsgBox "The square root is: " & squareRoot​
Else​
MsgBox "Please enter a number greater than 0."​
End If​
End Sub​

6. Explain all database models with diagram.


1.​ Hierarchical Model: Data is organized in a tree-like structure. A parent node can have
multiple child nodes, but a child node can only have one parent. (1-to-Many).
○​ Diagram Concept: Root -> Branch -> Leaf.
2.​ Network Model: Similar to hierarchical but more flexible. A child node can have multiple
parent nodes. It represents complex relationships better (Many-to-Many).
○​ Diagram Concept: A web where records are linked via pointers.
3.​ Relational Model: Data is stored in tables (relations) consisting of rows and columns.
Tables are related via common keys (Primary/Foreign). This is the most common model
used today (e.g., Access, SQL Server).
○​ Diagram Concept: Table A linked to Table B via a line connecting specific fields.
7. Explain all the data types used in MS-Access.
1.​ Text (Short Text): Alphanumeric characters (up to 255 chars).
2.​ Memo (Long Text): Long alphanumeric data (sentences/paragraphs).
3.​ Number: Numeric data for calculations (Integer, Long, Double).
4.​ Date/Time: Dates and times (years 100 to 9999).
5.​ Currency: Monetary values (prevents rounding errors).
6.​ AutoNumber: Unique sequential number automatically inserted by Access.
7.​ Yes/No: Boolean values (True/False, On/Off).
8.​ OLE Object: Objects like pictures, graphs, or documents linked from other programs.
9.​ Hyperlink: Links to websites or files.

You might also like