[go: up one dir, main page]

0% found this document useful (0 votes)
741 views37 pages

SSC-II Computer Science (2 Sets With Solutions) - Combined

This document contains a model question paper for the Federal Board SSC-II Examination in Computer Science. It has three sections: Section A contains 12 multiple choice questions, Section B contains 9 short answer questions, and Section C contains 2 long answer questions requiring explanations and code writing. The paper tests knowledge of computer science concepts like algorithms, variables, loops, Boolean logic, and HTML. It aims to evaluate students' understanding of programming fundamentals in C language.
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)
741 views37 pages

SSC-II Computer Science (2 Sets With Solutions) - Combined

This document contains a model question paper for the Federal Board SSC-II Examination in Computer Science. It has three sections: Section A contains 12 multiple choice questions, Section B contains 9 short answer questions, and Section C contains 2 long answer questions requiring explanations and code writing. The paper tests knowledge of computer science concepts like algorithms, variables, loops, Boolean logic, and HTML. It aims to evaluate students' understanding of programming fundamentals in C language.
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
You are on page 1/ 37

Version No.

ROLL NUMBER


⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪
① ① ① ① ① ① ① ① ① ① ①
② ② ② ② ② ② ② ② ② ② ②
Answer Sheet No.____________
③ ③ ③ ③ ③ ③ ③ ③ ③ ③ ③
④ ④ ④ ④ ④ ④ ④ ④ ④ ④ ④
⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ Sign. of Candidate ___________
⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥
⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦
Sign. of Invigilator ___________
⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧
⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨

COMPUTER SCIENCE SSC–II


SECTION – A (Marks 12)
Time allowed: 15 Minutes

Section – A is compulsory. All parts of this section are to be answered on this page and handed
over to the Centre Superintendent. Deleting/overwriting is not allowed. Do not use lead pencil.

Q.1 Fill the relevant bubble for each part. Each part carries one mark.
(1) What is the output of following code?
int a = 15;
float s = 5.50;
printf (“%f”, a/s);
A. 2 ⃝ B. 2.72 ⃝
C. 3 ⃝ D. 5 ⃝

(2) Which one of the following symbols is used in flow chart for the statement
“Marks<33”?
A. ⃝ B. ⃝

C. ⃝ D. ⃝

(3) Which one of the following functions is used to read string “Computer Science”?
A. scanf( ) ⃝ B. gets( ) ⃝
C. getchar( ) ⃝ D. getch( ) ⃝

(4) Which statement is equivalent to “j = j + a;” ?


A. j+=a; ⃝ B. j=+a; ⃝
C. j++a; ⃝ D. j=a++; ⃝

(5) Which escape sequence can be used to insert a Tab in “C” Language?
A. \a ⃝ B. \b ⃝
C. \t ⃝ D. \n ⃝

(6) Which one of the following is the most suitable for making two ways decision?
A. if statement ⃝ B. if-else statement ⃝
C. switch statement ⃝ D. Nested-if statement ⃝

Page 1 of 2
(7) How many times “FBISE” will be displayed by the following code?
for (int i=1; i<10; i=+2)
printf (“FBISE”);
A. 1 ⃝ B. 5 ⃝
C. Infinite ⃝ D. The loop will not run. ⃝

(8) What is the output of the following code?


int i ;
for(i=1;i<=2;i++)
printf (“\n i=%d”, i);
A. i=2 ⃝
i =3

B. i =1 ⃝
i =2

C. i =1 ⃝
i =3

D. i =2 ⃝
i =1

(9) Which one of the following gates has an output = A.B?


A. NAND ⃝ B. NOR ⃝
C. OR ⃝ D. AND ⃝

(10) When the input to an inverter is LOW(0) the output will be:
A. HIGH or 0 ⃝ B. LOW or 0 ⃝
C. HIGH or 1 ⃝ D. LOW or 1 ⃝

(11) What is the output of following HTML code?


<ol>
<li> Magnetic Disk </li>
<li> CD and DVD </li>
</ol>
A.  Magnetic Disk ⃝ B. 1. Magnetic Disk ⃝
 CD and DVD 2. CD and DVD
C. 1. Magnetic Disk ⃝ D. Magnetic Disk ⃝
o CD and DVD CD and DVD

(12) Which one of the following is correct HTML statements to divide browser
window into 3 columns?
A. <fram col = 30%, 30%, 40%> ⃝
B. <framset col = 30%, 30%, 40%> ⃝
C. <framset col 30%, 30%, 40%> ⃝
D. <fram row = 30%, 30%, 40%> ⃝
____________________

Page 2 of 2
Federal Board SSC-II Examination
Computer Science Model Question Paper
(Curriculum 2009)

Time allowed: 2.45 hours Total Marks: 43


Note: Answer any nine parts from Section ‘B’ and attempt any two questions from Section ‘C’
on the separately provided answer book. Write your answers neatly and legibly.

SECTION – B (Marks 27)


Q.2 Attempt any NINE parts from the following. All parts carry equal marks. (9  3 = 27)
i. Define algorithm. What is the role of algorithm in problem solving?
ii. Point out valid and invalid variable names.
a. define b. 5name c. a5
d US$ e. a_b f. f name
iii. Write down any three characteristics of High Level Language.
iv. Evaluate each of the following expression assuming, a = 2, z = 1.3, c = 1 and d = 3:
a. b = d/a + d % a; b. x = (a + c)/(z + 0.3); c. y = c / d * a;
v. Write down the names and purpose of any three format specifiers.
vi. Define the following.
i. Control Statement ii. Conditional Statement
vii. Compare an assignment operator (=) and an equal to (= =) operator by giving an
example.
viii. Write a program using while loop to print odd numbers from 1 to 20.
ix. What will be the output of the following code?
void main( )
{
int u, i;
for (u = 1; u< = 5; u++)
{
for (i = 1; i < = u; i++)
{
printf(“%d \t”, i);
}
printf(“\n”);
}
}
x. Construct Truth Table for the following Boolean Expression:
F  x y z  x yz  x y
xi. Convert the following code into for loop:
int sum = 0, num= 0;
do {
sum = sum + num;
printf (“Enter an integer value”);
scanf(“%d”, &num);
}
while (num > = 0 && num < = 15);

Page 1 of 2
xii. Write down the three benefits of web portal.
xiii. Use appropriate text formatting tags to define the following. Write one example
of each.
a. font size b. font colour c. font face

SECTION – C (Marks 16)


Note: Attempt any TWO questions. (8  2 = 16)

Q.3 i. Draw a flowchart to calculate the exponent of a given number. (4)


ii. Explain any four modules of C programming environment. (4)

