Computer Science SSC-II Solution of 2nd Set Model Paper
Computer Science SSC-II Solution of 2nd Set Model Paper
ROLL NUMBER
⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪ ⓪
① ① ① ① ① ① ① ① ① ① ①
② ② ② ② ② ② ② ② ② ② ②
Answer Sheet No.____________
③ ③ ③ ③ ③ ③ ③ ③ ③ ③ ③
④ ④ ④ ④ ④ ④ ④ ④ ④ ④ ④
⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ ⑤ Sign. of Candidate ___________
⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥ ⑥
⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦ ⑦
Sign. of Invigilator ___________
⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧ ⑧
⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨ ⑨
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
(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)
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.
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
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 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.
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.
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
Testing if-else statement test for equality switch statement test only
as well as for logical expression. for equality.
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.
<ul> and </ul> tags are used. <ol> and </ol> tags are used.
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 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.
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.
*****