Computer Science
Computer Science
FOR HSSC (CLASSES XIXII) COMPULSORY FOR ALL (500 marks) 1. 2. English (Compulsory)/ English (Advance) Urdu (Compulsory)/ Urdu Salees In lieu of Urdu (Compulsory)/ Pakistan Culture for Foreign Students Part I and Pakistan Culture Paper-II Islamic Education/Civics (for Non-Muslims) Pakistan Studies 2 papers 2 papers 200 marks 200 marks
3. 4.
1 paper 1 paper
50 marks 50 marks
SCIENCE GROUP (600 marks) The students will choose one of the following (A), (B) and (C) Groups carrying 600 marks: (A) Pre-Medical Group: Physics, Chemistry, Biology (B) Pre-Engineering Group: Physics, Chemistry, Mathematics (C) Science General Group: 1. 2. 3. 4. 5. Physics, Mathematics, Statistics Mathematics, Economics, Statistics Economics, Mathematics, Computer Science Physics, Mathematics, Computer Science Mathematics, Statistics, Computer Science
HUMANITIES GROUP (600 marks) Select three subjects of 200 marks each from the following: S. No. Subject 1. Arabic/Persian/French/English (Elective)/Urdu (Elective) 2. Economics 3. Fine Arts 4. Philosophy 5. Psychology 6. Statistics 7. History of Modern World/Islamic History/ History of Muslim India/ History of Pakistan 8. Islamic Studies 9. Health and Physical Education COMMERCE GROUP (600 marks) S. No. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. Subject Sindhi (Elective) Civics Education Geography Sociology Mathematics Computer Science Islamic Culture Library Science Outlines of Home Economics
HSSC I 1. 2. 3. 4. Principles of Accounting Principles of Economics Principles of Commerce Business Mathematics paper I paper I paper I paper I 100 marks 75 marks 75 marks 50 marks
HSSC II 1. 2. 3. 4. Principles of Accounting Commercial Geography Computer Studies/Typing/Banking Statistics paper II paper II paper II paper II 100 marks 75 marks 75 marks 50 marks
MEDICAL TECHNOLOGY GROUP (600 marks each) 1. 2. 3. 4 5. 6. Medical Lab Technology Group Dental Hygiene Technology Group Operation Theater Technology Group Medical Imaging Technology Group Physiotherapy Technology Group Ophthalmic Technology Group
responsibility and selfless service to the nation. We have to see that they are fully qualified and equipped to play their part in various branches of national life in a manner which will do honour to Pakistan. These desires of the Quaid have been reflected in the Constitution of the Islamic Republic of Pakistan and relevant articles are: The state shall endeavour, in respect of the Muslims of Pakistan: a. to make the teachings of the Holy Quran and Islamiat compulsory and encourage and facilitate the learning of Arabic language to secure correct and exact printing and publishing of the Holy Quran; b. to promote unity amongst them and the observance of Islamic moral standards; Provide basic necessities of life, such as food, clothing, housing, education and medical relief for all such citizens irrespective of sex, caste, creed or race as are permanently or temporarily unable to earn their livelihood on account of infirmity, sickness or unemployment; Remove illiteracy and provide free and compulsory secondary education within minimum possible period. Enable the people of different areas, through education, training, agricultural and industrial development and other methods, to participate fully in all the forms of national activities including employment in the service of Pakistan; The State shall discourage parochial, racial, tribal, sectarian and provincial prejudices among the citizens. Reduce disparity in the income and earnings of individuals, including persons in various classes of the service of Pakistan. Steps shall be taken to ensure full participation of women in all the spheres of national life.
The vision is to transform Pakistani nation into an integrated, cohesive entity, that can compete and stand up to the challenges of the 21 st Century. The Policy is formulated to realize the vision of educationally well-developed, politically united, economically prosperous, morally sound and spiritually elevated nation.
OBJECTIVES
To make the Quranic principles and Islamic practices as an integral part of curricula so that the message of the Holy Quran could be disseminated in the process of education as well as training. To educate and train the future generation of Pakistan as true practicing Muslims who would be able to usher in the 21 st century and the next millennium with courage, confidence, wisdom and tolerance. To achieve universal primary education by using formal and informal techniques to provide second opportunity to school drop-outs by establishing basic education community schools all over the country. To meet the basic learning needs of a child in terms of learning tools and contents. To expand basic education qualitatively and quantitatively by providing the maximum opportunities to every child of free access to education. The imbalances and disparities in the system will be removed to enhance the access with the increased number of more middle and secondary schools. To ensure that all the boys and girls, desirous of entering secondary education, get their basic right through the availability of the schools. To lay emphasis on diversification of curricula so as to transform the system from supply-oriented to demand oriented. To attract the educated youth to world-of-work from various educational levels is one of the policy objectives so that they may become productive and useful citizens and contribute positively as members of the society. To make curriculum development a continuous process; and to make arrangements for developing a uniform system of education. To prepare the students for the world of work, as well as pursuit of professional and specialized higher education.
To increase the effectiveness of the system by institutionalizing in-service training of teachers, teacher trainers and educational administrators. To upgrade the quality of pre-service teacher training programmes by introducing parallel programmes of longer duration at postsecondary and post-degree levels. To develop a viable framework for policy, planning and development of teacher education programmes, both in-service and pre-service. To develop opportunities for technical and vocational education in the country for producing trained manpower, commensurate with the needs of industry and economic development goals. To improve the quality of technical education so as to enhance the chances of employment of Technical and Vocational Education (TVE) graduates by moving from a static, supply-based system to a demand-driven system. To popularize information technology among students of all ages and prepare them for the next century. To emphasize different roles of computer as a learning tool in the classroom learning about computers and learning to think and work with computers and to employ information technology in planning and monitoring of educational programmes. To encourage private sector to take a percentage of poor students for free education. To institutionalize the process of monitoring and evaluation from the lowest to the highest levels. To identify indicators for different components of policy, in terms of quality and quantity and to adopt corrective measures during the process of implementation. To achieve excellence in different fields of higher education by introducing new disciplines/emerging sciences in the universities, and transform selected disciplines into centres of advanced studies, research and extension. To upgrade the quality of higher education by bringing teaching, learning and research process in line with international standards.
Programming Using C Outline for C Characteristics of High level Programming Languages Basic Structure of Programme Creating, Editing and Saving a Source Programme Compiling, Linking and executing a Program Variables, character, integer, long integer, floating point, double precision Input/output, printf, scanf, format specifirer, field width specifier Operators: Arithmetic, Relational, Logical Operators Comments Loops: for loop, while loop, do-while Decision: if statement, if-else Statement, else-if, Switch Statement, Conditional Operator Importance of Functions Simple functions Function Passing Arguments and Returning Values Open file, Read, Write, Append and Close File
C LANGUAGE 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Writing a program which prints a text of 4 lines consisting of characters, integer values and floating point values using printf statement. Writing a program that reads and prints the data using the Escape Sequence, (Asking the name, age, height and gender of the student using scant and print statements) Writing a program, which uses operators (calculate the area of triangles, volume of spheres and arrange the resultant values in ascending order) Writing a program which uses for loop statement, (Generate the multiplication table from 2 to 20) Writing a program which uses while loop and Nested while loop, (Use for loop and continue the process in while loop satisfying this condition) Finding the factorial of N using while loop, read value of N using scant and print the factorial of various N Draw a checkerboard and print it using if-else statement, and extend the program using Nested if-else Writing a program which uses a switch statement and breaks the program if certain condition is observed. Repeat the program with case statement Writing a function, which generates factorial of N and calls this function in the main program Writing a program which uses multiple arguments in a function. (Develop a user-defined function to generate a rectangle. Use the function for passing arguments to draw different sizes of rectangles and squares)
10
11
12
Determine:
13
Differentiate: Discuss: Draw: Enter: Explain: Identify: Justify: Know: Make: Name: Present: Recognize: Select: Set: Show: State: Use: Write:
Identify those characteristics which always or usually help us to tell two categories apart. A list of features is required. Express views in a logical and lucid way considering all aspects of a matter under discussion and draw conclusions. Implies a simple free hand sketch or diagram. Care should be taken with proportions and the clear labeling of parts. Implies feeding in the data by making use of the keyboard. Reason or use some reference to theory, depending on the context. Pick out, recognizing specified information from a given content or situation. Provide evidence of understanding any concept or skill with sufficient grounds. Requires remembering the factual information, figures, equipment and contexts. Putting different items together to develop a set of the desired data or functions. Identify people, places and organizations. Show a programme or any software function or data with related basis. Involves looking at a given example and stating what it most probably is. Choose the desirable page layout from a given document. Requires placing a software function in order for further programming. Demonstrate or prove by evidence and or by argument. Implies a concise answer with little or no supporting argument, e.g. a numerical answer that can be obtained by inspection. Deploy the required attribute in a constructed response or apply any computer skill of software in a practical way. Implies making a list of desired entities or functions.
14
2. 3. 4.
15
16
FBISE
Federal Board HSSC-II Examination Computer Science Model Question Paper
Roll No: Answer Sheet No: Signature of Invigilator: ___________
____________
Note: Section-A is compulsory and comprises pages 1-4. 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. Deleting/overwriting is not allowed. Do not use lead pencil. Q.1 Insert the correct option i.e. A/B/C/D in the empty box opposite each part. Each part carries one mark. i. What types of operators are normally used to combine different conditions? A. B. C. D. ii. Conditional Logical Mathematical Relational
Which one of the following is not a valid white space in C compiler? A. B. C. D. Carriage return Line feed Tab Shift
17
Page 1 of 4
Turn Over
iii.
Which part of C will signal an error message if there is no main () function in a program? A. B. C. D. Editor Compiler Linker Preprocessor
iv.
Where is a global variable accessed? A. B. C. D. Only inside main function Anywhere in a program Inside a function other than main() only Before main function only
v.
What information does a function declaration tell a compiler? A. B. C. D. Name of the function Name of the function and types of the arguments Signature of the function Definition of the function -1 0 2
vi.
18
D. vii.
A. B.
4
Page 2 of 4 Turn Over
Which is the format specifier that is used to represent the output value left justified in printf() function?
%i %+
C. D.
%%blank
Function definition is always outside the main() function Function definition is always an independent program Function definition consists of two parts Function definition is also called body of the function
One of the essential elements of a loop is block of statements. What is the other essential element?
Loop condition Increment
C. D. x.
A. B.
Which one of the following is NOT the valid type of array declaration?
int a[5] in a[len]={10,20,30,40}
C. D. xi.
Which of the following is the database object that gives a particular answer about more than two entities? A. B. C. D. Table Record Form Query
19
Page 3 of 4
Turn Over
xii.
xiii. What is a diagrammatic way of representing the relationship between entities in a database? A. B. C. D. xiv. ERD DBMS Flow Chart DFD
Which of the following is NOT a database management system? A. B. C. D. Ms-Access Ms-Excel MySQL Oracle
xv.
What could be the other name for the duplication of data in many different files? A. B. C. D. Data redundancy Data consistency Data atomicity Data dependency ____________________
20
Page 4 of 4
FBISE
Total Marks: 60
Note: Sections B and C comprise pages 1-6 and questions therein are to be answered on the separately provided answer book. Answer all the questions from section B and section C. Use supplementary answer sheet i.e., sheet B if required. Write your answers neatly and legibly. SECTION B (39 marks) Note: Attempt ALL the questions. The answer to each question should not exceed 5 to 6 lines. Q.2 Consider the following C-Language statements: int x = 556 float y = 5.63 a. Why is the floating type value 5.63 stored in variable y and not in variable x? (1) b. Why can the integer value 556 be stored in both variables i.e. x and y? (1) c. If x is assigned to y and y is assigned to x, what will be the values stored in each variable respectively? (1) (OR) Label the encircled tokens in the following program segment: / / Test. C program # include <stdio.h> Void main ()
21
(1)
Page 1 of 6 2 3
Turn Over
(1) (1)
What indication does a compiler get from the character % that is used in the string passed to printf( )? Why is a logical error difficult to detect as compared to a syntax error? Give an example. Use conditional operator instead of if-else statement to produce the same output of the following piece of code: int m = 10; if ( (a = = b ) (b>c) ) m = 1; else m = o; printf( %d,m); Blank spaces are not visible to the C-Language compiler; then how does a compiler come to know whether a statement is or not? (1) (OR) Initialize char string [10] by two different methods with string constant Pakistan. (2) Why gets( ) is preferred over scanf( ) while taking input into a string variable? (1)
b. ended a b.
Q.5
If there is a function named factorial of integer type and has an integer parameter n then: a. Write the prototype for this function. (1) b. What will be the header of its function definition? (1)
22
c. Q.6
(1)
What is the correct variable type in which the following information is stored? a. Your age b. The area of your lawn c. Your home address Find the value of a. ( i > 0 ) && ( j < 5 ) b. (2*x)/3*y c. b/2+b*4/bb+a/3 a. (1) ( (int) a ) + b b. c. (1) if ( mileage < 24 ) { printf(gas); }; else printf(Fuel efficient); (OR) Convert into corresponding C statement:
x= b +b2+24ac 2a
Q.7
Page 2 of 6
Turn Over
Q.8
Determine data type of the following expression where a is float type and b is of type double:
(1)
What causes the error message Unexpected else when this code fragment is compiled?
We use fopen( ) to open a file. What can happen to a file if it already exists and we use fopen( ) with parameters a, w+ and a+? (3) Q.9 Here is a simple count control loop: count = 1; while (count < 20) count + + ; a. b. Make changes in the above code so that the same loop executes 20 times. Convert the above while loop into any other type of loop. (1) (2)
23
Q.10 Complete the following table by assuming that MS-Access is used to design a database: (3) Field 1 . 2 . 3 . Phone Number Class Name Date of Birth (OR) What is the difference between primary key and candidate key? Give an example of each (3) Data Type Reason for assigning the Example value particular data type of the field
Page 3 of 6
Turn Over
Q.11 In a firm there are many employees working on three projects named design, development, and testing. Some employees are working on two projects at a time and some are working on only one project, there are eight departments and each employee belongs to one department only. Draw an ER-Diagram that satisfies the above system. (3) Q.12 a. b. Define the degree and the cardinality of a table. What is the degree in the following table? EMP_Code 001 002 003 004 Contact 2254101 4430295 4820259 4232510 (1+1+1) (2) (1)
Q.13 How are file, record and database related to one another? (OR) Define the following terms: a. DDL b. DML c. SQL Q.14 Write queries to:
24
a. b. c.
Return total number of records in a table STUDENT. Return current system time. Delete all rows from STUDENT table. SECTION C (Marks: 21)
Note: Attempt ALL the questions. Q.15 Read the following scenario to make a program for taking temperature as an input and print an appropriate activity accordingly: Temperature Greater than 60 Greater than >40 and less than or equal 60 Greater than >30 and less than or equal 40 Greater than >0 and less than or equal 30 Less than 0
Page 4 of 6
a. b. (1+2)
Write down a program using any one of selection structures. (4) Which selection structure do you think is more appropriate and state the reason?
Q.16 Complete the following table to show the values of variables used in the program during each step of execution: Program: int i, j = 3, a = 0; for (i=o;i<=5;i+=2) { while(j>0){ a++; j--; } printf(%d\n,a); j=3; } Value of i Value of j Value of a Output (7)
25
(OR) Sameer is working in a firm as a programmer and is getting a monthly salary. Write a program in C-language to take his basic salary as an input through the keyboard? He is also getting three types of allowances at the rate of 45%, 30% and 10% respectively of his basic salary. Also calculate his net salary after a deduction of 5% of his gross salary if the gross salary exceeds Rs.30,000.00. (1+3+1+1+1) Q.17 A car showroom uses a database to keep details of the cars in stock. Here is a part of this database. REF F210 R312 F212 M412 Z517 C615 MAKE TOYOTA MAZDA MERCEDES HONDA SUZUKI FORD SEATING CAPACITY 4 5 5 4 4 3
Page 5 of 6
Name the field that contains: (1) i. Numeric data ii. Alphabetic data Suggest two additional fields with data types that could be added to this database. Write down the output using only the REF field if the following search condition is input (REF contains F) OR (YEAR > 2001) The records need to be sorted into the key field order. State which field would be used as key field and why? If the database is sorted in descending order on the YEARS field then write down the output using only the REF field. (OR)
Write a note on any seven data types available in MS Access stating the purpose of each type with example values that can be stored in each type. (7) ____________________
26
Page 6 of 6
27
FBISE
Federal Board HSSC-II Examination Computer Science Practical Model Question Paper
Time allowed: 2 hours SECTION I Viva Voce (C language) Note Book Q.1
Marks: 25
(3) (2)
Evaluation of database in MS Access developed during the academic year: a. Software demonstration (6) b. Project report (4) SECTION II
Write a program that reads 10 integers from the keyboard and sorts them in ascending order (5) Write a function that generates the factorial of a number and calls it in the main program. (5) Write a program for writing string to a field. ____________________ (5)
Note: For the database practical students have to develop a mini project during the year which will be evaluated in the practical exam. Students can make any project of their choice. Mini database project should comprise: 1. not more than three tables 2. not more than three forms 3. not more than three reports 4. their related documentation 5. Database project must may be hand written or typed 15 to 20 pages.
Page 1 of 1
28
29
FBISE
Federal Board HSSC II Examination Computer Science Mark Scheme
SECTION A Q.1 i. iv. vii. x. xiii. 1=15) SECTION B Q.2 a. Because variable y is of type float which is used to store decimal values whereas variable x is of integer type used to store integer values and decimal part will only be stored in float type variable. (1 mark) As the integer value does not have the decimal part so it can be stored in book x & y variables. (1 mark) If y = x then y = 556.00 and x = y x=5 (1 mark) (OR) Declaring var 1 as integer i.e. int is a keyword and var 1 is a variable. (1 10 is a constant. (1 mark) are punctuation mark and % is percent sign used as format specifier. (1 (3) (3) A B C D A ii. v. viii. xi. xiv. D C B D B iii. vi. ix. xii. xv. C D A D A
(15
30
a. mark) b.
The character % indicates to the compiler where to put the value in a string and what format is used for printing the value. (1
Logical error is difficult to detect because it is the error in the programming logic of the program which cannot be detected by the compiler as the compiler can only detect the errors in the system of the program. For e.g. if a C instruction a=b*c has been written as a=b+c, the error of * being replaced by + cant be detected by compiler. (1 mark) Q.4 a. (3) Use of conditional operator int m = 10; m = ( ( a== b) (b>c) )? 1 : 0 printf (%d,m); (2 marks) When the compiler sees a ; semicolon, it comes to know that a statement has ended. (1
b. mark)
(OR) a. i. Char string [10] = {P, A, K, I, S, T, A, N}; (1 mark) ii. Char string [10] = Pakistan; (1 mark) b. gets( ) is preferred than scanf( ) because scanf( ) has some limitations. It is not possible to inter a multiword string into a single array using scanf( ). (1 mark) Q.5 a. b. c. Q.6 Correct variable type to store following information: a. Your age integer type variable b. Area of your lawn float type variable c. Home address string variable Q.7 (1 mark) (1 mark) (1 mark) (3) The prototype for this function is: int factorial (int n); The header of its function definition will be: int factorial (int n) The return type of this function will be integer. (1 mark) (1 mark) (1 mark) (3) (3)
31
a. b. c.
(8>0) && (5<5) = 0 1 && 0 = 0 answer (2*8.8) / 3*3.5 17.6 / 10.5 = 1.7 answer 3/2+3*4 / 33+1.5/3 1.5+12 / 33+.5 1.5+43+.5 = 3 answer
Q.8 a. b. c. mark) a w+ a+ mark) Q.9 a. b. marks) Q.10 Students have to fill the table by putting data in it. (OR) Write any three differences between primary key and candidate key with one example of each. marks) Q.11 ERD Employees work on Projects count = 1 while (count < 21) count++; (1 mark) Rewrite the above program using any other loop than white loop (2 (OR) if file already exists data will be added at its end. (1 mark) if file already exists its contents are overwritten (1 mark) if file already exists it is opened for both input/output for appending data. (1 The data type of the expression will be integer. (1 mark) x = (-b+(b*b)+2-(4*a*c)) / (2*a); (1 mark) Error message is caused due to misplaced semicolon (;) after the closing brace before else. (1
(3)
belong to Department
32
Q.12 a. mark) b. Q.13 a. be The number of tuples or rows is called cardinality. Degree is 2 (1 mark) (1 mark) The number of attributes in a relation is called degree of that relation. (1
(3)
(3) A record contains all the information about one person or item. A file is a collection of records and a database consists of many different files linked in such a way that information can retrieved from several files simultaneously. (3 marks) (OR) a. DDL: Stands for data definition language. It is used for defining and maintaining the structure of table. (1 b. DML:Stands for data manipulation language. It is used for inserting, deleting and updating data in the table. (1 SQL: Stands for structured query language. It is used to manipulate databases. (1 (3) a. b. c. Select * from students; Use date( ) i.e. date function for current date. Delete from students; SECTION C (1 mark) (1 mark) (1 mark)
(7) Student has to write down a program for taking temperature as input by using any one selection structures from If-else, Else-If, statements or If statements, etc. (4 Student has to write which selection structure he thinks is more appropriate and why? (3
33
Q.16
(7) Student has to write down the value of i, j, a and the output after doing the dry-run of the program. (7 marks) (OR) Student has to write a C-program to get salary as input by keyboard. Then he has to calculate three types of allowances i.e. 45%, 30% and 10% of basic salary. Then, he has to calculate net salary by deducting 5% of the gross salary only if the gross salary increased from Rs.30,000.00. (7 marks)
Q.17 a. b. c. mark) d. marks) e. REF: M412 F212 Z517 F210 R312 C615 (1 mark) REF field should be used as primary key field as it contains unique values. (2
(7) Write down the names of fields containing i. Numeric data ii. Alphabetic data (1 mark) Write 2 field names with data types to be added to database. (2 marks) Write the output of those fields which contain F or where year is greater than 2001. (1
(OR) Using any seven data types in MS Access, write a note stating purpose of each type with example values. (7 marks)
34