Q.4 Simplify the Boolean Function F, using Karnaugh Mapping (K-map).


F  xyz  xy z  x y z  x y z  x yz  x y z
Also construct logic circuit for the simplified expression. (4+4)

Q.5 i. Rewrite the following code after removing the errors: (4)
# include < std.h>
# include < conio.h>
void main ( );
{
int p, s;
printf(“\n Enter a number:);
scanf(“%d”, p);
s=p%2;
if(s=0)
printf(“even number%d”, p)
els
printf(“odd number%d”, p);
getch( );
ii. Convert the following program using switch statement: (4)
void main( )
{ char ch; clrscr( );
printf(“Enter a single character”);
scanf(“%c”, &ch);
if ( ch = = ‘a’ || ch = = ‘A’ ||
ch = = ‘e’ || ch = = ‘E’ ||
ch = = ‘i’ || ch = = ‘I’ ||
ch = = ‘o’ || ch = = ‘O’ ||
ch = = ‘u’ || ch = = ‘U’)
printf(“It is a vowel”);
else printf(“It is a consonant”); }

*****

Page 2 of 2
COMPUTER SCIENCE SSC-II
(Curriculum 2009)
Student Learning Outcomes

Sr Section: Contents and Student Learning Outcomes * Cognitive Allocated


No Q. No. Scope Level ** Marks in
(Part no.) Model
Paper
1 A: 1(i) 3.1 iii) Use output functions like: • printf ( ) U 1
Input / Output
functions
2 A:1(ii) 1.3 Flow iv) Use of flow chart symbols U 1
Chart

3 A: 1(iii) 3.1 ii) Use input functions like: • scanf ( ) • U 1


Input / getch ( ), getche ( ), getchar ( ) • gets ( )
Output
functions
4 A: 1(iv) 3.2 Operators iii) Use the following assignment operators: • U 1
Compound assignment operator
(+ =, -, =, * =, / =, % =)

5 A: 1(v) 3.1 Input / Output vi) Explain the use of the following escape K 1
functions sequences using programming examples: •
Alert - \a • Backspace – \b • Newline – \n •
Carrage Return – \r • Tab – \t
6 A: 1(vi) 4.1 Control vi) Use if-else statement K 1
Structure
7 A: 1(vii) 5.1 Loop ii) Know that for loop structure is A 1
Structure composed of: • For • Initialization
expression • Test expression • Body of the
loop • Increment / decrement expression
8 A: 1(viii) 5.1 Loop Structure ii) Know that for loop structure is U 1
composed of: • For • Initialization
expression • Test expression • Body of the
loop • Increment / decrement expression
9 A: 1(ix) 6.2 Logic Gates iv) Explain the following logic gates U 1
with the help of truth tables:
• AND • OR • NAND • NOR • NOT
10 A: 1(x) 6.2 Logic Gates iv) Explain the following logic gates K 1
with the help of truth tables:
NOT

11 A: 1(xi) 7.4 Creating ii) Create: • Unordered list • Ordered list U 1


Lists

12 A: 1(xii) 7.8 Creating iii) Create a frameset U 1


Frames
13 B: 2(i) 1.2 Algorithm i) Define an algorithm K 3
ii) Explain role of algorithm in problem
solving
14 B: 2(ii) 2.4 Constants ii) Explain the rules for specifying variable U 3
and Variables names

15 B: 2(iii) 2.1 Introduction iii) Elaborate characteristics of High Level K 3


Language

16 B: 2(iv) 3.2 Operators xi) Define and explain the order of A 3


precedence of operators

17 B: 2(v) 3.1 Input / Output iv) Define Format specifiers • decimal - %d • K 3


functions integer - %i • float - %f • double - %g,e • char
- %c • long int - %ld
18 B: 2(vi) 4.1 Control i) Define a control statement. K 3
Structure ii) Define a conditional statement

19 B: 2(vii) 3.2 Operators viii) Differentiate between assignment (=) U 3


and equal to operator (= =)
20 B: 2(viii) 5.1 Loop Structure viii) Write codes for flowcharts discussed in A 3
unit-1
To find a sequence of odd numbers starting
from a given number 1.2 (iv)
21 B: 2(ix) 5.1 Loop Structure ii) Know that for loop structure is composed U 3
of: • For • Initialization expression • Test
expression • Body of the loop • Increment /
decrement expression
22 B: 2(x) 6.2 Logic Gates iv) Explain the following logic gates U 3
with the help of truth tables: • AND •
OR • NAND • NOR • NOT • Exclusive
NOR (XNOR) • Exclusive OR (XOR)
23 B: 2(xi) 5.1 Loop ii) Know that for loop structure is composed U 3
Structure of: • For • Initialization expression • Test
expression • Body of the loop • Increment /
decrement expression
iv) Know that do while loop structure is
composed of: • Do • Body of the loop • While
• Test expression • Statement terminator
24 B: 2(xii) 7.1 Introduction • ii) Explain the following types of websites U 3
• Portal

25 B: 2(xiii) 7. 3 Text Use appropriate text formatting tags to K 2+1


Formatting define: • Font size • Font colour • Font
face
26 C: 3 1.3 Flow Chart (v) Draw flow charts of algorithms discussed A+K 4+4
earlier in unit-1 (1.2 (iv))
2.2 Programming ii) Explain the following modules of the C
Environment programming environment • Editor •
Compiler • Linker • Loader • Debugger

27 C: 4 6.3 • iii) Simplify three variable Boolean U+A 4+4


Simplification function/expression
using K Maps • iv) Build logic circuits from the simplified
expressions

28 C: 5 4.1 Control vi) Use if else statement U 8


Structure vii) Know that the switch
statement is composed of: • Switch
• Case • Default • Break

* Student Learning Outcomes


National Curriculum for Computer Sciences Grades IX-XII, 2009
(Page no. 14-25)

**Cognitive Level
K: Knowledge
U: Understanding
A: Application
COMPUTER SCIENCE SSC-II
Table of Specifications
Unit 1: Unit 2: Unit 3: Unit 4: Unit 5: Unit 6: Unit 7: World Total
Programmi Program Input / Control Loop Computer Wide Web and marks
%
ng ming in C Output Structur Structure Logic and HTML(Major part (55
15% Mark Theory Covere
Assessment Objectives Technique Handling e Gates cover in Practical)
s + 25 d
s
10% 10% 15% 15% 15% 20% Practical)
100%
Section - A 1(5)(01) 1(6)(01) 1(10)(01) 03
Knowledge Section - B 2(i)(03) 2(iii)(03) 2(v)(03) 2(vi)(03) 2(xiii)(03)
15 22 29.3%
based
Section - C 3-(04) 04
Section - A 1(2)(01) 1(1)(01) 1(8)(01) 1(9)(01) 1(11)(01)
1(3)(01) 1(12)(01) 08

