0% found this document useful (0 votes)
44 views

Computer Science S5 Marking Scheme

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Computer Science S5 Marking Scheme

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Computer Science

Date: 22/06/2022
Period: 8H30'-11H30'

END OF TERM III EXAMINATIONS

GRADE / LEVEL: Advanced Level, S5

COMBINATIONS MATHS-COMPUTER SCIENCE-ECONOMICS: MCE


MATHS-PHYSICS-COMPUTER SCIENCE: MPC

DURATION: 3 hours
Marks

MARKS: …... /100

INSTRUCTIONS

This paper consists of three sections: A, B and C.

Section A: Attempt all questions. (55 marks)


Section B: Attempt three questions. (30 marks)
Section C: Attempt any one question. (15 marks)

Page 1 of 5
SECTION A: ATTEMPT ALL QUESTIONS. (55 marks)

1) List any five examples of portable devices. (5 Marks)

2) List and define three standards stream in java. (6 Marks)


3) Define this() and super() in java. (5 Marks)

4) Prove the exact output produced by the following main() routine:


(5 Marks)
public static void main(String[] args)
{ int x,y;
x = 5; y = 1;
while (x > 0)
{ x = x - 1;
y = y * x;
System.out.println(y); } }

5) Determine the order in which the elements would be accessed during


Pre-Order, In Order and Post-Order traversals. (6 Marks)

6) Transmission media are broadly classified into two groups: Guided and
Unguided media. Explain each group. (5 Marks)

7) A database contains a table with eight fields. The table currently has 100
records and each has data in each field. Answer the following question:
(3 Marks)
a. How many entities are contained in the database?
b. How many attributes are contained in database?
c. How many individual pieces of data are in the database?

Page 2 of 5
8) Suggest an output of the following program (2 Marks)

#include<iostream>
using namespace std;
int main (){
int num, *ptr1, *ptr2;
ptr1=&num;
ptr2=ptr1+8;
cout<<”the difference is:”<<ptr2-ptr1<<endl;
return 0;
}
9) List any three advantages of inheritance (3 Marks)

10) Answer TRUE or FALSE, the following sentences related to vb: (2 Marks)
a) A project is an anything that is found on the computer specifically on
the desktop.
b) A class is collection of object with similar type

11) Write a class definition that creates a class called leverage with one
private data member,crowbar, of type int and one public function whose
declaration is void pry(). (4 Marks)

12) Write a Java program to print 'Hello' on screen and then print your
name on a separate line. Using input from the user (6 Marks)

13) You are browsing a website on the internet while the speed is okay and
suddenly you find that the page is loading slowly. Investigate the reason
behind slowness? (3 Marks)

Page 3 of 5
SECTION B: ATTEMPT THREE QUESTIONS. (30 Marks)

14) write a Java program to sort a numeric array and a string array.(10 Marks)
15) Compare computerized vs non-computerized database with at least 5 for
each. (10 Marks)
16) Using a pointer write a C++ program which will ask the user to enter data
and compute the area of a rectangle. Area = width*length. (10 Marks)

17) Build an application by using vb6.0 or vb.net to calculate the volume of


the cylinder(V = πr2h) (10 Marks)
18) a) Represent the employee relation in the conceptual model (4 Marks)

b) The following table describes information about employees, study it and


answer the following questions. (6 Marks)

a. What is the possible domain for field EmpId?


b. How many records are shown?
c. How many attributes are shown?

Page 4 of 5
SECTION C: ATTEMPT ANY ONE QUESTION. (15 marks)

19) Explain Elements of the Integrated Development Environment (IDE) in


Visual basic (15 Marks)

20) Create a class student with the following specification (15 Marks)
Private members of class student:
admno integer
sname 20 character
eng. math, science float
total
float total() a function to calculate eng + math + science with float return type.
Public member function of class student
Takedata() Function to accept values for admno, sname, eng, science and
invoke ctotal() to calculate total.
Showdata() Function to display all the data members on the screen.

End !!!!

Page 5 of 5
Computer Science

MARKING GUIDE

END OF TERM III EXAMINATIONS


GRADE / LEVEL: Advanced Level S5

COMBINATIONS MATHS-COMPUTER SCIENCE-ECONOMICS: MCE


MATHS-PHYSICS-COMPUTER SCIENCE: MPC

DURATION: 3 Marks

MARKS: …... /100

INSTRUCTIONS

This paper consists of three sections: A, B and C.

Section A: Attempt all questions. (55 marks)


Section B: Attempt three questions. (30 marks)
Section C: Attempt any one question. (15 marks)

Page 1 of 12
SECTION A: ATTEMPT ALL QUESTIONS. (55 marks)

1) List any five examples of portable devices. (5 Marks)


