Computer Science Class 12 D.G. Khan Board 2024 Past Paper
The D.G. Khan Board's 2024 Class 12 Computer Science paper, typed in full. Fifteen MCQs — six on MS-Access, then nine on either C-Language or Visual Basic — each explained online, followed by the short questions (with the code snippets as printed), one MS-Access essay and two programming questions.
Board: D.G. KhanClass 12202475 marks20 minutes + 2 h 10 min
Four possible answers A, B, C and D are given. Fill the circle in front of the correct answer with marker or pen ink on the answer sheet. Cutting or filling two or more circles will result in zero mark in that question.
Score 0 / 0 attempted · 15 MCQs
1.
The output of the query is in the form of a
Answer & explanation
Correct answer: A — Table
A select query returns its result as a table (datasheet) of rows and columns.
2.
How many table views are available in Microsoft Access
Answer & explanation
Correct answer: B — 2
Two: Design View (structure) and Datasheet View (data).
3.
A collection of related fields is called
Answer & explanation
Correct answer: D — Record
Related fields about one item make a record (row).
4.
Which of the following is not a type of database key?
Answer & explanation
Correct answer: A — Public
Primary, foreign, secondary, candidate, alternate and composite keys exist; there is no 'public' key in a database.
What will be the value of y after executing the following statement y = (5 < 10) ? 5 : 10 ;
Answer & explanation
Correct answer: A — 5
5 < 10 is true, so the conditional operator returns the value before the colon — 5.
8.
All of the followings are control statements except
Answer & explanation
Correct answer: D — Float
Sequence, selection and repetition are the three control structures; float is a data type.
9.
Which of the following symbol is used at the end of case statement
Answer & explanation
Correct answer: C — :
Each label is written case value: — with a colon.
10.
The first line of function definition is known as
Answer & explanation
Correct answer: D — Function header
The header (return type, name, parameter list) is the first line; the body follows in braces.
11.
An array subscript should be
Answer & explanation
Correct answer: B — int
An index must be an integer.
12.
.exe is produced by
Answer & explanation
Correct answer: C — Linker
The linker joins object code with library code into the executable (.exe) file.
13.
The number of bytes used by float data type in C-language is
Answer & explanation
Correct answer: D — 4
float takes 4 bytes.
14.
Which of the following operator has lowest precedence?
Answer & explanation
Correct answer: A — =
Assignment has the lowest precedence of these; parentheses the highest.
15.
If int a = 5, then the statement printf(“%4d”, a) will display
Answer & explanation
Correct answer: C — □□□5
%4d prints in a field 4 wide, right-justified: three spaces then 5. (□ = a blank space.)
Objective — Visual Basic option (Q.7–15)Marks: 9
Q.7–15 are answered EITHER from C-Language (above) OR from Visual Basic (this section); Q.1–6 (MS-Access) are common.
Score 0 / 0 attempted · 9 MCQs
7.
Image control holds a graphic that is assigned to ……… property
Answer & explanation
Correct answer: C — Picture
The graphic is set through the Picture property.
8.
All items in a list box can be cleared at once using method
Answer & explanation
Correct answer: D — Clear
List1.Clear empties the list; RemoveItem deletes one item.
9.
You can enter data in a control only when it has
Answer & explanation
Correct answer: B — Focus
Only the control with the focus receives keyboard input.
10.
Forms and controls are collectively recognized as
Answer & explanation
Correct answer: C — Object
Forms and controls are objects.
11.
The naming prefix for a label control is
Answer & explanation
Correct answer: D — lbl
lbl (e.g. lblName).
12.
Variables name cannot begin with
Answer & explanation
Correct answer: A — Number
A VB variable name must start with a letter, so it cannot begin with a digit. (It cannot begin with an underscore either in VB6, but a number is the intended answer.)
13.
The long data type in VB occupies …… bytes
Answer & explanation
Correct answer: C — 4
Long is a 4-byte integer (Integer is 2).
14.
A loop within a loop is called
Answer & explanation
Correct answer: A — Nested
A loop placed inside the body of another loop is called a nested loop. The inner loop completes all its iterations for each single iteration of the outer loop.
15.
……… is an example of post test loop
Answer & explanation
Correct answer: D — Do loop while
Do … Loop While tests the condition after the body, so the body runs at least once.
Write short answers to any SIX parts of each question (2 marks each). Q.3 and Q.4 are answered either from C-Language or from Visual Basic.
Q.2.
MS-Access. Write short answers to any six parts.
(i)Define record with example
(ii)What is Alternate key?
(iii)How many attributes and records are contained in the following relation?
Stud. No
Stud. Name
Gender
DOB
641
Ali
Male
12/01/2005
642
Taha
Male
29/05/2007
(iv)Define relationship
(v)What is the purpose of database design process?
(vi)What is homonym?
(vii)What is MS Access?
(viii)Write the use of input mask?
(ix)Why are sub form used?
12
Q.3.
C-Language. Write short answers to any six parts.
(i)What are standard identifiers?
(ii)Convert the expression A = πR2 in C-language expression
(iii)If x = 2 give output of following statement:
printf("%d", ++x);
printf("\n%d", x++);
(iv)Write syntax of printf( ) function
(v)Indicate the errors in following code;
int main (void) {
const int pi = 3.1415 ;
int R ;
PRINTF ( "%f" , pi * R * R ) ;
(vi)What is the output of following code
int x = 32 ;
int y = 4 ;
printf ( "%d and %d is %d" , x , y , x % y ) ;
(vii)Indicate errors in the following code;
int x , y ;
0 = x = y ;
x + + + ;
printf ( ' %d ' , x + y ) ;
(viii)Define a stream in C-Language
(ix)Differentiate between “w” and “w+” modes to open a file in C-Language
12
Q.3.
OR Visual Basic. Write short answers to any six parts.
(i)Write the purpose of project explorer window
(ii)Visual basic is known as event driven programing language, why?
(iii)What is the purpose of option explicit statement?
(iv)Differentiate between modal and modeless form in visual basic
(v)What are intrinsic controls?
(vi)Why we use a label control?
(vii)What is difference between linking and embeading?
(viii)Write the purpose of “Large change” and “Small change” properties of scroll bar
(ix)What is the purpose of “passwordchar” property of text box?
12
Q.4.
C-Language. Write short answers to any six parts.
(i)How are instructions executed in sequential structure?
(ii)Predict the output of the following
int price = 19 ;
if (price != 10)
printf ( "price" ) ;
(iii)Define loop
(iv)Convert the following do while loop into for loop
int c = 2 ;
do
printf ( "%d" , c ) ;
while (c++ <= 5) ;
(v)Predict the output of the following code segment
int x = 5 , y = 3 ;
do
x = x * 2 ;
y = y + 2 ;
while (y < 10) ;
printf ( "%d" , x ) ;
(vi)List any two benefits of using function
(vii)Define function body
(viii)How long the global variable exist in a memory?
(ix)Compare local and global variable
12
Q.4.
OR Visual Basic. Write short answers to any six parts.
(i)Define constant
(ii)Write down two rules to give name to the variable
(iii)Why is it important to declare variable before use?
(iv)Distinguish between IF-Then-Else and Select-Case statement
(v)In Visual Basic how select case help you in coding
(vi)How nested IF is used in VB
(vii)Distinguish between counter control and sentinel control loop
(viii)Give an example of nested loop
(ix)Distinguish between While-wend and Do-while loop
12
Subjective — Section II (MS-Access)Marks: 8
Attempt any ONE question (8 marks).
Q.5.
What are database anomalies? Discuss its three types
8
Q.6.
Explain any four data types available in MS-Access
8
Subjective — Section III (C-Language OR Visual Basic)Marks: 16
Attempt any TWO questions, either from C-Language or from Visual Basic (8 marks each).
Q.7.
C-Language. What is programming language? Discuss two main categories of programming languages
8
Q.8.
C-Language. Write an interactive program that contains an if statement that may be used to compute the area of circle (area = πr2) or the circumference of circle (circumference = 2πr) after prompting the user to type the first character of the formula name (A or C)
8
Q.9.
C-Language. Write a program in C-Language that display product of all even numbers between 2 to 20 by using loop
8
Q.7.
OR Visual Basic. What is programming language? Discuss two main categories of programming languages
8
Q.8.
OR Visual Basic. Write an interactive program that contains an if statement that may be used to compute the area of circle (area = πr2) or the circumference of circle (circumference = 2πr) after prompting the user to type the first character of the formula name (A or C)
8
Q.9.
OR Visual Basic. Write a program in VB that display product of all even numbers between 2 to 20 by using loop
8
Examiner notes on this paper
Objective 15 marks (20 min): Q.1–6 MS-Access for everyone, Q.7–15 from C-Language OR Visual Basic. Subjective 60 marks (2 h 10 min): six parts each of Q.2, Q.3 and Q.4, one of Q.5–6 and two of Q.7–9.
C MCQ 15: %4d right-justifies in four columns, so 5 prints as three spaces then 5.
Q.4(v) (C): the loop runs while y < 10 — y goes 5, 7, 9, 11 — so x doubles four times: 5 → 80.
Several Q.3 code parts are deliberately wrong (const int pi = 3.1415 loses the decimals; PRINTF is not printf; 0 = x is not a valid assignment; x+++ is a syntax error) — those are the errors the question wants.
About this transcription
Typed from Tayarri's own typeset transcription of the D.G. Khan Board's Class XII 2024 paper (the uploaded file); its wording is kept.
The source sheet came with no answers marked, or with publisher ticks that were not used: every answer in the online quiz was worked out independently by Tayarri.
Kept as printed: 'programing', 'embeading', 'Variables name', 'sub form', the uppercase PRINTF in Q.3(v) and the malformed statements in Q.3(vii).
Board references printed on the sheets: 114 (Obj) and 114 (Sub) – 1st Annual 2024.
Download this paper
Print-ready A4 PDF, same content as above, no login needed.