Understanding 1(4)(01)
based Section - B 2(ii)(03) 2(vii)(03) 2(ix)(03) 2(x)(03) 2(xii)(03) 18 50.7%
2(xi)(03) 38

Section - C 5-(08) 4-(04) 12


Section - A 1(7)(01) 01
Application
based Section - B 2(iv)(03) 2(viii)(03) 15 20%
06

Section - C 3-(04) 4-(04) 08


Total marks 08 10 13 12 11 13 8 75 100
%

* Unit 7: Major content will examine in Practical paper. 10% covered in Theory paper and remaining will cover in Practical paper.
Hence weightage distributed to other units.
KEY: 1(1)(01)
Question No (Part No.) (Allocated Marks)
Federal Board SSC-II Examination
Computer Science Solution of Model Question Paper
(Curriculum 2009)

SECTION – A

Note: Section-A is compulsory and comprises two pages. All parts of this section are to be
answered on the question paper itself. It should be completed in the first 20 minutes and
handed over to the Centre Superintendent. Do not use lead pencil.
(Answers are bold and underlined)
(1) What is the output of the following code?
int a = 15;
float s = 5.50;
printf (“%f”, a/s);
A. 2 B. 2.72
C. 3 D. 5
(2) Which one of the following symbols is used in flow chart for the statement
“Marks<33”?
A. B.

C. D.

(3) Which one of the following functions is used to read string “Computer Science”?

A. scanf( ) B. gets( )
C. getchar( ) D getch( )
.
(4) Which statement is equivalent to “j=j+a;”?

A. j+=a; B. j=+a;
C. j++a; D. j=a++;
(5) Which escape sequence can be used to insert a Tab in “C” Language?
A. \a B. \b
C. \t D. \n

(6) Which one of the following is the most suitable for making two ways decision?
A. if statement B. if-else statement
C. switch statement D. Nested-if statement

(7) How many times “FBISE” will be displayed by the following code?
for (int i=1; i<10; i=+2)
printf (“FBISE”);
A. 1 B. 5
C. Infinite D. The loop will not run.
(8) What is the output of the following code?
int i ;
for(i=1;i<=2;i++)
printf (“\n i=%d”, i);
A. i=2 B. i =1
i=3 i=2
C. i =1 D. i =2
i=3 i=1

(9) Which one of the following gates has an output = A.B?


A. NAND B. NOR
C. OR D. AND

(10) When the input to an inverter is LOW(0) the output will be:
A. HIGH or 0 B. LOW or 0
C. HIGH or 1 D. LOW or 1

(11) What is the output of following HTML code?


<ol>
<li> Magnetic Disk </li>
<li> CD and DVD </li>
</ol>
A. • Magnetic Disk B. 1. Magnetic Disk
• CD and DVD 2. CD and DVD

C. 1. Magnetic Disk Magnetic Disk


o CD and DVD D. CD and DVD

(12) Which one of the following is correct HTML statements to divide browser
window into 3 columns?
A. <fram col = 30%, 30%, 40%>
B. <framset col = 30%, 30%, 40%>
C. <framset col 30%, 30%, 40%>
D. <fram row = 30%, 30%, 40%>
Federal Board SSC-II Examination
Computer Science Solution of Model Question
Paper
(Curriculum 2009)

Time allowed: 2.40 hours Total Marks: 43


Note: Sections ‘B’ and ‘C’ comprise two pages and questions therein are to be answered on the
separately provided Answer Book. Use supplementary answer sheet i.e., sheet B if required.
Write your answers neatly and legibly.

SECTION – B (Marks 27)

Q.2 Attempt any NINE parts from the following. All parts carry equal marks. (9  3 = 27)
i. What is an algorithm and what is the role of algorithm in problem solving?
Answer:
Algorithm means method, procedure, technique or plan. Algorithm is a step-by-
step problem-solving method that is easy to understand and follow. It is a set of
steps that clearly defines a sequence of operations to solve a problem.
ROLE OF ALGORITHM IN PROBLEM SOLVING
Algorithm plays an important role in computer programming. Computer
programming is the process of taking an algorithm and coding it in a programming
language. Formulating an algorithm is the first step for developing a computer
program.
ii. Point out valid and invalid variable names.
Answer:
a. define Invalid b. 5name Invalid
c. a5 Valid d. US$ Invalid
e. a_b Valid f. f name Invalid
iii. Write two advantages and one disadvantage of compiler.
Answer:
Advantage:
A compiler is a computer software that translates entireC language program (source
program) into machine code (object program) that can be understood and executed
by the computer
It also detects syntax errors in the source program and gives hints to the
programmer to correct them.
Disadvantage:
It occupies extra memory since it needs to generate a new file.
iv. Evaluate each of the following expression assuming, a is 2, z is 1.3, c is 1 and d is 3:
a. b = d/a + d % a
b = 3/2 + 3 % 2
b=1+3%2
b=1+1
b=2

b. x = (a + c)/(z + 0.3)
x = (2 + 1)/( 1.3+ 0.3)
x = (3)/(1.3+ 0.3)
x = 3/1.6
x =1.875

c. y=c/d*a
y=1/3*2
y=0*2
y=0

v. Write down the name and purpose of any three format specifiers.
Answer:
NAMES OF FORMAT SPECIFIERS:
%d decimal integer
%f floating-point (decimal notation)
%c single character
Integer Format Specifiers (%d)
The format specifier %d is used to read or print a decimal integer.
Floating-point Format Specifiers (%f)
The format specifier %f is used to read and print floating-point numbers in decimal
notation with a precision of 6 digits after the decimal point.
The Character Format Specifier (%c)
The character format specifier, %c, is used to read or print a single character.
vi. Define the following.
Answer:
i. Control Statement
Control Statements in C are used to execute/transfer the control from one part
of the program to another depending on a condition. These statements are also
called as conditional statements.
ii. Conditional Statement
Conditional Statements in C programming are used to make decisions based on the
conditions. Conditional statements execute sequentially when there is no condition
around the statements. It is also called as branching as a program decides which
statement to execute based on the result of the evaluated condition.
vii. What is the conditional operator? Give an example.
Answer:
The conditional operator is also known as a ternary operator. The conditional
statements are the decision-making statements which depend upon the output of the
expression. It is represented by two symbols, i.e. '?' and ‘:’. Conditional operators
return one value if condition is true and returns another value is condition is false.
Syntax: (Condition? expression1: expression2);
Example: J= (A > 100)? C*D: C+D;
In above example, if A is greater than 100, then product of C and D will be assigned
to J otherwise sum of Cand D will be assigned. This is equal to if else conditional
statements.
viii. Write a program using while loop to print odd numbers from 1 to 20.
Answer:
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
n=1;
while(n<=20)
{
printf("%d\n",n);
n=n+2;
}
getch();
return 0;
}
ix. What will be the output of the following code?
void main( ) { int u, i;
for (u = 1; u< = 5; u++)
{ for (i = 1; i< = u; i++)
{printf(“%d \t”, i);}
printf(“\n”);
} }
OUTPUT:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
x. Construct Truth Table for the following Boolean Expression:

F = x yz + x yz + x y
Answer:

X Y Z =y = +yyz
zx+ +
yzyx+yx y
=x
FF +zxx
Fxzy +xx
yz F = x yz + x yz + x y
0 0 0 0 0 0 0
0 0 1 1 0 0 1
0 1 0 0 0 0 0
0 1 1 0 1 0 1
1 0 0 0 0 1 1
1 0 1 0 0 1 1
1 1 0 0 0 0 0
1 1 1 0 0 0 0
xi. Convert the following code into for loop:
int sum = 0, num= 0;
do {
sum = sum + num;
printf (“Enter an integer value”);
scanf(“%d”, &num); }
while (num> = 0 &&num< = 15);
Answer:
int sum = 0, num= 0;
for(int num=0;num>=0 &&num<=15;)
{
sum=sum+num;
printf(“Enter an integer value”);
scanf(“%d”, &num);
}
xii. Write down benefits of web portal. Give one example.
Answer:
Web portal is a website that offers a large variety of services these include online
shopping malls, news stock prices, email search engines, etc. Web portals function
as a point of access to information on the web.
For example, A school web portal delivers information about the school’s historical
background, admission requirement, School curriculum, tuition fees structure,
School news, student results in a unified way.
xiii. Use appropriate text formatting tags to define the following. Write example of each.
Answer:
a. font size
In HTML, <fontsize=?></font> these tags are used to change the font size.
Replace ? symbol with the number in the range 1 to 7. One is the smallest and
seven is the largest font size.
For Example <fontsize=3>Information Technology</font>

Result: Information Technology


b. font colour
<fontcolor=?></font>these tags are used to change the color of text that is within
the tags. Replace ? symbol with the color such as black, blue, brown, gray, green,
maroon, orange, pink, red, white, yellow etc.
For Example <fontcolor=red> Information Technology </font>
Result: Information Technology
c. font face
<fontface=?></font> these tags are used to change the font face of the text that is
within the tags. Replace? symbol with the font face such as arial, courier, Calibri,
times new roman etc.
For Example <fontface=arial>Information Technology</font>
Result: Information Technology
SECTION – C (Marks 16)
Note: Attempt any TWO questions. (8  2 = 16)
i. Draw a flowchart to calculate the exponent of a given number. (4)
Answer:

ii. Explain any four modules of C programming environment. (4)


Answer:
Four modules of C programming environment
• Text Editor • Compiler • Linker • Loader
Text Editor
A text editor is a simple word-processor that is used to create and edit source code of a
program .Files created by a text editor are plain text files. Most of the editors automatically
highlight compile errors to simplify removing them.
Compiler
A compiler is a computer software that translates C language program (source program)
into machine code (object program) that can be understood and executed by the computer
It also detects syntax errors in the source program and gives hints to the programmer to
correct them. A compiler will only create object program if all the syntax errors in a
program have been corrected if they existed. A program written in C language has the
extension .c (for example first.c) and after compilation the object program extension will
be .obj (for example first.obj)
Linker
Linker is a software that translates object program into a single executable program. a
linker is a computer program that takes one or more object files generated by a compiler
and combines them into one, executable program.
Loader
It is a software that loads programs into memory and then executes them.

Q.4 Simplify the Boolean Function F, using Karnaugh Mapping (K-map).


Also construct logic circuit for the simplified expression. (4+4)
Answer:
F = xyz + xy z + x yz + x y z + xyz + x yz

ȳ ȳ y Y
0 1 1 0
+ x yz + x y z + xyz + x yz
x 1 1 1 1

= xyz + xy z + x yzF+=x xyz


y z ++xxy
yzZz++xxyyzzz + x y z + xyz + x yz

F=x+z

Logic Circuit:

Q.5 i. Rewrite the following code after removing the errors: (4)
# include <std.h>
# include <conio.h>
void main ( );
{
int p, s;
printf(“\n Enter a number:);
scanf(“%d”, p);
s=p%2;
if(s=0)
printf(“even number%d”, p)
els
printf(“odd number%d”, p);
getch( );
Solution:
# include <stdio.h>
# include <conio.h>
void main ( )
{
int p, s;
printf(“\n Enter a number:);
scanf(“%d”, &p);
s=p%2;
if(s==0)
printf(“even number%d”, p);
else
printf(“odd number%d”, p);
getch( );
}
ii. Convert the following program using switch statement: (4)
void main( )
{ char ch; clrscr( );
printf(“Enter a single character”);
scanf(“%c”, &ch);
if ( ch = = ‘a’ || ch = = ‘A’ ||
ch = = ‘e’ || ch = = ‘E’ ||
ch = = ‘i’ || ch = = ‘I’ ||
ch = = ‘o’ || ch = = ‘O’ ||
ch = = ‘u’ || ch = = ‘U’)
printf(“It is a vowel”);
else printf(“It is a consonant”); }
Solution:
void main( )
{ char ch;
clrscr( );
printf(“Enter a single character”);
scanf(“%c”, &ch);
switch(ch)
{

case ‘a’:
case ‘e’:
case ‘i’:
case ‘o’:
case ‘u’:
case ‘A’:
case ‘E’:
case ‘I’:
case ‘O’:
case ‘U’:
printf(“It is a vowel”);
break;
default:
printf(“It is a consonant”);
}
}

*****
NOTE:
This is suggested (proposed) solution or answers to the questions given in SECTION-B and
C. Students can write any valid alternate answers.
Version No. ROLL NUMBER


⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪
① ① ① ① ① ① ① ① ① ① ①
② ② ② ② ② ② ② ② ② ② ②
Answer Sheet No.____________
③ ③ ③ ③ ③ ③ ③ ③ ③ ③ ③
④ ④ ④ ④ ④ ④ ④ ④ ④ ④ ④
⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ Sign. of Candidate ___________
⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥
⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦
Sign. of Invigilator ___________
⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧
⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨

COMPUTER SCIENCE SSC–II (2nd Set)


SECTION – A (Marks 12)
Time allowed: 15 Minutes

Section – A is compulsory. All parts of this section are to be answered on this page and handed
over to the Centre Superintendent. Deleting/overwriting is not allowed. Do not use lead pencil.

Q.1 Fill the relevant bubble for each part. Each part carries one mark.
(1) Which symbol is used to obtain the total marks from the values given by users, in
the flow chart development?
A. Rectangle ⃝ B. Parallelogram ⃝
C. Diamond ⃝ D. Oval ⃝
(2) Which one of the following problem-solving stage refers to dividing the solution
into steps and arranging in order to solve the problem?
A. Planning ⃝ B. Analyzing ⃝
C. Defining ⃝ D. Selecting ⃝
(3) Which of the software examines the values stored in variables and help in finding
and removing the errors?
A. Loader ⃝ B. Linker ⃝
C. Editor ⃝ D. Debugger ⃝
(4) What is the range of numbers that can be stored in a variable of type float?
A 10-38 - 1038 ⃝ B. 10-308 - 10308 ⃝
C. 10 – 10
38 38
⃝ D. -38
10 - 10 32

(5) Which symbol with the variable, refers to the memory location in scanf()
function:
A. # ⃝ B. $ ⃝
C. % ⃝ D. & ⃝
(6) What is the value of “z” after evaluating the given expression where a = 5, b = 3?
z = b / 2 + b * 4 / b && b < a + a / 3
A. 5 ⃝ B. 0 ⃝
C. 1 ⃝ D. 6 ⃝
(7) What is the value of “z” after evaluating the given expression where x=10, y=3?
z = 4*++x ||--y<x%2&&x+y
A. 41 ⃝ B. 0 ⃝
C. 1 ⃝ D. 40 ⃝

Page 1 of 2
(8) What is the output of the following codes where a=1 and b= 5?
if (a-b<6)
printf(“%d”, a);
else
printf(“%d”, b);
printf(“%d”, a+b);
A. 1 ⃝ B. 5 ⃝
C. 15 ⃝ D. 16 ⃝

(9) Which one of the following is a valid statement for “For loop”?
A. for(;;) ⃝ B. for(int I =1; ;) ⃝
C. for(; ;k++) ⃝ D. All of these ⃝

(10) Which logic gate is represented by the function = (𝑥𝑦)?


A. NAND ⃝ B. NOR ⃝
C. Exclusive-OR ⃝ D. Exclusive-NOR ⃝

(11) A computer that makes the web pages available through the internet is called:
A. website ⃝ B. web-server ⃝
C. web-browser ⃝ D. web-link ⃝

(12) Which part of the web address tell the server type of file is being requested?
A. www ⃝ B. http:// ⃝
C. .html ⃝ D. URL ⃝

______________

Page 2 of 2
Federal Board SSC-II Examination
Computer Science Model Question Paper
(Curriculum 2009)

Time allowed: 2.45 hours Total Marks: 43


Note: Answer any nine parts from Section ‘B’ and attempt any two questions from Section ‘C’
on the separately provided answer book. Write your answers neatly and legibly.

SECTION – B (Marks 27)


Q.2 Attempt any NINE parts from the following. All parts carry equal marks. (9  3 = 27)
i. What are the features to select the best solution of a problem? (1+1+1)
ii. Write an algorithm to find the sum, product and average of five given numbers?
(1+1+1)
iii. Briefly describe the three fundamental element of structured programming in C
language? (1+1+1)
iv. What happens if header-files were not used in C program? List at-least two
header-files with their purpose (1+2)
v. Compare printf() and puts() function with at-least one example. (3)
vi. Write at-least three differences between format specifiers and escape sequence
characters. (3)
vii. Draw precedence table of operators used in the following expression: (3)
z = !(4*++x-y || x==y/--y<x%2&&x++ +y)
viii. Differentiate between if-else-if and switch structure. (3)
ix. Write a code that prints the given sequence of numbers on a single line also print
its sum by using any loop. (2+1)
30 27 24 21 18 15 12 9 6 3 0 -3 -6 -9
x. Write the output of each gate shown in the following figure: (3)

xi. Differentiate between ordered list and unordered list used in HTML. (3)
xii. Define the following terms: (1+1+1)
a. Web-Hosting b. Web-Server c. Hyper-Link
xiii. Differentiate between Frame and Frame set by giving one example used in
HTML. (3)

SECTION – C (Marks 16)


Note: Attempt any TWO questions. (8  2 = 16)

Q.3 Write a C program to input electricity unit charge and calculate the total electricity bill
according to the given condition: (5+3)
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit

Page 1 of 2
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill.
Also justify your selection of conditional control structure.

Q.4 Write a program that read a number and prints its power (take it from user) if it is a prime
number otherwise print its factorial by using any control structure. (8)

Q.5 a. Briefly describe NOR and Exclusive NOR(XNOR) logic gate with circuit
diagram and truth table. (4)
b. Define Karnaugh Map(K-Map) also write the simplification rules for three
variable Karnaugh Map. (4)

*****

Page 2 of 2
COMPUTER SCIENCE SSC-II (2nd Set)
(Curriculum 2009)
Student Learning Outcomes Alignment Chart

Sr Section: Contents and Student Learning Outcomes Cognitive Allocated


No Q. No. Scope Level ** Marks in
(Part no.) Model
Paper
1 A: 1(i) 1.3 Flow Chart (iv) Use of flow chart symbols U 1

2 A:1(ii) 1.1 Understanding iii) Plan the solution of problem K 1