Answer
Portable devices:
a) Laptops
b) Smartphones
c) cell phones
d) Personal Digital Assistants
e) Tablets

2) List and define three standards stream in java. (6 Marks)


Answer
Java provides the following three standard streams:

i. Standard Input: This is used to feed the data to user’s program and
usually a keyboard is used as standard input stream and represented
as System.in.
ii. Standard Output: This is used to output the data produced by the
user's program and usually a computer screen is used to standard
output stream and represented as System.out.
iii. Standard Error: This is used to output the error data produced by
the user's program and usually a computer screen is used to standard
error stream and represented as System.err.

3) Define this() and super() in java. (5 Marks)


Answer

Page 2 of 12
this() is used to access one constructor from another with in the same
class while super() is used to access superclass constructor. Either this()
or super() exists it must be the first statement in the constructor.

4) Prove the exact output produced by the following main() routine:


(5 Marks)
public static void main(String[] args)
{ int x,y;
x = 5; y = 1;
while (x > 0)
{ x = x - 1;
y = y * x;
System.out.println(y); } }
Answer

Output:

4
12
24
24
0
5) Determine the order in which the elements would be accessed during
Pre-Order, In Order and Post-Order traversals. (6 Marks)
Answer

Answer
Pre-order: A B D F C E H
In-order: D B F E C H A
Post-order: D F B E H C A
6) Transmission media are broadly classified into two groups: Guided and
Unguided media. Explain each group. (5 Marks)

Page 3 of 12
Answer
Wired or Guided Media: are the cables that are tangible or have physical
existence and are
limited by the physical geography. Example guided media are: Twisted
pair cable, co-axial
cable and fiber optical cable.
• Wireless or Unguided Media are the ways of transmitting data without
using any cables.
These media are not bounded by physical geography. Example of
unguided media are:
Radio wave, Infrared, Bluetooth.
7) A database contains a table with eight fields. The table currently has 100
records and each has data in each field. Answer the following question:
(3 Marks)
a. How many entities are contained in the database?
b. How many attributes are contained in database?
c. How many individual pieces of data are in the database?
Answer
a) one entity
b) 8 attributes
c) 800 piece of data Order, and make a relationship between those
tables.
8) Suggest an output of the following program (2 Marks)

#include<iostream>
using namespace std;
int main (){
int num, *ptr1, *ptr2;
ptr1=&num;
ptr2=ptr1+8;
cout<<”the difference is:”<<ptr2-ptr1<<endl;
return 0;
}
Answer
The difference is 8
9) List any three advantages of inheritance (3 Marks)
Answer
1. Inheritance helps the code to be reused in many situations.(reusability)
2. It increases program structure which result in greater reliability.

Page 4 of 12
3. Saves Time and Effort

10) Answer TRUE or FALSE, the following sentences related to vb: (2 Marks)
a) A project is an anything that is found on the computer specifically on
the desktop.
b) A class is collection of object with similar type
Answer
a) False
b) True
11) Write a class definition that creates a class called leverage with one
private data member,crowbar, of type int and one public function whose
declaration is void pry(). (4 Marks)
Answer
class leverage
{
private:
int crowbar;
public:
void pry();
};
12) Write a Java program to print 'Hello' on screen and then print your
name on a separate line. Using input from the user (6 Marks)
Answer
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner input = new Scanner (System.in);

System.out.print("Input your first name: ");


String fname = input.next();
System.out.print("Input your last name: ");
String lname = input.next();
System.out.println();
System.out.println("Hello \n"+fname+" "+lname);}}

13) You are browsing a website on the internet while the speed is okay and
suddenly you find that the page is loading slowly. Investigate the reason
behind slowness? (3 Marks)
Answer

Page 5 of 12
Causes: bad made cables, malfunctioning of network devices, wireless
interference and weather.

SECTION B: ATTEMPT THREE QUESTIONS. (30 Marks)

14) write a Java program to sort a numeric array and a string array.(10 Marks)
Answer
package arrayexercice;

import java.util.Arrays;
public class Exercise1 {
public static void main(String[] args){
int[] my_array1 = { 17, 20, 18, 14, 13,14, 24, 54, 72, 23, 56, 21, 57, 56};
String[] my_array2 = { "Java", "Python", "PHP", "C#", "C Programming", "C++" };
System.out.println("Original numeric array : "+Arrays.toString(my_array1));
Arrays.sort(my_array1);

Page 6 of 12
System.out.println("Sorted numeric array : "+Arrays.toString(my_array1));
System.out.println("Original string array : "+Arrays.toString(my_array2));
Arrays.sort(my_array2);
System.out.println("Sorted string array : "+Arrays.toString(my_array2)); }}

14) Compare computerized vs non-computerized database with at least 5 for