the Problem
3 A: 1(iii) 2.2 Programming ii) Explain the following modules K 1
Environment of the C programming environment
• Debugger
4 A: 1(iv) 2.4 Constants and iii) Know the following data types offered K 1
Variables by C and the number of bytes taken by
each data type • Floating point – float
5 A: 1(v) 3.1 Input / ii) Use input functions like: • scanf ( ) K 1
Output functions
6 A: 1(vi) 3.2 Operators ii) Use the following arithmetic operators: U 1
• Addition (+) • Subtraction (-) •
Multiplication (*) • Division ( / )
• Remainder (%)
iii) Use the following assignment
operators: • Assignment operator (=)
• Compound assignment operator (+ =, -,
=, * =, / =, % =) • Increment operator (++)
- Prefix - Postfix • Decrement operator (--)
- Prefix – Postfix v) Use the following
relational operators: • Less than ( ) • Less
than or equal to (<=) • Greater than or
equal to ( >= ) • Equal to (= =) • Not equal
to (! =)
vii) Use of the following logical operators:
• AND (&&) • OR (||) • NOT (!)
7 A: 1(vii) 3.2 Operators ii) Use the following arithmetic operators: U 1
• Addition (+) • Subtraction (-)
• Multiplication (*) • Division ( / )
• Remainder (%)
iii) Use the following assignment
operators: • Assignment operator (=)
• Compound assignment operator (+ =, -,
=, * =, / =, % =) • Increment operator (++)
- Prefix - Postfix • Decrement operator (--)
- Prefix – Postfix v) Use the following
relational operators: • Less than ( ) • Less
than or equal to (<=) • Greater than or
equal to ( >= ) • Equal to (= =) • Not equal
to (! =)
vii) Use of the following logical operators:
• AND (&&) • OR (||) • NOT (!)
8 A: 1(viii) 4.1 Control vi) Use if-else statement U 1
Structure
9 A: 1(ix) 5.1 Loop • ii) Know that for loop structure is U 1
Structure composed of: • For • Initialization
expression • Test expression • Body of
the loop • Increment / decrement
expression
10 A: 1(x) 6.2 Logic Gates iv) Explain the following logic gates U 1
with the help of truth tables: NOR
11 A: 1(xi) 7.1Introduction i) Define the following terms: Web Server K 1
12 A: 1(xii) 7.1 Introduction i) Define the following terms: • Uniform U 1
Resource Locator (URL)
B: 2(i) 1.1 Understanding v) Select the best solution on the basis of: K 1+1+1
13 the Problem • Speed • Cost • Complexity
14 B: 2(ii) 1.2 Algorithm iv) Write algorithms for solving the U 1+1+1
following problems: - • To find the sum,
product and average of five given numbers
B: 2(iii) 2.1 Introduction ii) Explain the following levels of K 1+1+1
15 programming languages • Structured
language
16 B: 2(iv) 2.3 Programming i) Define header files U 1+2
Basics
17 B: 2(v) 3.1 Input / Output i) Use output functions like: • printf ( ) U 3
functions
18 B: 2(vi) 3.1 Input / Output iv) Define Format specifiers U 3
functions v) Define an escape sequence
19 B: 2(vii) 3.2 Operators xi) Define and explain the order of U 1+2
precedence of operators
20 B: 2(viii) 4.1 Control x) Differentiate among all selection U 3
Structure structures
21 B: 2(ix) 5.1 Loop viii) Write codes for flowcharts discussed A 2+1
Structure in unit-1
22 B: 2(x) 6.2 Logic Gates iii) Explain a truth table. K 3
23 B: 2(xi) 7.4 Creating Lists iii) Differentiate between ordered list and U 1+1+1
unordered list
24 B: 2(xii) 7.1 Introduction i) Define the following terms: Web Server K 1+2
• Web Hosting
25 B: 2(xiii) 7.8 Creating ii) Differentiate between a frame and a U 3
Frames frameset
26 C: 3 4.1 Control ix) Use nested selection structures A+U 5+3
Structure
27 C: 4 5.1 Loop viii) Write codes for flowcharts discussed A 8
Structure in unit-1
28 C: 5 a. 6.2 Logic iv) Explain the following logic gates with K 4+4
Gates the help of truth tables: • NOR • Exclusive
b. 6.3 NOR (XNOR)
iii) Simplify three variable Boolean
Simplification function/expression
using K Maps

**Cognitive Level
K: Knowledge U: Understanding A: Application
COMPUTER SCIENCE SSC-II (2nd Set)
Table of Specification

UNIT 1 Unit 2: ROGRAMMING Unit 3: INPUT / Unit 4: Unit 5: LOOP Unit 6: Unit 7: Cognitive
PROGRAMMING IN C 10% OUTPUT CONTROL STRUCTURE COMPUTER WORLD level Total
Assessment TECHNIQUES 10% HANDLINGC++ STRUCTURE 15% LOGIC AND WIDE WEB
Cognitive
marks: 75
Cognitive
Objectives level Marks level %
15% 15% GATES15% AND HTML
20%
Section A 1-ii-(01) 1-iii-(01) 1-v-(01) 1-xi-(01)
05
Knowledge

1-iv-(01)
Section B 2-i-(03) 2-iii-(03) 2-xii-(03) 22 29.3%
09
Section C 5(08) 08
Section A 1-i-(01) 1-vi-(01) 1-viii-(01) 1-x-(01) 1-xii-(01)
1-vii-(01) 1-ix-(01)
Understanding

07

Section B 2-ii-(03) 2-iv-(03) 2-v-(03) 3(03) 2-x-(03) 2-xiii-(03) 37 49.3%


2-vi-(03) 2-viii-(03) 2-xi-(03) 30
2-vii-(03)
Section C -
Section A -
Application

Section B 2-ix-(03) -
16 21.3%
Section C 3(05) 4(08)
16
Total marks 8 8 12 12 12 12 11 75 100%

KEY: 1-i-(01) Q. No - Part No - (Allocated Marks)


Note: (i) The policy of FBISE for knowledge based questions, understanding based questions and application based questions is approximately 30% knowledge based,
50% understanding based, 20% application based.
(ii) The total marks specified for each unit/content in the table of specification is only related to this model question paper.
(iii) The level of difficulty of the paper is approximately 40% easy, 40% moderate, 20% difficult
Version No. ROLL NUMBER


⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪
① ① ① ① ① ① ① ① ① ① ①
② ② ② ② ② ② ② ② ② ② ②
Answer Sheet No.____________
③ ③ ③ ③ ③ ③ ③ ③ ③ ③ ③
④ ④ ④ ④ ④ ④ ④ ④ ④ ④ ④
⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ Sign. of Candidate ___________
⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥
⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦
Sign. of Invigilator ___________
⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧
⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨

COMPUTER SCIENCE SSC–II (2nd Set Solution)


SECTION – A (Marks 12)
Time allowed: 15 Minutes

Section – A is compulsory. All parts of this section are to be answered on this page and handed
over to the Centre Superintendent. Deleting/overwriting is not allowed. Do not use lead pencil.

Q.1 Fill the relevant bubble for each part. Each part carries one mark.
(1) Which symbol is used to obtain the total marks from the values given by users, in
the flow chart development?
A. Rectangle B. Parallelogram ⃝
C. Diamond ⃝ D. Oval ⃝
(2) Which one of the following problem-solving stage refers to dividing the solution
into steps and arranging in order to solve the problem?
A. Planning B. Analyzing ⃝
C. Defining ⃝ D. Selecting ⃝
(3) Which of the software examines the values stored in variables and help in finding
and removing the errors?
A. Loader ⃝ B. Linker ⃝
C. Editor ⃝ D. Debugger
(4) What is the range of numbers that can be stored in a variable of type float?
A 10-38 - 1038 B. 10-308 - 10308 ⃝
C. 10 – 10
38 38
⃝ D. -38
10 - 10 32

(5) Which symbol with the variable, refers to the memory location in scanf()
function:
A. # ⃝ B. $ ⃝
C. % ⃝ D. &
(6) What is the value of “z” after evaluating the given expressionwhere a = 5, b = 3?
z = b / 2 + b * 4 / b && b < a + a / 3
A. 5 ⃝ B. 0 ⃝
C. 1 D. 6 ⃝
(7) What is the value of “z” after evaluating the given expressionwhere x=10, y=3?
z = 4*++x ||--y<x%2&&x+y
A. 41 ⃝ B. 0 ⃝
C. 1 D. 40 ⃝

Page 1 of 2
(8) What is the output of the following codes where a=1 and b= 5?
if (a-b<6)
printf(“%d”, a);
else
printf(“%d”, b);
printf(“%d”, a+b);
A. 1 ⃝ B. 5 ⃝
C. 15 ⃝ D. 16

(9) Which one of the following is a valid statement for “For loop”?
A. for(;;) ⃝ B. for(int I =1; ;) ⃝
C. for(; ;k++) ⃝ D. All of these

(10) Which logic gate is represented by the function = (𝑥𝑦)?


A. NAND B. NOR ⃝
C. Exclusive-OR ⃝ D. Exclusive-NOR ⃝

(11) A computer that makes the web pages available through the internet is called:
A. website ⃝ B. web-server
C. web-browser ⃝ D. web-link ⃝

(12) Which part of the web address tell the server type of file is being requested?
A. www ⃝ B. http://
C. .html ⃝ D. URL ⃝

______________

Page 2of 2
Federal Board SSC-II Examination
Computer Science Model Question Paper
(Curriculum 2009)

Time allowed: 2.45 hours Total Marks: 43

Note: Answer any nine parts from Section ‘B’ and attempt any two questions from Section ‘C’
on the separately provided answer book. Write your answers neatly and legibly.

SECTION – B (Marks 27)


Q.2 Attempt any NINE parts from the following. All parts carry equal marks. (9  3 = 27)
i. What are the features to select the best solution of a problem?(1+1+1)
Ans. The selection of final solution of a problem should be based on the following
criteria.
Speed: The selected solution of the problem should be efficient. In other words, it
means when the solution is implemented in a programming language, the program
should run fast.
Cost: The selected solution of the problem should provide a cost-effective way of
implementation.
Complexity: The selected solution of the problem should not be complicated. It
should contain minimum number of instructions/simple steps.

ii. Write an algorithm to find the sum, product and average of five given numbers?
(1+1+1)
Ans. Algorithm:
Start:
Input: five numbers
Step 1 : input a,b,c,d,e
Step 2: sum=0,average=0 , product=1
Step 3: sum = a+b+c+d+e
Step 4: average = sum /5
Step 5: product= a*b*c*d*e

Output: the sum, product and average

Step 6: print sum.


Step 7: print product.
Step 8: print average.
Stop:

iii. Briefly describe the three fundamental element of structured programming in C


language? (1+1+1)
Ans. Structured languages consist of three fundamental elements, which are sequence,
selection and repetition.
Sequence: It means, writing program statements in a logical sequence. Each step
in the sequence must logically progress to the next without producing any
undesirable effects.
Selection: It allows the selection of any number of statements based on the result
of evaluation of a condition which may be true or false. Examples of statements
that implement selection in programming are if, else-if, switch, etc.
Repetition (loop): It means executing one or more statements a number of times
until a condition is satisfied. Repetition is implemented in programs using
statements, such as for and while loops.

iv. What happens if header-files were not used in C program? List at-least two
header-files with their purpose (1+2)
Ans. If we are not including header file than we will not be able to use functions like
printf() or scanf(). These functions are premade in stdio.h
stdio.h Mainly used to perform input and output operations like
printf(),scanf()
string.h Mainly used to perform string handling operations like strlen(),
strcmp() etc.
conio.h With this header file, you can execute console input and output
operations.
math.h Mainly used to perform mathematical operations like sqrt(),pow()
etc.

v. Compare printf() and puts() function with at-least one example. (3)
Ans.
printf() puts()

It is used to display all types of data It is used to display only string data
and messages. and messages.

It requires a format specifier to It does not require a format specifier


display formatted data. to display string.

It can display multiple data at a time It is used to display only one string at
by multiple format specifiers in one a time.
printf( ).

Syntax: Syntax:
printf(“list of format specifier or puts(variable);
message”, list of variables);

Example: Example:
intx,y; char ch[]="Hello";
printf ("%d%d",x,y); puts(ch);

vi. Write at-least three differences between format specifiers and escape sequence
characters. (3)
Ans.

Escape sequences Format specifier

In C language Escape sequences are In C language format specifiers are


mostly used in printf() function to take used in printf() and scanf() functions
the control to specified point. to specify the type of variable the
Escape sequences Format specifier

function is dealing with.


Escape sequences are not mandatory Format specifier are mandatory part of
part of printf() function. scanf() function and in printf()
mandatory if variable or expression is
used.
Common Escape sequences are: Common format specifiers are:
\n New line %c Prints a single character
\t Horizontal tab space Read a character
\r Carriage return %d Prints a decimal integer
\b Backspace Read a signed decimal integer
\f Form feed %f Prints a floating point
\a Beep sound Read floating point number
\’ Single quote %s Prints a String
\” Double quote Read a string (till null
\\ Backslash character)

Syntax: Syntax:
printf(“list of format specifier or printf(“list of format specifier or
message or escape sequence”, list of message”, list of variables);
variables);

Example: Example:
For example \n takes the control to %c Prints a single character
new line, and \t prints a tab space. Read a character
%d Prints a decimal integer
Read a signed decimal integer

vii. Draw precedence table of operators used in the following expression: (3)
z = !(4*++x-y || x==y/--y<x%2&&x+++y)
Ans.
No. Operator Description
1 ++ -- increment/ decrement
2 * / % Multiplication/division/modulus
3 + - Addition/subtraction
4 Relational less than/less than or equal to
< <=
Relational greater than/greater than or
> >=
equal to
5 == != Relational is equal to/is not equal to
6 && Logical AND
7 || Logical OR
8 = Assignment
viii. Differentiate between if-else-if and switch structure. (3)
Ans.

Criteria IF-ELSE-IF SWITCH

Basic It's determines the statement which It's determines the statement
will be executed depend upon the which will be executed is
output of the expression inside if decided by user
statement