each. (10 Marks)
Answer
Computerized:
➢ Can hold a vast amount of data
➢ Very fast to find a specific record
➢ Can be used to analyze data
➢ Data can be sorted into ascending or descending order on
multiple criteria
➢ Can easily update
➢ Records are stored safely; they are available when needed
➢ The database can be kept secure by use of passwords

Non computerized (paper based):


➢ Limited by physical storage space
➢ Difficult to search for a specific criteria
➢ Very difficult to analyze data
➢ Difficult to sort data on more than one criteria
➢ Records can be lost
➢ Difficult to make backup
16) Using a pointer write a C++ program which will ask the user to enter data
and compute the area of a rectangle. Area = width*length. (10 Marks)
Answer

#include <iostream>
using namespace std;
int main()
{
int width,length,area,*p;
cout <<"\nenter the width";

Page 7 of 12
cin>>width;
cout <<"\nenter the length";
cin>>length;
p = &width;
area = (*p) * length;
cout<<"The area of Rectangle is "<<area;

return 0;
}
17) Build an application by using vb6.0 or vb.net to calculate the volume of
the cylinder(V = πr2h) (10 Marks)
Answer

Vb6.0 Vb14
Private Sub Command1_Click() Public Class Form1
Label1.Caption = 3.14 *
Val(Text1.Text ^ 2) * Private Sub
Val(Text2.Text) Button1_Click(sender As
End Sub Object, e As EventArgs)
Handles Button1.Click
Private Sub Form_Load() Label3.Text = 3.14 *
Text1.Text = "" Val(TextBox1.Text ^ 2) *
Text2.Text = "" Val(TextBox2.Text)
Label1.Caption = "" End Sub
End Sub
Private Sub
Form1_Load(sender As Object,
e As EventArgs) Handles
MyBase.Load
TextBox1.Clear()
TextBox2.Clear()
Label3.Text = ""
End Sub
End Class

18) a) Represent the employee relation in the conceptual model (4 Marks)

Page 8 of 12
Answer

b) The following table describes information about employees, study it and


answer the following questions. (6 Marks)

a. What is the possible domain for field EmpId?


b. How many records are shown?
c. How many attributes are shown?
Answer
a) Domain of EmpId ={1011,1013,1014,1021}
b) They are records 4 records
c) They are 5 attributes

Page 9 of 12
SECTION C: ATTEMPT ANY ONE QUESTION. (15 marks)

19) Explain Elements of the Integrated Development Environment (IDE) in


Visual basic (15 Marks)
Answer
a. Menu Bar: It contains a standard command like: File, Edit, View,
Window, Help menus, and specific command such as: Project,
Format, or Debug menus.

b- Toolbar: it contains the most commonly used commands


(button), if clicked an action represented by that button is
carried out.
c- ToolBox: it contains a collection of tools that are needed for project
design

d- Form Designer: it is a window for each form to customize the


designed interface of the application. Using the form designer, the user can
add controls, graphics, and text to create the desired form appearance.

e- Properties Window: it is a List of properties settings for a selected form or


a control. These properties are characteristics (such as size, visible, or
color) of the selected object it provides an easy way to set properties.

f- Project Explorer Window: it is a list of the forms and modules for the
current projects. lt is a hierarchical tree- branch structure, where the
project at top of tree and other parts like forms ,modules) descend from
this tree.

g- Form Layout Window: The Form Layout window is a small screen.


Which is used to reposition the form of the application so that it
appears in proper place when project is run.

Page 10 of 12
h- Code Editor Window: Code Editor Window is used to write a VB code for
an application. For each form there is a separate code editor window. It is
displayed when user clicks on form or object in form.
20) Create a class student with the following specification (15 Marks)
Private members of class student:
admno integer
sname 20 character
eng. math, science float
total
float total() a function to calculate eng + math + science with float return type.
Public member function of class student
Takedata() Function to accept values for admno, sname, eng, science and
invoke ctotal() to calculate total.
Showdata() Function to display all the data members on the screen.
Answer
#include<iostream>
using namespace std;
class student
{
private:
int admno;
char sname[20];
float eng,math,science;
float total;
float ctotal()
{
return eng+math+science;
}
public:
void Takedata()
{
cout<<"Enter admission number ";
cin>>admno;
cout<<"Enter student name " ;
cin>>sname;
cout<< "Enter marks in english, math, science ";
cin>>eng>>math>>science;
total=ctotal();
Page 11 of 12
}
void Showdata()
{
cout<<"Admission number "<<admno<<"\nStudent name
"<<sname<<"\nEnglish " <<eng<<"\nMath "<<math<<"\nScience
"<<science<<"\nTotal "<<total;
} };
int main ()
{
student obj ;
obj.Takedata();
obj.Showdata();
return 0;
}

End !!!!

Page 12 of 12

You might also like