Expression if-else statement uses multiple switch statement uses single


statement for multiple choices. expression for multiple
choices.

Testing if-else statement test for equality switch statement test only
as well as for logical expression. for equality.

Evaluation if statement evaluates integer, switch statement evaluates


character, pointer or floating-point only character or integer
type or boolean type. value.

Sequence Either if statement will be switch statement execute


of executed or else statement is one case after another till a
Execution executed. break statement is appeared
or the end of switch
statement is reached.

ix. Default If the condition inside if If the condition inside switch


Execution statements is false, then by default statements does not match
W the else statement is executed if with any of cases, for that
r created. instance the default
i statements is executed if
t created.
e
a code that prints the given sequence of numbers on a single line also print its
sum by using any loop. (2+1)
30 27 24 21 18 15 12 9 6 3 0 -3 -6 -9
Ans. for(i=30; i<=-9; i-=3)
{
printf(“%d ”, i);
sum+=i;
}
printf(“\n The sum of series is %d”, sum);

x. Write the output of each gate shown in the following figure: (3)

Ans. x̄

x̄ ȳz
x̄ yz
x ȳ
f= x̄ ȳz+ x̄ yz+ x ȳ
xi. Differentiate between ordered list and unordered list used in HTML. (3)
Ans.

Unordered list Ordered list

In an ordered list, each item is


In an unordered list, each item is
displayed along with the numbers or
displayed with a bullet.
letters instead of bullets.

It is also known as bulleted list. It is also known as number list.

UL is an Unordered List. OL is an Ordered List.

<ul> and </ul> tags are used. <ol> and </ol> tags are used.

xii. Define the following terms: (1+1+1)


a. Web-Hosting b. Web-Server c. Hyper-Link
Ans. a. Web-Hosting: is an online service that allows you to publish your website files
onto the internet. So, anyone who has access to the internet has access to your
website.

b. Web-Server: is a computer where the web content is stored. Basically, web


server is used to host the web sites but there exist other web servers also such as
gaming, storage, FTP, email etc.

c. Hyper-Link: is a word, phrase, or image that you can click on to jump to a new
document or a new section within the current document.

xiii. Differentiate between Frame and Frame set by giving one example used in
HTML. (3)
Ans.

Frame Frame-set

Frame allows dividing a browser Frame set consist of a collection of


window into multiple sections. frames in the browser.

Frame holds a separate document. Frameset holds one or more frames.

Frame has the attributes such as Frame has the attributes such as cols,
frameborder, marginwidth, rows…..
marginheight, name, ……
SECTION – C(Marks 16)
Note: Attempt any TWO questions. (8  2 = 16)
Q.3 Write a C program to input electricity unit charge and calculate the total electricity bill
according to the given condition: (5+3)
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill.
Also justify your selection of conditional control structure.

Ans. #include <stdio.h>


int main()
{
int unit;
floatamt, total_amt, sur_charge;
printf("Enter total units consumed: ");
scanf("%d", &unit);
if(unit <= 50)
{
amt = unit * 0.50;
}
else if(unit <= 150)
{
amt = 25 + ((unit-50) * 0.75);
}
else if(unit <= 250)
{
amt = 100 + ((unit-150) * 1.20);
}
else
{
amt = 220 + ((unit-250) * 1.50);
}
sur_charge = amt * 0.20;
total_amt =amt + sur_charge;
printf("Electricity Bill = Rs. %f", total_amt);
}
Justification:
If-else-if is better choice because:
In it this statement will be executed depend upon the output of the expression inside if
statement.
Test for equality as well as for logical expression.
If statement evaluates integer, character, pointer or floating-point type or Boolean type.

Q.4 Write a program that read a number and prints its power (take it from user) if it is a prime
number otherwise print its factorial by using any control structure. (8)
Ans. #include<stdio.h>
void main()
{
intn,i,m=0,flag=0, exponent, power=1, f=1;
printf("Enter the number to check prime:");
scanf("%d",&n);
m=n/2;
for(i=2;i<=m;i++)
{
if(n%i==0)
{
printf("\n\nNumber is not prime\n\n");
flag=1;
break;
}
}
if(flag==0)
{
printf("\n Enter Exponent: ");
scanf("%d",&exponent);
while(exponent!=0)
{
power *= n;
exponent--;
}
printf("\n\nThe result of power of given No. is = %d\n\n", power);
}
else
{
for(i=1;i<=n;i++)
f=f*i;
printf("\n\nThe Factorial of %d is: %d\n\n",n,f);
}
}

Q.5 a. Briefly describe NOR and ExclusiveNOR(XNOR) logic gate with circuit
diagram and truth table. (4)
Ans.
NOR Gate:
The Logic NOR Gate gate is a combination of the digital logic OR gate and an inverter or
NOT gate connected together in series:
Truth Table+ circuit diagram:
Symbol Truth Table

B A ̅̅̅̅̅̅̅̅
Q=𝐴 +𝐵

0 0 1

0 1 0
2-input NOR Gate
1 0 0

1 1 0
Exclusive-NOR Gate:
The Exclusive-NOR Gate function is a digital logic gate that is the reverse or
complementary form of the Exclusive-OR function.
Truth Table+ circuit diagram:
Symbol Truth Table

B A Q= A ⊕ B

0 0 1

0 1 0
2-input Ex-NOR Gate
1 0 0

1 1 1

b. Define Karnaugh Map(K-Map) also write the simplification rules for three
variable Karnaugh Map. (4)
Ans. KarnaughMap(K-Map)
The K-map method of solving the logical expressions is referred to as the
graphical technique of simplifying Boolean expressions. K-maps basically insert the
values of the output variable in cells The number of cells in the K-map is determined by
the number of input variables as two raised to the power of the number of input variables
Simplification rules for three variableKarnaugh Map:
 K-Map has total of 2 rows and 4 columns which corresponds to 8 cells in 3-variable.
 Fill the K-map by entering 1 to each product-term into the K-map cell and fill the
remaining
cells with zeros.
 Form the groups by considering each one in the K-map start making groups of 2, 4,
and 8.
 Groups may be horizontal or vertical, but not diagonal.
 Grouping of 1s includes neighboring cells, corners and sides even though they overlap
each other.
 If possible, include each 1 in at least one group.
 Make larger groups if possible.
 Once all 1s are covered then you can stop.
 Find the Boolean term for each group. By looking at the common variables in cell-
labeling
 Write the simplified function in the form of sum of terms.

NOTE: This is suggested (proposed) solution to the questions given in SECTION-B and C.
Students can write any valid alternate answers.
*****

You might also like