Questions and Answers of Computer Science
Questions and Answers of Computer Science
MINISTRY OF EDUCATION
ANSWER:
Compiler is a program that converts instructions into a machine-code or lower-level form so that
they can be read and executed by a computer.
(b) Debugger
ANSWER:
a computer program that assists in the detection and correction of errors in other computer
programs.
(c)Computer
ANSWER:
A computer is an electronic device capable of receiving raw facts (data) and performing a
sequence of operations on the data based on special computer instructions (processing) to
produce desired output (information).
(d)Computer Science
ANSWER:
Computer science-The study of the principles and use of computers.
Computer science is a branch of science that deals with theory of computation, or design and
operation of computer hardware and software, and of the application of computers in all sectors.
ANSWER:
Yes, Laptop hardware maintenance is difficult comparing to a desktop computer maintenance
because Laptop components are proprietary, so you may not be able to use components made by
one laptop manufacturer to repair a laptop made by another manufacturer which makes that
technicians may have to obtain certification for each laptop manufacturer they support. Desktop
components are standardized.
ANSWER:
Yes, C++ is case sensitive
✓ C++ is case sensitive it means uppercase and lowercase letters are considered to be different.
✓ A variable named age is different from Age, which is different from AGE.
✓ int age, Age, AGE; // those 3 variables are different.
ANSWER:
Bandwidth is the amount of data that can be transmitted in a fixed amount of time. OR
Bandwidth is measured in the number of bits that can be sent every second.
Latency is the time between requesting data and receiving data.
ANSWER:
VGA Port
USB Port
RJ-45 Port (Ethernet)
HDMI Port
Line-In port
Line-Out port
ANSWER:
a) ESD - Electro Static Discharge
b) CMOS - Complementary Metal-Oxide Semi-conductor
c) OS - Operating System
d) MSB - Most Significant Bit
ANSWER:
e. Both a and c
b) Computer hardware is any part of the computer which you can physically touch while
computer software is a set of instructions called computer programs that make the different parts
of a computer work.
11) One the component of computer is its CPU. What is CPU and what is role does it play in a
computer.
ANSWER:
ANSWER:
The importance of primary key of relation is to identify uniquely each record of relation (table).
13) Based on cardinality explain the different types of relationship between entities and give an
example for each.
ANSWER:
a)Procedure
b)Event procedures
ANSWER:
a)Procedure: a procedure is the block of visual basic statement enclosed by declaration statement
(sub, function, operator, get, and set) and a matching end declaration.
b)Event procedures: are the code related to some object, this is code that is executed when a
certain event occurs.
15) a)What are three primary steps involved in building a Visual Basic application?
ANSWER:
(b)Smartphone
(c)Data structure
c) Data structure: is a way of collecting and organizing data in such a way that we
can perform operations on these data in an effective way.
d) A logic gate is an electronic circuit that has some idealized or physical device implementing a
Boolean function; that is, it performs a logical operation on one or more logical inputs, and
produces a single logical output.
Viruses.
Worms.
Trojans.
Spyware.
adware,
SQL injection etc.
19) a) Determine the order in which the elements would be accessed during an in-order, pre-
order and post-order traversal.
ANSWER:
UNION and UNION ALL are SQL operators used to concatenate 2 or more result sets. This
allows us to write multiple SELECT statements, retrieve the desired results, then combine them
together into a final, unified set.
The main difference between UNION and UNION ALL is that:
UNION: only keeps unique records
UNION ALL: keeps all records, including duplicates
ANSWER:
a)It is the unique number which identifies any electronic device on a network.
An IP address is the numeric identity of a node in the network.
b) A Static IP address is assigned manually. Once assigned it does not change unless it is
changed manually again.
While
A Dynamic IP address is assigned by a service usually DHCP. It can change at any time.
They are expensive than dynamic IP They are Cheaper than static IP addresses
addresses
22) Explain the importance of reading the user manual before installing new software.
The help manual is important in identifying the hardware specifications required in order
to install the new software.
It helps you to know the procedures to follow in order to install the new software.
23) Outline the procedure you would follow to put out fire in computer lab that may have been
caused by electrical fault.
ANSWER:
ANSWER:
A pointer is a variable which contains the address in memory of another variable. While
Array is a collection of data elements having the same name and same data type.
25) What is the difference between database Administrator and Database End users?
ANSWER
ANSWER:
27) Explain the importance of reading the user manual before installing new software.
ANSWER:
i. The help manual is important in identifying the hardware specifications required in order to
install the new software.
28) Define:
a) Algorithm
b) Variable
c) Expression
d) Data type
e) Pseudocode
ANSWER:
Artificial intelligence
Graphical user interface
Small physical size but large processing power
Easy programming
ANSWER:
Charles Babbage
32) State three factors you would consider before purchasing application software.
ANSWER:
34) Why using an infrared TV remote control in our home will not interfere with the use of our
neighbor’s infrared TV remote control.
ANSWER:
The infrared TV remote control in our home will not interfere with the use of our neighbor’s
infrared TV remote control because of its frequencies (between 300 GHZ to 400 THZ) which
cannot penetrate walls.
35) Explain some of the characteristics that make a computer suitable for processing repetitive
tasks.
ANSWER:
It does not get tired - It can be programmed to perform a task repetitively - It does not have the
human body weaknesses - Once programmed it follows instructions exactly without fail.
ANSWER:
Mainframe: is smaller than supercomputer with slightly less processing power. Used as central
computer or server on large networks that require centralized data processing. Minicomputer is
smaller than mainframe. Used by smaller organizations as central server/ also used for
specialized applications e.g. the autopilot on airplanes.
ANSWER:
ANSWER:
Server provides services to other computers on the network; Workstation used by the user, has
limited processing power and requests services from the server.
Selection branches to an alternative action if while iteration repeats existing statement for a finite
number of times
ANSWER:
First generation computers were large in size, consumed a lot of power, and produced a lot of
heat.
ANSWER:
Artificial intelligence
Graphical User Interfaces
Small physical size but large processing power
Easy programming.
38) a) State two advantages of USB port over the parallel port.
ANSWER:
Smaller size, longer distance connectivity; less cumbersome; cheaper.
b) State four factors you would consider before installing computer software whether an
operating system or application software.
ANSWER:
ANSWER:
It is because it has two entries making 22 = 4 possible combinations
39) a) Explain why it is important to use the right tool for the right purpose when repairing,
upgrading or assembling a desktop PC.
ANSWER:
For quick working with minimum effort; to avoid spoiling the place or component you are trying
to repair.
b) You have just installed a new power supply, but the computer doesn’t seem to be getting any
power. What might be the problem?
ANSWER:
Check the fuse. Also check whether the power cable running from the power supply is plugged
onto the motherboard port or slot.
40) A customer is complaining that the power in the office sometimes surges, sometimes causes
blackouts and has EMI. What single device should you recommend to help the most in this
situation?
ANSWER:
A UPS to protect his/ her electronics.
41) a) Explain why it is important to regularly blow out dust from a computer.
ANSWER:
To reduce wear and tear due to friction; to reduce crashing of sensitive devices like the hard disk.
ANSWER:
Keyboard: use blower, special brushes and vacuum cleaner; Monitor: use blower, smooth
absorbent cloth.
ANSWER:
Computers, Scanners, Printers, Cameras, Storage devices, Hub, Phones.
ANSWER:
A truth table is a mathematical table used in Boolean algebra or propositional logic to compute
the outcome of all possible combinations of input values i.e. it can be used to tell whether an
expression is valid for all legitimate input values.
iv) Binary number system is fundamental to understanding how a computer works. Explain why
it is important to understand the concept of number systems.
ANSWER:
Digital electronic devices that utilize binary system such as digital cameras, TVs and media
players are dominating the electronic market.
(a) IF..THEN
(b) Nested IF
(c) SWITCH
ANSWER:
If.. is used to execute statements under true block if the Boolean return true
Nested if - used to test multiple options e.g. in assigning grades
Switch case - used when this an alternative to nested if used to test multiple conditions
under case.
43) a) Explain the importance of preventive maintenance, highlighting some routine maintenance
practices that need to be carried out in a computer laboratory.
ANSWER:
It keeps the computer working at optimum level and prevents unnecessary breakdowns caused
by dirt and water. You can do the following preventive maintenance:
(i) Use blower to blow out dust
(ii) Wipe the computer clean with a soft absorbent piece of cloth and non-water based cleaner
liquid.
b) Identify two alternative sources of backup power in case of blackout or brownout of main
electricity.
ANSWER:
UPS, Backup generator
ANSWER:
Switch off power from main switch or circuit breaker; Use non-water non-powder based
extinguisher to put out the fire.
d) Assuming that a NOT gate has an input 0, what will be its output?
ANSWER:
1
e) Assuming that an OR gate has one input at 1 and the other one at 0. What will be its output?
ANSWER:
1
f) Draw the truth table of AND Gates
ANSWER:
ANSWER:
(a) 10011 – 1100 =111
(b) 10110 – 1011 = 1011
(c) 101 – 100 = 1
(d) 10111 – 1111 = 1000
ANSWER:
(a) 101101 x 110 = 100001110
(b) 101101 x 111 = 100111011
(a) 0.10101
(b) 11.0110
(c) 101.11110
(d) 100.110
ANSWER:
(a) 0.6562510 (b) 3.37510 (c) 5.937510 (d) 4.7510
(a) 3216 (b) CCD16 (c) EFE16 (d) 119 16 (e) 32816
ANSWER:
(a) 6310 (b) 5210 (c) 6610
(d) 64010 (e) 51210
v) Convert the following binary numbers to decimal form:
ANSWER:
(a) 510 (b) 1510 (c) 139010 (d) 19110 (e) 8910
45) What is an event in Visual basics? Give two examples.
ANSWER:
An event is something that happens, usually but not always due to the user at the keyboard,
during a program’s operation.
ANSWER:
A variable address helps to locate it in the memory (It is the address that helps to locate the
variable in the memory).
while
ANSWER:
Var a(4) as array
Start
For (i=0 to 5)
Do
Write(“ enter a number:”)
Read (a(i))
End
For (i=0 to 5) do
Write(a(i))
End for
ANSWER:
Adodc1.recordset.movenext
End sub
Adodc1.recordset.moveprevious
End sub
a) Date:
b) Ls
c) MD or mkdir
ANSWER:
ANSWER:
Previous=99, Next=101
ANSWER:
A role of DBMS is to manage access and ensure that all users have access and are used in
accordance with permissions and restrictions.
ANSWER:
The intersection operator INTERSECT returns a result set common to both data sets .
ANSWER:
SELECT * FROM Table_a
INTERSECT
ANSWER:
54) Write a program in C++ language to find a greater number of five numbers stored in array.
ANSWER:
#include<iostream>
using namespace std;
int main (){
int a[5], largest;
cout<<"Enter any numbers :"<<endl;
//Read n elements in an array
for(int i=0; i<5; i++){
cin>>a[i];
//consider first element as largest
largest =a[0];
for(int i=0; i<5; i++)
if(a[i]>largest){
largest=a[i];
}}
//print out the result
cout<<"Largest numbers is :"<<largest<<endl;
return 0;}
ANSWER:
A computer is an electronic device capable of receiving raw facts (data) and performing a
sequence of operations on the data based on special computer instructions (processing) to
produce desired output (information).
ANSWER:
1. One can only read its content but you cannot write on it unless it is a special type of ROM.
2. It is non-volatile i.e. its content is not lost when the computer is switched off.
3. Stores permanent or semi-permanent instructions from the manufacturer called firmware. It
can store semi-permanent instructions because some variations of ROM chips can be
programmed according to the user’s specification.
57) Outline the procedure you would follow to put out fire in a computer lab that may have been
caused by electrical fault.
ANSWER:
Switch off power from main switch or circuit breaker; Use non-water non-powder based
extinguisher to put out the fire.
ANSWER:
Computer security refers to techniques developed to safeguard information and systems stored
on computers.
b) Explain how a computer user can cause the errors to information system.
ANSWER:
A computer user can cause the errors to information system by using the wrong information.
ANSWER:
A computer attack is any attempt to expose, alter, disable, destroy, steal or gain unauthorized
access to or make unauthorized use of an asset.
An active attack attempts to alter system resources or affect their operation while a passive attack
attempts to learn or make use of information from the system but does not affect system
resources
ANSWER:
You can know that a new document is virus infected by its extension .exe or .com
ANSWER:
In computer security, a social engineer is a person who is able to gain access to equipment or a
network by tricking people into providing the necessary access information.
62) Discuss the difference between logical and physical threats and give examples for each?
ANSWER:
Physical threats are digital storage media and hardware that can damage or destroy the
computer system. Example: Humidity, water
While logical threats are events or attacks that remove, corrupt, deny access, or steal
information. Example: viruses and spyware
ANSWER:
The OSI model was created to help vendors create interoperable network devices and software in
the form of protocols so that different vendor networks could work with each other. It divides the
network communication process into smaller and simpler components, thus aiding component
development, design, and troubleshooting; it allows various types of network hardware and
software to communicate; and it prevents changes in one layer from affecting other layers.
65) By using clear example, compare access control and parental control.
ANSWER:
66) Why routers and switches do not operate at the same OSI reference model layer?
ANSWER:
Routers (layer 3 devices) use logical addressing and provide what is called packet switching.
Routers use a routing table (map of the internetwork) to make path selections and to forward
packets to remote networks. On the other side, switches (layer 2 devices) are not used to create
internetworks because they do not break up broadcast domains by default; they are employed to
add functionality to a network LAN. The main purpose of switches is to make a LAN work well
and do not forward packets to other networks as routers do.
ANSWER:
Cybercrime types
Cyberbullying is bullying that takes place using electronic technology
Sexting is the sending and receiving of text, photo or video messages of children and
young people that are inappropriate and sexually explicit.
Grooming is the way sexual predators get from bad intentions to sexual exploitation.
Basically, grooming is manipulation. It’s the process pedophiles use to get children they
target online to meet with them offline, the simple goal being sex.
68) Describe each one of the major components of a Local Area Network?
ANSWER:
Hardware (Computers, Network Interface Card (NIC), Media or Cables, Hub, Switches,
repeaters)
Access Methods: Rules that define how a computer puts data on and takes it from the
network cable.
Network Topology: the logical or physical arrangement of network devices (nodes).
Software: Programs to access and / or to manage the network.
ANSWER:
A data collision occurs when two or more computers send data at the same time. When this
happens, each computer stops data transmission and waits to resend it when the cable is free.
ANSWER:
Advantages of switches are:
ANSWER:
ANSWER:
Advantages of FDDI
FDDI supports transmission rates of 100 megabits per second on token-passing networks.
FDDI provides high-speed network backbones that can be used to connect and extend
LANs.
Fiber-optic cable such as the cable used with Fiber Distributed Data Interface (FDDI) can
support very large volumes of data over large distances.
Disadvantages
Fiber Distributed Data Interface (FDDI) is an expensive technology to set up than
twisted-pair cable.
Because most Fiber Distributed Data Interface (FDDI) installations use a redundant
second ring, more cabling is required.
73) Terambera Company Ltd is running a business and wishes to manage the information of all
employees in computerized way. The database of business contains one of the following entity
named “Employees” (id, name, age, address, salary).
b) Flowchart
ANSWER:
ANSWER:
b) XNOR Gate
ANSWER:
NOT
AND
ANSWER:
79) Convert the following code segment into switch case construct.
ANSWER:
int ch;
cin>>ch;
switch(ch)
{
Case 1 : cout<<“ Laptop”; break;
Case 2: cout<<“Desktop ”; break;
Case 3: cout<<“Notebook”;break;
Default : cout<<“Invalid Choice”;
}
ANSWER:
1*27 + 0*26 + 0*25 + 1*24 + 1*23 + 1*22 + 0*21 + 1*20 = 157.
(10011101)2 = (157)10
81) To reference storage of a variable in main memory, two operators, namely size of and
address of (&) may be used, differentiate between the two operators.
ANSWER:
The sizeof() returns memory size allocated to a variable in bytes, while & returns actual address.
ANSWER:
NTFS: New Technology File System
ANSWER:
The CPU is made up of three distinct components within it:
1. The Arithmetic Logic Unit (ALU): performs all arithmetic and logical operations.
2. Control Unit: interprets instructions and controls speed of execution using a clock.
3. Registers: special memories within the CPU for holding instructions and data.
ANSWER:
Smartphones are special purpose computers. They have similar resources and are used to
perform complex tasks similar computers hence the need for an operating system. They have a
fast processor, large memory, many user applications, fast access to the internet etc.
ANSWER:
Input instructions
Output instructions
Processing instructions
Declaration instructions
Assignment instructions
ANSWER:
a)RJ45: Registered Jack b) VPN: Virtual Private Network c) ISP: Internet Service Provider
88) a)What is the difference between Traditional File Processing Systems (TFPS) and Database
Management System (DBMS)?
ANSWER:
The main difference between file system and DBMS is that the file system helps to store a
collection of raw data files into the hard disk while the DBMS helps to easily store, retrieve and
manipulate data in a database.
b) What is the difference between Logical data independence and Physical data independence .
ANSWER:
Physical Data Independence modifies the physical schema without causing the application
program to be rewritten. While
Logical data independence is the ability to modify the logical schema without causing
application programs to be rewritten.
IMPORTANCE:
Data independence plays crucial role in database environment.
Improve performance.
Change in data structure does not require change in application program.
Hide implementation details from the users.
Allow users to concentrate on the general structure, rather than on low-level
implementation details.
Standards can be enforced.
Security can be improved.
Integrity can be improved.
Better service to the users.
Cost of developing and maintaining systems is lower.
Flexibility in system improvement.
Inconsistencies can be reduced.
In essence, Integrity, consistency, security and availability can be ensured.
a. Bit refers to the smallest unit of computer memory that has ability to store a maximum of two
different values while byte composed of 8bits can hold 256 different values.
b. A pseudocode is standard method of describing an algorithm without use any specific
programming language while a flowchart is symbolic representation of step by- step solution to a
given problem.
c. A variable can be defined as a name also known as identifier that represents data values which
can change while a constant is a fixed value which cannot be changed.
ANSWER:
Components of the operating system: Kernel, Shell, file system and System resources
a)Kernel
The kernel is the central component of most computer operating system. Its responsibilities
include managing the system’s resources (the communication between hardware and software
components). It is the part of the Operating system which is in charge of the basics functions of
b)Shell
Shell is a program that sits on the computer as interface between users and kernel. This part of
the Operating System is in charge of controlling all interpreted commands on the computer.
c)File System
File system is a way of an Operating System used to handle its file and folder and differentiate
one file to another according to their extensions. File management (rm, cat, ls, rmdir, mkdir); or
file system is used to store and organize data on computer. This part is in charge of file
management, manipulation and access.
d)System resources
The operating system supervises the use of scarce system resources. Scarce because every
application on the computer competes to use these resources.
93) Is it possible to log on more than 1 user using one computer simultaneously? Explain your
answer.
ANSWER:
Yes, because any windows computer has the feature of switching users so that you can switch
more users simultaneously. OR in other words, you can log off one user and log in another user.
ANSWER:
ANSWER:
Int: specifies the integer (positive and negative natural) numbers. A number that has no digits
after the decimal point.
Char: declares or specifies a single character. It is a data type that is intended for holding
characters, as in alphanumeric strings.
ANSWER:
A data manipulation language (DML) is a computer programming language used for adding
(inserting), deleting, and modifying (updating) data in a database.
Select: is used to retrieve the data in database. It is used to select data from a database.
Insert: is used to enter data in database. It is used to add new rows of data into a table in the
database.
Delete: is used to erase/ delete some data or Rows in database. It is used to delete the existing
records from a table.
ANSWER:
It is a set of rules that governing communication between computers in the network. Protocol is a
set of rules that governs data communication.
ANSWER:
Identifying errors
Compressing data
Deciding how data will be sent
Addressing data
Deciding how to announce sent and received data
Network protocols enable computers to exchange data with each other in a meaningful,
organized and efficient way.
They provide the path to increase the network connections
They enhance the data transmission rate
Provide easy working to users
They enhance the speed of the connection
98) Describe the friend function
Friend Function is a function that is given the same access as methods to private and protected
data.
A friend function of a class is defined outside that class’s cope but it has the right to access all
private and protected members of the class. Even though the prototypes for friend functions
appear in the class definition, friends are not member functions.
To declare a function as a friend of a class, precede the function prototype in the class definition
with keyword Friend.
ANSWER:
=512+128+24+7=67110
=16+0+4+0+1=2110
ANSWER:
A computer program is an organized list of instructions that, when executed causes the computer
to behave in a predetermined manner.
ANSWER:
Programming means designing or creates a set of instructions to ask the computer to carry out
certain jobs which normally are very much faster than human being can do.
ANSWER:
Stored Procedures are groups/ set of instructions that run in the database server and can be
called with a single SQL statement.
ANSWER:
#include<iostream>
int i;
i=max * max;
cout<< i;
return 0;}
ANSWER:
Output: 32
i=max * max
i=10+2*10+2
i=10+20+2
104) In the table below give and explain with examples the 6 Arithmetic Operators of Visual
Basics
ANSWER:
ANSWER:
Visual Basic is a high level programming language evolved from the earlier DOS version called
BASIC. BASIC means Beginner’s All-purpose Symbolic Instruction Code.
OR
Visual Basic is a programming language that allows you to create your own software with the
look of window programs that you are familiar with.
ANSWER:
A Visual Basic program is made up of many subprograms each has its own program codes, and
each can be executed independently and at the same time each can be linked together in one way
or another.
OR
Design the user interface: When you plan the user interface we draw a sketch of the
screen that user will see when running our project.
Plan the properties: For each object write down the properties that you plan to set or
change during the design of the form.
Plan the basic code: This step is where you plan procedures that will execute when our
project runs. We will determine which events require action to be taken and then make a step by
step plan for those actions.
ANSWER:
Designing the logical and physical schemas, as well as widely used portion of the
external schemas.
Security and authorization
Data availability and recovery from failures
OR
Configuration
Upgrade
Administration
Monitoring and
Maintenance of database in an organization.
Data refers to a collection of text, numbers and symbols, images with no meaning.
b)Information
ANSWER:
Information is the result of processing data, usually by computer. Information is data that has
meaning.
c) Database
ANSWER:
ANSWER:
Node is any device that has its own network card and is connected to a computer network. OR
A node is a computer or any other device that is directly connected to a computer network. Some
examples of nodes are: Printers, routers, switches, servers, and computers.
ANSWER:
It is Bus topology. It uses terminators to absorb the signals at the end of the cable.
ANSWER:
Database Management system (DBMS) is referred to as a software system that is used to store,
access, manage, organize, maintain, modify and delete data from databases.
Examples: Microsoft Access, Oracle, Microsoft SQL Server, MySQL, SQL Server
ANSWER:
b) What is a peripheral?
ANSWER:
ANSWER:
ANSWER:
When considering users of a Database system, there are three broad classes to consider:
1. The database administrator (DBA): Responsible for authorizing access to the database, for
coordinating and monitoring its use, acquiring software and hardware resources, controlling its
use and monitoring efficiency of operations.
2. The database designer: Responsible to define the content, the structure, the constraints, and
functions or transactions against the database. They must communicate with the end-users and
understand their needs.
3. The End-users: They use the data for queries, reports and some of them update the database
content.
Star topology
Data Independence: The ability to modify a scheme definition in one level without affecting a
scheme definition in a higher level.
Logical data independence refers the ability to modify the conceptual scheme without causing
application programs to be rewritten.
Physical data independence refers the ability to modify the internal scheme without having to
change the conceptual or external schemas. Modifications at this level are usually to improve
performance.
ANSWER:
In a computer network, a switch is used to connect multiple computers. For example, an 8 ports'
switch allows us to connect 8 computers in a single network.
ANSWER:
ANSWER:
It is the unique number which identifies any electronic device on a network. OR
An IP address is an address used in order to uniquely identify a device on a computer network.
Also,
An IP address can be defined as the numeric identity of a node in the network.
ANSWER:
Transmission media is a pathway that carries the data or information from sender to receiver.
A Static IP address is assigned manually. Once assigned it does not change unless it is changed
manually again. While,
A Dynamic IP address is assigned by a service usually DHCP. It can change at any time.
They are expensive than dynamic IP They are Cheaper than static IP addresses
addresses
ANSWER:
ANSWER:
The DBMS (Database Management System) is preferred ever the conventional file processing
system due to the following advantages:
a)Attribute,
ANSWER:
Attribute is a property or description of an entity. A toy department employee entity could have
attributes describing the employee’s name, salary, and years of service.
b)Entity,
ANSWER:
Entity is an object in the real world that is distinguishable from other objects
c) Relationship,
ANSWER:
d) Relationship Set
ANSWER:
e) One-to-many relationship,
ANSWER:
One-to-many relationship is a key constraint that indicates that one entity can be associated
with many of another entity. An example of a one-to-many relationship is when an employee can
work for only one department, and a department can have many employees.
f) Many-to-many relationship,
ANSWER:
Many-to-many relationship is key constraint that indicates that many of one entity can be
associated with many of another entity. An example of a many to many relationship is employees
and their: a person can have many different hobbies, and many people can have the same hobby.
g)Participation Constraint,
ANSWER:
ANSWER:
Weak entity set is an entity that cannot be identified uniquely without considering some primary
key attributes of another identifying owner entity. An example is including dependent
information for employees for insurance purposes.
i) Aggregation,
ANSWER:
Aggregation is a feature of the entity relationship model that allows a relationship set to
participate in another relationship set. This is indicated on an ER Diagram by drawing a dashed
box around the aggregation.
k) Role indicator.
ANSWER:
Role indicator: if an entity set plays more than one role, role indicators describe the different
purpose in the relationship. An example is a single employee entity set with a relation reports to
that relates supervisors and subordinates.
Char ch=’A’;
If(ch==’A’)
System.out.println(“Account”);
If((ch==’C’) || (ch==’G’))
System.out.println(“Admin”);
If(ch==’F’)
System.out.println(“Advisor”);
ANSWER:
Char ch =’A’
Switch (ch){
ANSWER:
Case sensitive means that variable name declared in lower case is different with variable
declared in upper case letter. Therefore, Java is case sensitive.
ANSWER:
ANSWER:
Struct<Structure name>{
Structure element 1;
Structure element 2;
Structure element 3;
} Object names;
ANSWER:
ANSWER:
Memory Management
Processor Management
Device management
File Management
Security
Control over system performance
Job accounting
Error detecting aids
Coordination between other software and users
I/O devices management
Authorization management
Communication management
Applications program management
124) What are the hardware devices used for computer graphics?
ANSWER:
Digital cameras, Scanner, Printer, Smartphones, Selfie Sticker, Monitor, flash disk, etc
ANSWER:
Personnel Computer
Mini Computer
Mainframe Computer
Super Computer
ANSWER:
MS DOS Linux
MS DOS is a 16 bit Operating System with Linux is a 32-bit and 64-bit Operating System
software available utilize 32-bit features
MS DOS only has buit-in support for single Linux was designed from the ground up for
tasking multitasking.
MS DOS only supports one user. Linux supports multiple users
MS DOS is closed -source Linux is Open-source, available under the
terms of the GPL
MS DOS is tied to the 80X 86 platforms Linux can run on multiple achitectures.
128) List four different types of Web Browsers
ANSWER:
Internet Explorer
Mozila Firefox
Safari
Opera
Google chrome
Netscape Navigator/ Netscape
=(1*23)+(0*22)+(1*21)+(1*20)+(1*2-1)+(0*2-2)+(1*2-3)
ANSWER:
=128+32+23
=128+32+16+7
=128+32+16+4+2+1
FDISK:
FORMAT:
ATTRIB:
SYS:
CHKDSK:
TREE:
ANSWER:
DOS Meaning
FDISK FDISK is the DOS utility to low level format/partition your hard drive
FORMAT FORMAT is used for Formatting a disk for use with Windows.
ATTRIB ATTRIB is used for Displaying or changing file or directory attributes.
SYS This command is used to make a boot disk
CHKDSK Is used to Check a disk and display a status report.
TREE Graphically displays the directory structure of a drive or
path.
Algorithm refers to a step-by-step procedure that specifies how to perform a task or solve a
problem.
b) Algorithms are essential to the way computers process information, because a computer
program is essentially an algorithm that tells the computer what specific steps to perform (in
what specific order) in order to carry out a specified task.
ANSWER:
ANSWER:
Browse (Web browse) is program used for displaying and viewing web pages on the World
Wide Web (WWW), for example, Mosaic, Netscape Navigator, Internet Explorer, Mozilla
Firefox, Opera and Google Chrome amongst others. The web pages can be accessed using a web
browser.
134) Explain the advantages of using database management system than a file system of an end
user?
ANSWER:
The DBMS (Database Management System) is preferred ever the conventional file processing
system due to the following advantages:
ANSWER:
ANSWER:
A computer is an important tool for keeping databases, filing systems, track records
It helps an organization save tons of times. It has made data analysis extremely easy, and
it can be done at a single click of the mouse.
Computers also serve as useful tools for communications. Normal post is now commonly
referred to as e mail, as the must fast email has replaced it.
Computer is important because it makes our tasks easier to do and it helps us search
different things that we need to know instantly and automatically through world wide
connectivity.
ANSWER:
The term Client-Server can be defined as architecture that can distribute the processing of an
application between a front-end workstation component and a back-end server component.
138) Define “front-ends” and explain why they are called so.
ANSWER:
The front-end can be defined as an application that can be used to view and manipulate the data
in the back-end. The back-end is a set of related database tables. This system is introduced to
simplify the complexity of database based applications in the windows environment.
139) Which is the correct hierarchy of data from the smallest to the largest is :
140)How many Flash disks of 4GB can be found in Hard disk of 1TB?
ANSWER:
ANSWER:
Converts alternating current (AC) from mains to direct current (DC) required by internal
computer components
Supplies current to the internal component
142)What are the two examples of electronic devices connected to VGA Port.
ANSWER:
Projector
Monitor
143)A School needs to store information about Teacher (identified by TeacherId, FirstName,
Surname, Salary, Qualification, Address, Contact); Combination (identified by CombinationId,
CombinationName),Student (identified by StudentId, FirstName, Surname, Address, Schoolfees,
ContactNumber) and Subject (identified by subjectId, SubjectTitle). Describe the logical
relationships between objects Teacher-Student, Teacher-Combination, Student-Combination and
Teacher-Subject?
ANSWER
Teacher-Student= Teacher teaches Student
One to many relationship
Teacher-Subject= Subject is taught by Teacher
One to many relationship
Teacher-Combination=Teacher teaches in Combination
One to many relationship
Student-Combination=Students belongs to combination Many to one relationship
Transmission media is a pathway that carries the data or information from sender to receiver.
145) Read the following statements that describe the OSI layers and write the name of layer
correspond to each statement:
a. To organize bits into frames; to provide hop-to-hop delivery
b. This layer is responsible for end-to-end delivery between hosts.
c. To establish, manage and terminate sessions.
d. To translate, encrypt and compress data
e. To move packets from source to destination to provide internetworking.
f. To allow access to network users
g. To transmit bits over a medium; to provide mechanical and electrical specifications.
ANSWER:
a. Data link: To organize bits into frames; to provide hop-to-hop delivery
b. Transport: This layer is responsible for end-to-end delivery between hosts.
c. Session: To establish, manage and terminate sessions.
d. Presentation: To translate, encrypt and compress data
e. Network: To move packets from source to destination to provide internetworking.
f. Application: To allow access to network users
g. Physical: To transmit bits over a medium; to provide mechanical and electrical specifications
146) a) Which of the following cables can be used to have the connection?
i. VGA (Video Graphic Array) cable;
ii. Network cable;
iii. AC Power cable.
ANSWER:
The term Front End refers to the user interface, where the user interacts with the program
through the use of the screen forms and reports.
ANSWER:
An array is a collection of data items, all of the same type, accessed using a common name.
ANSWER:
The purpose of creating different computer users is to give different user permissions or access
to different computer resources.
ANSWER:
a) Thread is the smallest unit of processing that can be performed in an Operating System. A
thread is also called a lightweight process. Threads provide a way to improve application
performance through parallelism
b) A process is a program in execution. It is an instance of program execution and it is not as
same as program code but a lot more than it.
c) Process control block is a data structure maintained by the Operating System for every
process. It is also called Task Control Block and it is storage for information about processes.
151) Describe the simple measures that can be taken to protect data in the school computer lab.
ANSWER:
Installing anti-virus in all computers
Protect all computers with password
Install Firewall.
Install Antivirus Software.
Install Anti-Spyware Software.
Use Complex and Secure Passwords.
Check on the Security Settings of the Browser.
152) Declare both one dimensional and two dimensional arrays which can keep 100 in VB.
ANSWER:
b) Write briefly on importance of computer security at your school, in Rwanda and in the
whole world.
ANSWER:
ANSWER:
Description Device
This device sends and receives information Router
about the Network layer.
This device uses hardware addresses to filter a Bridge or Switch
network.
This device can measure the distance to a re- Router
mote network.
ANSWER:
You can know that a new document is virus infected by its extension .exe or .com
b) Use an example; explain how virus damage can reduce the production of any institution.
ANSWER:
Example: If in a bank, some computers are attacked by virus and all computers work in same
network. This means if some documents are shared through different ways, other computers in
network can be affected, and this can cause the loss of important information.
156)In a bank, any customer can create and use an identity (e.g., a user name and password) to
log into that bank's online service but the bank's pol-icy must ensure that the user can only access
to his/her individual ac-count online once his/her identity is verified.
a) Identify which type of security is used in this bank?
ANSWER:
The type of security used here is authorization
b) Why is it important?
ANSWER:
ANSWER:
Antivirus software are computer programs that attempt to identify, neutralize or eliminate virus
while Anti-spyware is a type of program designed to prevent and detect unwanted spyware
program installations and to remove those programs if installed
ANSWER:
Maximization of CPU utilization by keeping the CPU as busy as possible.
Fair allocation of CPU to the processes.
To maximize the number of processes that completes their execution per time unit. This
is
Called throughput.
To minimize the time taken by a process to finish its execution.
To minimize the time a process waits in ready queue.
To minimize the time it takes from when a request is submitted until the first response is
Produced.
ANSWER:
A computer attack is any attempt to expose, alter, disable, destroy, steal or gain unauthorized
access to or make unauthorized use of an asset.
An active attack attempts to alter system resources or affect their operation while a
passive attack attempts to learn or make use of information from the system but does not
affect system resources
ANSWER:
160) Explain the difference between social engineering and Shoulder Surfing techniques.
ANSWER:
In computer security, shoulder surfing is a type of social engineer who obtain information such
as personal identification number, password and other confidential data by looking over the
owner of information while as Social Engineering is a technique/ method used by someone by
trying to socialize with someone else with the purpose of picking/getting his/her credentials or
user name and password with intention to use them during his/her absence.
ANSWER:
The major difference between a program and a process is that a program is a set of instructions
to perform a designated task whereas the process is a program in execution.
A program is in the secondary storage. A process is loaded into the main memory.
A program consists of a set of instructions in a programming.
162) Give 3 examples of an audio port that connects audio devices to the computer.
ANSWER:
Line in, Microphone, Line out, Game port/MIDI
OR
OR
ANSWER:
AT Advanced Technology (old model)
ATX Advanced Technology Extended (most popular type of computer case used today)
BTX Balanced Technology Extended (newest form factor known as cooling case)
SFF Small Form Factor
ITX Type of case found on a lot of mini and microcomputer.
164) Tick in the cell where the device matches with the device type as shown below:
ANSWER:
165) Write an algorithm that asks the user to enter two numbers and it displays the product of
those numbers if it is null, negative or positive.
ANSWER:
Var a:integer
Var:integer
Start
Write(“Enter The First Number”)
Read(a)
Write(“Enter The Second Number”)
Read(b)
If(a < 0 and b > 0)
Write(“The Product is Negative”)
Else If (a< 0 and b=0)
Write(“The Product is Null”)
Else If (a< 0 and b < 0)
Write(“The Product is Positive”)
Else If (a > 0 and b > 0)
Write(“The Product is Positive”)
Else If (a = 0 and b = 0)
Write(“The Product is Null”)
End if end
OR
Var: a, b, product as integer
Write(“ Enter Two Numbers”)
Read(a,b)
Product ← a*b
If(Product > 0) then
Write(“The Product is Positive”)
Else if (Product < 0) then
Write(“The Product is Negative”)
Else
Write(“The Product is Null”)
End if
End
166) What is a loop?
ANSWER:
A loop helps to repeat instruction or block of instructions. It assists in the algorithm where you
want you want to carry out an activity for a certain number of times until a given condition is
satisfied or become false.
167) Write an algorithm which uses do….. while loop and displays numbers from 1 to 5.
ANSWER:
ANSWER:
The Data Rate is the number of bytes per second that the drive can deliver to the CPU. Rates
between 5 and 40 megabytes per second are common.
The Seek Time is the amount of time between when the CPU requests a file and when the first
byte of the file is sent to the CPU. Times between 10 and 20 milliseconds are common.
169) Study the program below and answer the questions that follow:
#include<stdio.h>
Int g=20;
Int main ()
{int g = 10;
ANSWER:
The output is 10
ANSWER:
a)A data structure is a group of data elements grouped together under one name.
b)Examples
Struct product{
ANSWER:
(c) Enumeration
(a)Void (b) Char (c) Float (d) Double (e) None of these
ANSWER:
(b) Char
ANSWER:
a)In a plug and play system, a device manager first performs a scan on different hardware
buses, such as Peripheral Component Interconnect (PCI) or Universal Serial Bus(USB), to detect
installed devices, then searches for the appropriate drivers.
b)Shell is a piece of software that provides an interface for users of an Operating System which
provides access to the services of a kernel.
ANSWER:
A Protocol is a set of rules that governs the communications between computers on a network.
In order for two computers can talk to each other, they must be speaking the same language.
ANSWER:
The memory management is managed according to three schemes namely: Fixed partition
Memory, variable partition memory, and variable partition allocation with compaction.
ANSWER:
The Trash can icon on the desktop contains files and folders which you have deleted using the
file manager or an application run from the desktop. It is a special folder in which it is still
possible to move back the deleted items to another folder so as to undelete them.
ANSWER:
1000.10 * 10.1= 10101.010
179) Items of tool box are used to design the application interface. These items are called
Controls, Name each control.
ANSWER:
ANSWER:
Logical data independence refers to the ability to modify the conceptual scheme without
causing application programs to be rewritten. While
Physical data independence refers to the ability to modify the internal scheme without having
to change the conceptual or external schemas. Modifications at this level are usually to improve
performance.
181) What is the output for the following codes?
#include<iostream>
using namespace std;
int main(){
int c=0;
while(c < 5){
c++;
cout<<c;}
return 0;}
ANSWER: 1,2,3,4,5
a)Primary key
b)Data Structure
c)Database Normalization
d)Ping
ANSWER:
a) Primary key: is candidate key which composed of the minimum number of fields to ensure
the occurrences are unique.
b) Data Structure: is a collection of variables of different data types under a single name.
c) Database Normalization: is a database design technique that reduces data redundancy and
eliminates undesirable characteristics like Insertion, Update and Deletion Anomalies.
d) Ping: is commonly used to test connections between computers.
183) Differentiate GUI (Graphical User Interface) from CLI (Command Line Interface).
In CLI, input is entered only at command While in GUI, input can be entered
prompt anywhere on the screen
In CLI, the information is shown or While in GUI, the information is
presented to the user in plain text and files shown or presented to the user in any
form such as: plain text, videos,
images, etc
In CLI, there are no menus provided While in GUI, menus are provided.
There are no graphics in CLI. While in GUI, graphics are used.
CLI do not use any pointing devices. While it uses pointing devices for
selecting and choosing items.
184) Differentiate read () and write () function used in algorithm development. (3marks)
ANSWER:
Read function (Inputs)
A read function is a function which is used for inputs.
It helps to receive the value entered by a user and assign it to a variable.
Syntax of read function:
Read ()
DBA is :
✓ Responsible for authorizing access to the database
✓ Responsible for coordinating and monitoring its use
✓ Responsible for acquiring software and hardware resources,
✓ Controlling its use and monitoring efficiency of operations.
3. Its content is user defined i.e. the user dictates what is to be contained in the RAM.
Server provides services to other computers on the network; Workstation used by the user, has
limited processing power and requests services from the server.
189) Which of the following is designed to control the operations of a computer? Explain it.
a) Application Software
b) System Software
c) Utility Software
d) User
ANSWER:
b) System Software
Explanation:
System Software is basically classified into two: System and application. System Software is
designed to control the operations and extend the processing capability of a computer system.
190)State four factors you would consider before installing computer software whether an
operating system or application software.
ANSWER:
Memory (RAM) capacity.
Free hard disk space.
Processor type and speed.
Graphics display.
191) Convert 101102 into a decimal number.
ANSWER:
192)Write a C++ program to assign a value of 100.235 to a double variable and then convert it to
int.
ANSWER:
193) List five rules you would follow to write code using XHTML
ANSWER:
ANSWER:
#include<iostream>
using namespace std;
int main()
{
int x, *y;
cout << "Enter a number\n";
cin >> x;
y = &x;
cout << "Value of the address of pointer of "<< x << " is "<< &y<<"\n";
return 0;
}
195) List 10 components inside computer case.
ANSWER:
Motherboard
CPU/processor
RAM (random access memory)
Hard drive
196) Write an algorithm which receive a width and height of a rectangle and display its area and
perimeter.
ANSWER:
var w,l as double
Start
Write(“enter a rectangle width”)
Read(w)
Write(“enter a rectangle height”)
Read(l)
Write(“the rectangle area is:”, w*l)
Write(“write the rectangle perimeter is:”, (w+l)*2)
end
OR
Var: width, height, perimeter, area as integer
Start
Write(“enter a rectangle width”)
Read(width)
Write(“enter a rectangle height”)
Read(height)
area = width*height
perimeter = (width+height)*2
Write(area)
Write(perimeter)
end
197) Explain major types of computer software, their uses, and examples.
ANSWER:
System Software: System software coordinates the activities and functions of hardware and
software, and it controls the operations of computer hardware and provides an environment or
platform for all the other types of software to work in. It is the most basic type of software in any
computer system, which is essential for other programs, applications and the whole computer
system to function.
System software examples: Microsoft Windows XP, Mac O S, Linux, Windows Vista, Ubuntu,
device drivers, etc.
ANSWER:
200) Define two dimensional arrays and give their syntax for declaring it.
ANSWER:
The switch makes a forwarding decision based on the destination host’s MAC address. The
switch essentially forwarded the frame from one port’s ingress queue to another Port’s egress
queue. To perform this forwarding decision, a switch consults its MAC address table.
Modulate: an analog carrier signal to carry digital information, it means to convert the
analog signal to digital signal.
Demodulate: a similar signal so as to decode the digital information from the analog
carrier signal and it means to convert the same signal back to the analog signal then
transmitted through telephone line.
203) What is the purpose of managing information?
ANSWER:
ANSWER:
Chk: Check box
Fil: File list box
Cbo: combo box
Frm: form
Txt: text box.
207) What SQL command can be used to delete columns from a table?
ANSWER:
inti,j;
for(i=1,j=2;i<=6;i++,j+=2)
System.out.println(i++);
System.out.println(“Finished!!!”);
ANSWER:
inti=1,j=2;
while(i<=6)
{System.out.println(i++);
i++;
j+=2;}
System.out.println(“Finished!!!”);
ANSWER:
a) Disk cleanup: this utility is used to clean the unnecessary files on the hard disk to save disk
space
b) Disk defragmenter: this utility is used to organize files (fragments) on your hard disk for
good performance of your computer
c) Ccleaner: It protects your privacy online and makes your computer faster and more secure.
Easy to use and fast download.
212) Name the ports indicated by letters from the picture bellow
ANSWER:
When considering users of a Database system, there are three broad classes to consider:
1. The database administrator (DBA): Responsible for authorizing access to the database, for
coordinating and monitoring its use, acquiring software and hardware resources, controlling its
use and monitoring efficiency of operations.
2. The database designer: Responsible to define the content, the structure, the constraints, and
functions or transactions against the database. They must communicate with the end-users and
understand their needs.
3. The End-users: They use the data for queries, reports and some of them update the database
content.
(a)10310
(b) 27010
ANSWER:
(a)10310 = (1100111)2
(a)101112
(b) 11111112
ANSWER:
(a)101112 =(23)10
ANSWER:
ANSWER:
(b)Computer Configuration: refers to the organization for assembling and functioning the
hardware installation of a computer.
(c)Computer System: refers the set of software and hardware necessary to facilitate the user to
manipulate a computer or it is a system able to receive (read data), process them and produce
useful information to the user or it is a system that allows exchanging information by using
computer.
a) Active memory
b) Dead memory
c) Main memory
d) Permanent memory
ANSWER:
a) Active memory: it is read and write memory, it is volatile, working field of the processor, it is
a memory which stores data and instructions under processing.
ANSWER:
The Arithmetic and Logical Unit of the CPU performs arithmetic and logical operations
to perform calculations.
ANSWER:
ANSWER:
Input instructions
Output instructions
Processing instruction
Declaration instruction
Assignment instruction
Control Instructions
Base instruction
Structure instruction
ANSWER:
222) What are the steps needed to solve a problem appearing in programming?
ANSWER:
ANSWER:
ANSWER:
ANSWER:
Compiler error
Running time error
Logical error
Semantic error
Syntax error
Linking error
Grammatical error / Lexical error
ANSWER:
ANSWER:
a. A computer is an electronic device capable of receiving raw facts (data) and performing a
sequence of operations on the data based on special computer instructions (processing) to
produce desired output (information).
b.Algorithm refers to a step-by-step procedure that specifies how to perform a task or
solve a problem
c. Programming(Computer programming) is a systematic process of writing a computer
program using programming languages
b) Smartphone:
c) Data structure
ANSWER:
a) A portable device: is a device that can easily be carried. It is a small form of a computing
device that is designed to be held and used in the hands.
c) Data structure: is a way of collecting and organizing data in such a way that we
can perform operations on these data in an effective way.
ANSWER:
Browse (Web browse) is program used for displaying and viewing web pages on the World
Wide Web (WWW).The web pages can be accessed using a web browser.
Internet Explorer
Mozila Firefox
Safari
Opera
Google chrome
Netscape Navigator/ Netscape
Mosaic
232) What is a VPN?
ANSWER:
VPN is a technology that allows remote users to connect and access network resources securely
over the Internet. VPN stands for Virtual Private Network.
ANSWER:
e. Both a and c
Configuration
Upgrade
Administration
Monitoring and
Maintenance of database in an organization.
235) Explain the advantages of using database management system than a file system of an end
user?
ANSWER:
The DBMS (Database Management System) is preferred ever the conventional file processing
system due to the following advantages:
ANSWER:
It is a set of rules that governing communication between computers in the network. Protocol is a
set of rules that governs data communication.
Identifying errors
Compressing data
Deciding how data will be sent
Addressing data
Deciding how to announce sent and received data
Network protocols enable computers to exchange data with each other in a meaningful,
organized and efficient way.
They provide the path to increase the network connections
They enhance the data transmission rate
Provide easy working to users
They enhance the speed of the connection
ANSWER:
a)It is the unique number which identifies any electronic device on a network. OR
An IP address is the numeric identity of a node in the network.
b) A Static IP address is assigned manually. Once assigned it does not change unless it is
changed manually again. While
A Dynamic IP address is assigned by a service usually DHCP. It can change at any time.
They are expensive than dynamic IP They are Cheaper than static IP addresses
addresses
START
SET radius, area As Double
CONST PI=3.14
WRITE “enter radius”
READ radius
Area=radius *radius*PI
WRITE”print area”
STOP
239) Give and explain the use of operations used in Queue and in Stack?
ANSWER:
a)Data Structure
b) Null pointer
c) Give the syntax of class declaration.
ANSWER:
a) Data structures study how data are stored in a computer so that operations can be
implemented efficiently.
class class_name {
access_specifier_1:
member1;
access_specifier_2:
member2;
...
};
a)Threat
b) Virus
c) Worms
d)Operating system
ANSWER:
a) A threat is a potential negative action or event facilitated by a vulnerability that results in an
unwanted impact to a computer system or application.
b) A computer virus (Virus) is a malicious piece of computer code designed to spread from
device to device. A subset of malware, these self-copying threats are usually designed to damage
a device or steal data.
c) Worm is a type of malware that spreads copies of itself from computer to computer. A worm
can replicate itself without any human interaction, and it does not need to attach itself to a
software program in order to cause damage.
d)Operating system is system software that manages computer hardware, software resources,
and provides common services for computer programs.
a. Apple’s iOS
b. Android OS
c. Windows Phone OS
d. BlackBerry OS.
ANSWER:
Compiler that translate the entire source code to object code, While an interpreter translates
source code one statement at a time
Interpreters Compilers
Translates source code one statement at a time. Translates the entire source code at once before
execution.
Translates the program each time it is run hence Compiled object code is saved on the disk
slower than compiling. hence runs faster than interpreted programs.
Interpreted object code takes less memory Compiled programs require more storage to
compared to compiled program. store the object.
b) Give another two (2) examples of portable devices and one feature for each.
ANSWER:
a) A portable device is a small form of a computing device that can easily be carried and is
designed to be held and used in the hands. OR
A portable device may also be called a handheld device or mobile device
b)
ANSWER:
#include<iostream>
using namespace std;
int main ()
{
for (int i=0; i<=20; i+=5)
{
for(int j=0;j<=i;j+=5)
{
cout<<j<<"\t";
}
cout<<"\n";
}
return 0;}
245) a)What is switching?
Switching is process to forward packets coming in from one port to a port leading towards the
destination. When data comes on a port it is called ingress, and when data leaves a port or goes
out it is called egress. A communication system may include number of switches and nodes.
When two nodes communicate with each other over a dedicated communication path, it is called
circuit switching. There 'is a need of pre-specified route from which data will travel and no other
data is permitted. In circuit switching, to transfer the data, circuit must be established so that the
data transfer can take place. While message switching first receives the whole message and
buffers it until there are resources available to transfer it to the next hop. If the next hop is not
having enough resource to accommodate large size message, the message is stored and switch
waits.
245) Define:
a)Variable
b)Pseudocode
c)Flowchart
ANSWER:
Limitations Of Computer
It cannot work without electricity
Computer cannot take own discussion
Computer has zero IQ
Computer is completely depends on human
Computer is costly
Computer has no creativity
a) UPS
b) CPU
c) CMOS
d) OS
e) GIGO
ANSWER:
d) OS -Operating System
249) Using an arrow match the following in Group A with their corresponding in Group B
Group A Group B
a. Radio waves 1. Qualities of Computer network
Performance
b. Millions of interconnected network 2. Disadvantages of Computer network
c. Sharing resources 3. Wireless
d. Hacking attacks 4. WAN
e. Bandwidth and Latency 5. Advantages of Computer network
ANSWER:
A=3
B=4
C=5
D=2
E=1
250) In the school environment, classify the following computers into servers, workstations, or
embedded computers:
a. Computer used to control access to hardware and software resources in a networked
environment.
b. Computer used to access hardware and software resources in a networked environment.
c. Computer used in smart cards such as those used on ATMs and automated parking.
ANSWER:
a) Servers
b) Workstation
c) Embedded computer
a. Applications software
b. System software
c. Programming language
d. programmer
e. Coding
ANSWER:
a. Applications software: are programs that are designed to help users accomplish specific
tasks.
b. System software: are programs which control functionality of fundamental operations of
computer systems in general
c. Programming language: is an artificial language used to create new programs.
d. A programmer: is a person who writes computer program.
e. Coding: is the process of writing instructions to enable a computer to do a specific task.
ANSWER:
Algorithm is a set of instructions which produce a solution to a given problem while the
flowchart is a graphical representation of an algorithm.
ANSWER:
An AND gate returns FALSE when all operands (inputs) are false (0).
Output: 6 7
258) Explain the term “Variable”
ANSWER:
A variable is a memory zone which is used to store data.
259) Discus about the scope of variable used in C++.
ANSWER:
The scopes of variable used in C++ are global or local. A global variable is declared outside
all functions while a local variable is declared within a function.
262) Discus four types of selection (decision) control structures supported by most structured
programming languages.
ANSWER:
(a) The if selection is a control statement that performs an action if the condition is true, or
skips
the action if the condition is false.
(b) The if …else selection is conditional logic that specifies the action to be performed if
the condition is true, or an alternative the action is false
(c) The nested if…else selection is a conditional logic that tests for multiple alternatives by
placing if…else statements within another if…else statement.
(d) The switch... case control statement is used to choose from several alternatives. Within
the switch are actions (cases) associated with a constant value that must be evaluated before the
statements within each case are executed.
ANSWER:
ANSWER:
The infrared TV remote control in our home will not interfere with the use of our neighbor’s
infrared TV remote control because of its frequencies (between 300 GHZ to 400 THZ) which
cannot penetrate walls.
ANSWER:
An event is a signal that informs an application that something important has occurred.
Examples: Mouse clicks, move cursor, press a button…
A hub is a network hardware device for connecting multiple devices together and making them
act as a single network segment. while
The Access Point is a network device connected to the Hub, switch or router (via copper
cable) and spread radio waves (wireless internet) to the rest of network.
ANSWER:
a) Computer programming is a systematic process of writing a computer program using
programming languages. Or
Computer programming is the act of writing computer programs, using a Computer
Programming Language to perform a specified task by the computer.
270) State four types of selection control structures supported by most structured programming
languages.
ANSWER:
Selection control structure are if, if..else, nested if and switch ..case selection
ANSWER:
Binary codes are 0's and 1's, mnemonics are abbreviations and assembler converts a low-level
assembly program to machine form.
272) Explain why C++ is regarded as multi-paradigm programming language.
ANSWER:
273) Rewrite the following mathematical expression into a C++ assignment statement:
ANSWER:
274) Mr. Peter bought a new electrical kettle. On the power switch of if were two inscribed digits
0 and 1:
(b) Explain why the two symbols are important in computers and computer programming.
ANSWER:
b)Computers only understand machine language hence every instruction must be converted to 0's
and 1's.
275) Write a C++ Program to Find Size of int, float, double and char in your System.
ANSWER:
#include<iostream>
using namespace std;
int main() {
cout << "Size of char: " << sizeof(char) << " byte" << endl;
cout << "Size of int: " << sizeof(int) << " bytes" << endl;
cout << "Size of float: " << sizeof(float) << " bytes" << endl;
cout << "Size of double: " << sizeof(double) << " bytes" << endl;
Library functions are in-built into a compiler while user-defined are written by the
programmer
Artificial intelligence refers to the effort to develop computer-based systems (both hardware and
software) that behave as humans.
ANSWER:
(a) Preprocessor directives prepares the source code for compilation by removing comments,
and white spaces
(b) Linker combines the object code compiled from your source code with the code for the
imported functions to produce an executable file
ANSWER:
Algorithm refers to a step-by-step procedure that specifies how to perform a task or solve a
problem.
b) Algorithms are essential to the way computers process information, because a computer
program is essentially an algorithm that tells the computer what specific steps to perform (in
what specific order) in order to carry out a specified task.
ANSWER:
Int: specifies the integer (positive and negative natural) numbers. A number that has no digits
after the decimal point.
Float: is a floating-point number, which is a number that can have digits after the decimal point.
Char: declares or specifies a single character. It is a data type that is intended for holding
characters, as in alphanumeric strings.
ANSWER:
Smalltalk, Objective Delphi Pascal, C++, Java, C#, Visual Basic.Net, and C#.
c) Identify Five Integrated Development Environments (IDE) or Tools that can be used to create
C++ applications.
ANSWER:
C++ IDEs include GNU C++, Dev C++, Microsoft Visual C++, CodeLite, NetBeans and
Eclipse..
The concepts of OOP are: Object, Class, Inheritance, Polymorphism and Encapsulation
282) Draw a Client-Server network diagram and explain the role of each
component.(4 marks)
ANSWER:
283) What are difference between bus topology and tree topology?
ANSWER:
Member variables (Data members): Variables in a class are referred to as member variables or
data members.
Member function(s): Member functions are functions defined within a class that act on the data
members of a class.
286) Study this C++ code and identify possible syntax error.
# include<iostream> using
namespace std; main()
{
cout>>" Is a beautiful
country"; return 0;
}
ANSWER:
The syntax error was made at extraction operator on cout>> must be written as cout<<
ANSWER:
288) A member function of a class can be defined inside the class or outside of class. Provide
the syntax which demonstrates how to define the member function outside of class?(4
marks)
ANSWER:
The textbox is the standard control for accepting input from the user as well as to display the
output
291) Write a class called person which has two data members age and name and two member
functions getdata() to input name and age of a person and display( ) to print them out.
ANSWER:
#include<iostream> using
namespace std; class Person {
public: string name; int
292) Let consider the database with table CUSTOMER identified by CustomerName,
Address, TelephoneNumber, CreditLimit, ItemOrdered,Quantityand Price.
However, a customer may order several items and each customer in the database may order a
different number of items. This situation makes it difficult to implement the data in a
relational database, since we do not know how many order entries to allow.
Is this database structure complex? If yes, identify the anomalies it has and suggest the
solution to the database designer to make it simple.
ANSWER:
Yes, this database structure is complex, because it results too much redundancy in the database's
information. To avoid suffer from poor construction of this table, database designer is suggest
to dive into two tables: one for Customer and another one for Order, and make a relationship
between those tables.
ANSWER:
It is a set of rules and procedures that govern communication between two or more devices in
the same network
b) Explain how does protocol work
ANSWER:
The computer that receiving data then performs the same tasks but in reverse order
295) Your computer starts, you hear sound and see video. BIOS conduct POST and everything
seems fine but the following error message appears: Operating system missing. Which
components could be missing or damaged?
ANSWER:
Hard disk because is where O.S stored after installed in your P.C
ii.Prone to damage
The OR operator returns a False if both operands (input) are False (0).
The AND operator returns a False if one of its operands (input) is False (0).
299) Compute the following
a) Find the binary equivalent of (255.45)10.
b) Convert (FADE)16 to octal system.
c) Represent “-32” in sign magnitude form.
ANSWER:
#include<iostream>
using namespace std;
void swap (int m, int n) {
int x = m;
m = n;
n = x;
}
int main() {
int x = 5, y = 3; swap(x,y);
cout<<"x="<<x<<"\n"<<"y="<<y; return 0;}
ANSWER:
Output:
x=5 y=3
301) Write an algorithm that read two numbers from keyboard and inform the user if the sum
of those numbers is odd or even.
ANSWER:
ANSWER:
Spoofing means to pretend to be someone else. While Sniffing means to illegally listen
into another’s conversation
b) Authorization and Authentication
ANSWER:
Authentication confirms who you are while Authorization is the process to confirm what you
are authorized to perform.
303) What are the different between DELETE and DROP SQL Statement?
ANSWER:
The Visual Basic IDE is made up of a number of components. Menu Bar; Tool Bar; Project
Explorer; Properties window; Form Layout Window; Toolbox; Form ,etc
305) Discuss the operations that can be performed on the computer memory. Read and Write
Read operation is performed when information is transferred from the memory to another
device.
Write operation is performed when information is transferred from another device to the
memory.
306) Discus four conditions that must hold simultaneously for a deadlock to occur.
ANSWER:
307) The diagram below show the log-in screen on network. To gain access to the internet the
user name and password must be entered.
a. W h a t is a password?
ANSWER:
It is a secret word or phrase that must be used to gain access to a computer system or service.
b. W r i t e VB code for login when Ok button is clicked. For example if user set user name as
“User” and Password as “Password”, Form 2 will appear on screen and Login form disappear.
ANSWER:
1. Creating: It helps in creating a new file at the specified location in a computer system.
The new file could be a word document, an image file or an excel worksheet.
2. Saving: It helps in saving the content written in a file at some specified location. The file
can be saved by giving it a name of our choice.
4. Modifying: It helps in changing the existing content or adding new to an existing file.
+: addition
-: subtraction
*: multiplication
/: division
%: Modulus
310) Diferentiate the following terms used in computer and computer science
a) Embedded computers versus General purpose computers.
ANSWER:
Embedded computers are computing devices designed for a specific purpose. Generally, an
embedded computer has an operating system that only runs a single application, While General
purpose computer is a computer that is designed to be able to carry out many different tasks.
ANSWER:
311) Terambere Company Ltd is running a business and wishes to manage transactions in
computerized way. The database of business contains various entities including “Customers” (id,
names, age, address, salary) and orders (id, date,customer_id, amount) which are given here
below. Help your school to find a solution to get the following:
i. The highly paid Customer
ii. The least paid Customer
iii. The oldest Customer
iv. The youngest Customers
v. To generate total amount of income at a given day.
vi. To retrieve only the names and age of all Customers
vii. To retrieve the average income at a given day.
ANSWER:
ANSWER:
Data can be read (retrieved) and written (stored) in it.
RAM is a temporary (volatile) storage because its content disappears when the computer
is switched off
Its content can be changed
RAM is faster and stores the instructions which are directly accessed by the CPU
313) Explain why the MS Access is used as database application software.
ANSWER:
The MS Access is used as database application software because it provides the following
features of DBMS:
Improved data sharing
314) Write a C++ program which prompts the user to enter two numbers and print out their sum
and average.
ANSWER:
#include<iostream.h>
int main( ) {
float a, b, sum, average;
cout<<”Enter any two integer numbers:”<<endl;
cin>>a>>b;
sum=a+b;
average =sum/2;
cout<<” Sum = ” <<sum<<endl;
cout<<”Average = ”<< average <<endl;
return 0; }
ANSWER:
i)4rows
ii)12 elements
iii)T[1][0],T[1][1],T[1][2]
iv)T[0][2],T[1][2]T[2][2],T[3][2]
v)T[0][1]=0
ANSWER:
ANSWER:
Function of DBA
319) List and explain the main components of central processing unit (CPU).
ANSWER:
The Central Processing Unit (CPU), also known as the processor, It is actually regarded as the
“brain” of the computer because all processing activities are carried out inside the processor.
The CPU is made up of three distinct components within it:
The Arithmetic Logic Unit (ALU): -ALU performs all arithmetic and logical
operations.
The arithmetic and logic unit is the location within which all arithmetic and logical operations
are carried out in the CPU. Basic arithmetic operations include; addition, subtraction,
multiplication and division.
Control Unit: -The control unit coordinates all processing activities in the CPU as well
as input, storage and output operations. It determines which operation or instruction is to
be executed next.
The control unit interprets instructions and controls speed of execution using a clock.
Registers: special memories within the CPU for holding instructions and data.
320) List down any four internal components of computer .
ANSWER:
Motherboard
CPU (Microprocessor)
Main memory (RAM)
Expansion cards.
Power supply unit.
Optical disc drive.
Hard disk drive (HDD)
ANSWER:
Serial port
Parallel Port
Universal Serial Bus
Video graphics array port
Network port
Audio Ports
Firewire connector
High Definition Multimedia Interface (HMDI)
322) List 4 examples of secondary storage .
ANSWER:
Examples of secondary storage are:
Hard disk drive
Memory card
Floppy disk
DVD
CD
323) Explain why it is good practice to install genuine copy of an operating system.
ANSWER:
Piracy is illegal. Hence installing genuine software is an ethical requirements against piracy and
intellectual property theft.
324) When you move the NIC cards from one PC to another PC, does the MAC address gets
transferred as well? Explain your answer.
ANSWER:
Yes, when you move the NIC cards from one PC to another PC, the MAC address gets
transferred because MAC address is manufactured on NIC. means MAC is the unique address of
NIC.
ANSWER:
a. An operating system (OS) is system software that manages computer hardware and software
resources and provides common services for computer programs
b)
326) a) With 2 examples for each, differentiate straight - through cable from cross-over cable .
b) Contrast Bluetooth and Wi-Fi(wireless fidelity).
c) In a network that contains two servers and twenty workstations, where is the best place to
install an antivirus program. Explain why?
ANSWER:
a) A straight-through cable is a type of twisted pair cable that is used in local area networks to
connect a computer to a network hub such as a router. OR
A straight-through cable: are used to connect the unlike devices. (1mark for correct definition)
Examples:
Switch to router
Switch to PC or server
Hub to PC or server
A crossover cable is a type of ethernet cable used to connect computing devices together directly.
Also,
A crossover cable can be defined as a type of cable installation that is used for the
interconnection of two similar devices. (1mark for correct definition)
Examples:
Switch to switch
Switch to hub
Hub to hub
Router to router
PC to PC
b) Bluetooth is a wireless technology used for exchanging data between fixed and mobile
devices over short distances. While
Wi-Fi (Wireless Fidelity) is a name of a wireless networking technology that uses radio waves
to provide wireless high speed internet and network connection.
c) An Anti-virus program must be installed on all Server and Workstation to ensure protection.
That is because individual user can access any workstation and introduce a computer virus when
plugging in their removable hard drive or flash drives.
ANSWER:
Easy Sharing of Resources: Computers are able to share various resources easily over a
network. Shared resources can be Internet, files, printer, storage and others.
Reliability: It means that computer network provides assurance of the delivery of data to the
intended recipient.
Scalability: The possibility of adding new computer without affecting the network performance.
Security: computer network must be secured for the benefit of the user and data protection. The
security is achieved by protecting data from unauthorized access.
b. Security issues: Huge numbers of people use a computer network to get and share their files
and resources, a certain user’s security would be always at risk. Viruses can spread to other
computers throughout a computer network. There is a danger of hacking, particularly with wide
area networks. Security procedures are needed to prevent such abuse, Examples: The use of
Antivirus and firewall.
c. Lack of robustness: computer network’s main server breaks down; the entire system would
become useless.
ANSWER:
a. One to One (1:1): A person can have only one passport.
b. One to Many (1: M): A class has many students.
c. Many to one (M:1) a mother has many children
d. Many to Many (M:M): many customers can purchase more than one book.
ANSWER:
a. If the input is wrong, the computer processes wrong output hence the term Garbage In
Garbage out (GIGO). GIGO is a phrase used in computer science that implies that if invalid or
erroneous data is entered into a computer (garbage in), the computer will process and output
invalid or erroneous results (garbage out)
b. Artificial intelligence refers to the simulation of human intelligence in machines that are
programmed to think like humans and mimic their actions.
c. Partitioning a disk refers to the process of dividing a large physical disk into two or more
partitions called logical drives that are treated as independent drives.
d. Defragmentation is the process of moving file fragments to contiguous clusters to optimize
on storage space and performance.
ANSWER:
Simplex
In simplex transmission mode, the communication between sender and receiver occurs in only
one direction. The receiver cannot reply to the sender.
To take a keyboard/monitor relationship as an example, the keyboard can only send the input to
the monitor, and the monitor can only receive the input and display it on the screen. The monitor
cannot reply, or send any feedback, to the keyboard.
Half Duplex
Full Duplex
In full-duplex transmission mode, the communication between sender and receiver can occur
simultaneously. The sender and receiver can both transmit and receive at the same time. The
full-duplex transmission mode is like a two-way road, in which traffic can flow in both directions
at the same time.
For example, in a telephone conversation, two people communicate, and both are free to speak
and listen at the same time.
333) Give and explain different types of registers.
ANSWER:
Instruction register: It temporarily holds an instruction before it is converted to
machine readable format.
Address register: It temporarily stores the address of the next instruction to be
processed.
Accumulator register: It temporarily holds the last processing step of the
Arithmetic Logic Unit (ALU).
Storage register: It temporarily holds information waiting to be output.
334) Define two dimensional arrays and give their syntax for declaring it.
ANSWER:
335) In the network that contains two servers and twenty workstations, where is the best place to
install an antivirus program? Explain why?
ANSWER:
336) Write the following abbreviations in full as used in computer systems: (4marks)
ANSWER:
a. COBOL : Common Business Oriented Language
b. SCSI : Small Computer System Interface
c. NTFS: New Technology File System
d. AGP: Accelerated Graphics Port
337) Mention 2 examples of power protection devices that can be employed to secure a
computer from power related problems.
ANSWER:
Surge suppressors or surge protector.
Uninterruptible Power Supply (UPS).
338) Explain how computers play very important roles in the following various socio-economic
sectors:
a) In education
b) At home
ANSWER:
a) In education:
Computers are used in teaching and learning in schools, colleges and universities;
Online learning, and it is done through
Use of computers in education and training
Research through the Internet
Online registration
b) At home
Computers can be used at home for recreational activities such as: watching movies,
They are used for playing music and computer games.
They can also be used in storing personal information,
They are used for calculating,
They are used for keeping home budgets and research.
339) State four factors you would consider before installing computer software whether an
operating system or application software.
ANSWER:
Memory (RAM) capacity.
Free hard disk space.
Processor type and speed.
ANSWER:
a) A file system is the structure used by operating system to store, retrieve and update data on
storage device.
b) Examples of Windows file systems include File Allocation Table (FAT32), New Technology
File System (NTFS) and extended FAT (extFAT).
341) Answer the following questions by true or false
i. public data members of a class can be accessed directly in the main function without an object?
ii. Every object of a class has its own copy of the data and functions.
ANSWER:
i)False
ii)True
iii)False
342) Write an Algorithm that decrease the numbers for 10 to 0 number and when it reaches to
number 4 it skips that iteration, using loop.
ANSWER:
Var i as integer
Start
For(i=1 to 0) do
If(i==4) then
Continue
Write(i)
End if
End for
End
ANSWER:
Laptop
Desktop
Smartphone
Tablet
Smart TV
344) Explain the difference between one to many and many to many relationship. Give an
example for each.
ANSWER:
One to many relationship: An instance of one entity can relate to multiple instance of another
instance.
The relationship that associates one record of entity A to more than one record of entity B is
called one-to-many relationship.
Example of one-to-many relationship is a country having states, School has many Students.
While
Many to many relationship: Multiple instances of an entity can relate to multiple instances of
another entity.
Example of many to many relationships is Teacher and Student the relationship is many
teachers teach many students.
ANSWER:
A week entity is an entity which depends on another entity while a strong entity does not depend
on another entity.
ANSWER:
switch(code)
{
Case ‘a’:
348) Tick in the cell where the device matches with the device type as shown below.
ANSWER:
349) Which of the following is designed to control the operations of a computer? Explain it.
a) Application software
b) System software
c) Utility software
d) User (3marks)
ANSWER:
b) System software.
ANSWER:
Constraints are the rules enforced on the data columns of a table. These are used to limit the type
of data that can go into a table.
ANSWER:
i) Size of array: rows= 2 ; columns= 3
ii) Declaration of array a: var a[2][3] As integer.
iii) Initialization of array:
a[0][0] = 1
a[0][1] = 2
a[0][2] = 3
a[1][0] =13
a[1][1] =17
a[1][2] = 34
Binary search: This method works on sorted lists by progressively making better guesses to
find the location of a search key.
354) Which types of cables you can use to connect the following devices?
ANSWER:
a)UTP cable
b)HDMI Or VGA cable
c) Sound cable
d)Power Adapters
e)USB cable, parallel cable or serial cable
355) Explain some characteristics that make a computer suitable for processing Repetitive task.
ANSWER:
It does not get tired (reliable)
It can be programmed to perform a task repetitively(versatile)
It does not have the human body weaknesses (diligent)
Once programmed it follows instructions exactly without fail(accuracy)
356) Highlight some 3 achievements of the fifth generation computers.
ANSWER:
Multi-processor based system.
Use of Artificial Intelligent.
Development of devices that are capable of learning, and respond to natural language
input (voice recognition).
Development of natural language processing.
Use of optical fiber in circuits
Development of the elements of programs
Automated audio in any language to control the workflow of the computer
Magnetic enabled chips
Huge development of storage
More powerful micro and macro computers
Development of enormous powers with AI
357) State 4 operations you can do in the list.
ANSWER:
a. Window 8
b. Ms word, Kaspersky, ms excel2016, photoshop, ms access 2016
c. Ms Word
d. Ms Access
e. Ms Excel
f. Ms Word, Ms Excel, Ms Access
g. Photoshop
h) Kaspersky
i) Windows 8: It is an Operating System, if is not installed firstly, that new computer cannot
work.
359) Which of the following data types is more commonly called Boolean?
a) Yes/No
b) Date/Time
c) Hyperlink
d) Attachment
e) No one above
ANSWER:
ANSWER:
362) Write a program that calculate the Roots of a Quadratic Equation: ax2 +bx +c in C++ using
pointers.
ANSWER:
#include <iostream>
#include<math.h>
using namespace std;
intmain()
{
float a, b,c; float x,x1,x2,delta;float *aptr;float *bptr;float *cptr;
aptr=&a;
bptr=&b;
cptr=&c;
a=*aptr;
b=*bptr;
c=*cptr;
//calculate delta
delta=*bptr * *bptr -4 * *aptr * *cptr;
x1=(-*bptr + sqrt(delta))/(2* *aptr);
x2=(-*bptr - sqrt(delta))/(2* *aptr );
cout<<"x1="<<x1<<endl;
cout<<"x2="<<x2<<endl;
getch();
return 0;
}
363) Compare Database Management System and traditional File processing system
ANSWER:
ANSWER:
SET a, b As Integer
START
WRITE("enter 1st number")
READ(a)
WRITE("enter 2nd number")
READ(b)
If (a * b) > 0 Then
WRITE( "The product is positive")
Else If (a * b) = 0 Then
WRITE( "the product is null")
Else
WRITE( "the product is negative")
End If
END
OR
START
SET a, b,product As Integer
WRITE("enter 1st number")
READ(a)
WRITE("enter 2nd number")
READ(b)
Product=a*b
If product > 0 Then
WRITE( "The product is positive")
365) Write codes of VB 6.0 program which displays the Sum and Average of numbers ranging
from 0 to 10 use do..loop until.
ANSWER:
Dim i As integer
Dim Sum,Av As double
Private Sub command-click()
Sum=0
i=0
Do
Sum=Sum+1
i=i+1
Loop until i>10
Av=Sum/11
text1.text=Cstr(Av)
text1.text=Cstr(Sum)
End Sub
c) Write a java application that asks the user to enter two integers, obtains them from the
user and displays the larger number followed by the words “is larger”. If the numbers are equal,
print “These numbers are equal”
ANSWER:
a) Access modifiers (or access specifiers) are keywords in object-oriented languages that set the
accessibility of classes, methods, and other members
b)
Modifier Description
Default declarations are visible only within the
package (package private)
Private declarations are visible within the class only
ANSWER:
A control is a tool on the toolbox window that you place on a form to interact with the user and
control the program flow.
ANSWER:
Mozila Firefox
Safari
Internet Explorer
Opera
Google Chrome
Netscape navigator/ netscape
369) Provide only five examples of software which can be used in database creation and
maintenance.
ANSWER:
SQL, MySQL, Ms Access, Foxpro, Oracle
370) What are three types of access specifier? Explain each other.
ANSWER:
Private members of a class are accessible only from other members of the same class or
from their friend classes
ANSWER:
Perform daily backup
Perform daily database maintenance
Perform database authentication for database users
Install antivirus software
372) What does E-commerce mean?
ANSWER:
Electronic commerce (e-commerce) consists primarily of the distributing, buying, selling,
marketing, and serving of products or services over electronic systems such as Internet and other
computer networks.
ANSWER:
var x, factorial as numeric
start
factorial ←1to 100
factorial =factorial*x
x ←x+1
Write(The factorial is: factorial)
End
b)a program in C++ to compute 100 factorial (100!).
ANSWER:
#include<iostream>
Int main () {
Int a, factorial=1;
Factorial=factorial*a;
374) Write a C++ Program that accepts three digits and displays on the screen the product of the
three numbers.
ANSWER:
#iclude<iostream>
Int main () {
Cin>>x>>y>>z;
Product=x*y*z;
ANSWER:
The table is a collection of related data entries and it consists of columns and rows
ANSWER:
An identifier is known as simple if it consists of only one property. The example it is with in the
entity CUSTOMER.
2) Composite identifier
3) Relative identifier
4) Weak entities
An entity B is known as weak it can be only identified by an identifier of another entity A such
as A and B is in association.
Answer:
#include<iostream.h>
#include<stdlib.h>
Main(){
Int ara[10]
Int i, n;
Cin>>ara[i]
Cin>>n;
If(ara[i]==n)
Exit(0);
Else
}}
ANSWER:
File systems are the structures behind how your computer stores and organizes data.
Everything you install, save, edit or create on computer comprise the trillions of bits of data a file
b)List four activities that an Operating System does / operate for file management
ANSWER:
Keeps track of information, location, uses, status etc. The collective facilities are often
known as file system.
Decides who gets the resources.
Allocate the resources
De-allocates the resources
ANSWER:
The file system is responsible for organizing files and directories, and keeping track of which
areas of the media belong to which file and which are not used.
ANSWER:
#include<iostream>
using namespace std;
int mult(int a, int b)
{
int c;
c=a*b ;
return(c);
}
int main()
{
int x, y, z;
cout<<" enter any two numbers : "<<endl;
cin>>x>>y;
z=mult(x,y);
cout<<"Product = "<<z<<endl;
return 0;}
b) The scope and lifetime of the variables defined in C is classified depending on the storage.
Give 3 classes of storage variables.
ANSWER:
Automatic variable
379) Using a switch, write an algorithm which receives a student name and tells him his grades
as follows:
ANSWER:
Start
Write("GRADE MENU:”)
Read(note)
Switch(note)
Case 1
Case 2
Case 3
End switch
End
ANSWER:
Power Supply changes normal household electricity into electricity that a computer can use.
Motherboard is the main circuit board of a computer. All computer components are attached to
the motherboard.
Random Access Memory (RAM) temporarily stores information inside a computer. The
information is lost when computer is turned off.
Drive Bay is the space inside the computer case where a Hard drive, Floppy drive or CD-ROM
drive sits.
Hard Drive is the primary device that a computer uses to store information.
Expansion Slot is a socket on the motherboard that Expansion Card plugs into.
Central Processing Unit (CPU) processes instructions, performs calculations and manages the
flow of information through a computer.
381) Write visual basic program to calculate factorial of a number using function
382) Draw a flowchart that takes radius as input to calculate and display the area of a circle.
ANSWER:
ANSWER:
FOR (i=0 TO n) do
Sum=sum+marks(i)
End for
Average=sum/n
WRITE(“the number of students is”, n)
WRITE(“ the students’ marks are”,marks(i))
WRITE(“sum of those mark is”,sum)
WRITE(“average is”, average)
END
384) Write a C++ program using array to find the average marks obtained by 5 students.
ANSWER:
#<iostream.h>
void main()
{
Inti,Sum=0,marks[5];
float avg;
cout<<”enter marks”;
ANSWER:
First Name:
Last Name:
Password:
ANSWER:
<!DOCTYPE html>
<html>
<head>
<form>
<body>
First Name: <input type="text" name="firstname"/> <br/>
Last Name: <input type="text" name="lastname"/><br/>
<label for="password">Password: </label>
<input type="password" id="password" name="password"/><br/>
</body>
</form>
</head>
386) write program using an array to store 10 integers and show them.
ANSWER:
#include<iostream.h>
main()
{
int my_arr[5]; // name of array.
cout<<”\nEnter values at: “;
for(int i = 0 ; i < 10; i++)
{
ANSWER:
Advantages
High level languages are portable i.e. they are transferable from one computer to another.
High level languages are user friendly and easy to use and learn.
High level languages are more flexible, hence they enhance the creativity of the
programmer and increase productivity in the workplace.
A program in high level languages is easier to debug.
Disadvantages
Their nature encourages use of many instructions in a word or statement hence the
complexity of these instructions cause slower program processing.
They have to be interpreted or compiled to binary form before the computer can execute
them.
They require large computer memory to run.
388) Write an algorithm which receives two numbers and informs the user whether their product
is positive or negative.
ANSWER:
SET a, b As Integer
start
WRITE("enter 1st number")
READ(a)
WRITE("enter 2nd number")
READ(b)
If (a * b) > 0 Then
WRITE( "The product is positive")
Else If (a * b) = 0 Then
WRITE( "the product is null")
ANSWER:
int sz=25;
int i=0,sum=0;
while(i<sz)
{
sum+=i;
i++;
}
System.out.println(sum);
Non-access modifiers do not change the accessibility of variables and methods, but they do
provide them special properties. Non-access modifiers are of 5 types,
Final
Static
Transient
Synchronized
Volatile
ANSWER:
ANSWER:
Network Subnet is logical division of the network and it is the strategy used to partition a single
physical network into more than one smaller logical sub network.
393) Writes VB.6 codes that display your entered full name on the form when the application is
loaded.
ANSWER:
class SampleSwitch {
public static void main(String args[]) {
for(int i=0; i<6; i++)
switch(i) {
case 0:
System.out.println("i is zero.");
break;
case 1:
System.out.println("i is one.");
break;
case 2:
System.out.println("i is two.");
break;
case 3:
System.out.println("i is three.");
break;
default:
ANSWER:
395) Write a java program where you declare the variables school, firstname, lastname, age,
level and combination. This program should display like this: Gs Kigali, Ange Batoni is 19 years
old and in senior 4 of LKK.
ANSWER:
package education;
public class education{
public static void main(String[] args) {
String school=”GS Kigali”, firstname = “Ange”, lastname= “Batoni”;
String level=”senior4”;
String combination=”LKK”;
int age =19;
System.out.println(school+””+firstname+” “+lastname+” “+”is”+” “+age+”years old and
in”+level+”
“+”of”+” “+combination);
}}
396) Using Visual Basic, write a program that prompts a user to enter a student’s score in
Mathematics. If the score is above 45%, the program should display “Pass” otherwise it should
display “Fail” .
ANSWER:
Private Sub Command1_Click()
Dim mark As Single
mark = Val(Text1.Text)
If (mark > 45 And mark <= 100) Then
Label3.Caption = “Pass”
ElseIf (mark <= 45 And mark >= 0)
Then
Label3.Caption = “Fail”
Else
Label3.Caption = “Invalid”
397) Write a class in C++ called person which has 2 functions: getdata() and putdata(). The
getdata() prompts the user to enter his or her first name name, last name and age, the putdata()
displays on the screen the user first name last, name and age.
ANSWER:
#include<iostream>
using namespace std;
class person
{
private:
char
fname[20],lname[20];
int age;
public:
void getdata()
{
cout<<”enter the first name, last
name and age”;
cin>>fname>>lname>>age;
}
void putdata()
{
cout<<”First
name: “<<fname<<endl;
cout<<”Last
name: “<<lname<<endl;
cout<<”age:
“<<age<<endl;
}
};
intmain()
{
person a1;
a1.getdata();
a1.putdata();
return 0;}
399) Give and explain 7 advantages and 3 disadvantages of database management system.
ANSWER:
The Database Management system (DBMS) is a referred to as a software system that is used to
store, access, manage, organize, maintain, modify and delete data from databases.
Data Independence: Data independence means that programs are isolated from changes
in the way the data are structured and stored.
Reduce data inconsistency: Actually, data redundancy and data inconsistency
interrelated. If data redundancy is controlled, then data inconsistency will also be controlled
automatically. Data inconsistency means different copies of the same data will have different
values.
Data sharing: Due to the fact that data is centralized, many different users from different
locations can share data.
Data recovery after a crash (a break down): DBMS allows recovering data after a
crash. The crash may depend on power failure or hardware failure.
Concurrent transaction control: A transaction means a collection of operations that
perform a single action in a database.
Increased Data security and safety: DBMS allows data to be highly protected against
unauthorized access.
401) Discuss common uses of laptop computer in schools and society in general.
ANSWER:
Laptop is used in:
- Education field (example: Laptops are used by teachers in preparation of teaching and learning
materials)
- Medicine field (example: Laptops are used by doctors to keep patient records)
- Business field (Electronic commerce uses Laptops for example in marketing and selling
products or good and services.)
- Accessing online services (example: National ID application at www.irembo.gov.rw)
- Entertainment field (example: Playing games and watching movies while traveling)
- Communication field (example: when you send and receive an email in a public place)
- Security field (example: Laptop can be used to fight against hackers: people who access
personal information without authorization of the owner. Notice that accessing of personal
information without permission is punishable crime).
402) Write a C++ program that calculates the area and circumference of circle.
ANSWER:
#include<iostream>
cout<<”Enter radius”<<endl;
cin>>radius;
area =radius*radius*3.14;
circumference=radius*2*3.14;
cout<<”the area is”<<area<<endl;
cout<<”the circumference is<<circumference<<endl;
return 0;
}
403) Compare the disadvantages of fiber optic cables and the advantages of twisted pair cables.
ANSWER:
ANSWER:
ANSWER:
When you use By Val passing mechanism, Visual Basic copies the value of the underlying
programming element into a local variable in the procedure. The procedure code does not have
any access to element in the calling code.
Test = 120
TestFunction Test
MsgBox(Test)
End sub
i= i+1
End Function
Output: 120
Whereas when you use By Ref passing mechanism, Visual Basic gives the procedure a direct
reference to the underlying programming element in the calling code.
Test = 120
TestFunction Test
MsgBox(Test)
End sub
i= i+1
End Function
Output: 121
(c) What is the difference between list box and combo box?
ANSWER:
List Box: is used to display a list of items where only one choice is allowed.
Combo Box: User can select / choose an item from the list or enter a value.
405) Write an algorithm that request a user to enter his/her ages. If the ages are greater than 17
years old, the program displays “you are allowed to vote” otherwise “you are too young”.
ANSWER:
Var: age as integer
Begin:
Write(" Enter your age")
Read (age)
if (age>17) then
Write (" you are allowed to vote")
Else
Write (“you are too young”)
End if
End
406) Write an algorithm that read two numbers from keyboard and inform the user if the sum
of those numbers is odd or even.
ANSWER:
End
ANSWER:
Var : n1, n2, n3 as double
Start
Write ( "Enter the first numbers: ")
Read ( n1)
Write ( "Enter the second numbers: ")
Read ( n2)
Write ( "Enter the third numbers: ")
Read ( n3)
if(n1 < n2 and n1 < n3) then
write (n1, " is the Smallest number)
else if(n2 < n1 and n2 < n3) then
write (n2, " is the Smallest number)
else if(n3 < n1 and n3 <n2) then
write (n3, " is the Smallest number)
else
write (" Invalid input ")
End if
End
408) Using a class, write a program to find the largest number in two numbers entered by the
user.
ANSWER:
#include<iostream>
Using namespace std;
Class biggest
{ private:
Int a,b;
Public:
Void input(); void display();};
Void biggest::input()
{cout<<”Enter two numbers: ”<<endl;
Cin>>a>>b;
}
Void biggest::display(){
If(a > b)
Cout<<”The biggest number is : ”<<a;
Else
Cout<<”The biggest number is : ”<<b;}
Int main (){
Biggest b;
b.input();
b.display();}
ANSWER:
Equal(=)
Not equal (?=)
Less Than(<)
Less than or equal (<=)
Greater than (>)
Greater than or equal(>=)
Between
Like
In
ANSWER:
1. Entity
2. Attribute
3. Key attribute or Primary Key
4. Relationship
5. Multi-valued attribute
410) Among 20 values given by a user, write an algorithm to display the values which are less
than their average.
ANSWER:
ANSWER:
CREATE TABLE Country(Con_Code varchar(10) PRIMARY KEY NOT NULL, Name varchar
(50) NOT NULL, Capital varchar (50));
ANSWER:
ANSWER:
ANSWER:
Select Con_Code, name Capital from Country, population where Population = (Select Max
(Population) from Population);
ANSWER:
412) Explain major types of computer software, their uses and examples.
ANSWER:
a) System software: system software coordinates the activities and functions of hardware and
software, and it controls the operations of computer hardware and provides an environment or
platform for all the other types of software to work in.
Ex: Microsoft window XP, Mac OS, Linux, Windows Vista, Ubuntu, Device drivers etc.
b) Application Software: Application software is what helps the user perform the user perform
the tasks of his/ her choice. They non essential software which are installed and run, depending
upon the requirements, in the environment provided by the system software. EX: MS Office,
Media players, Ms Access, Educational Software, Antivirus Software.
c) Programming software: is used to write, test, debug and develop other software programs
and applications.
Ex: c#,DEVC++,Compilers, IDE etc
413) Write an array program which ask user to enter ten elements and display them by using a
pointer.
ANSWER:
#include <iostream>
using namespace std;
int main()
{
int x[10];
int *ptr;
cout<<"Enter the array elements:"<<endl;
for(int e=0;e<10;e++)
ANSWER:
a) Bus topology: Bus topology is a network type in which every computer and network device is
connected to single cable. When it has exactly two endpoints, then it is called Linear Bus
topology.
b) Ring topology: It is called ring topology because it forms a ring as each computer is
connected to another computer, with the last one connected to the first. Exactly two neighbors
for each device. In a Ring topology each device is connected directly to two other devices, one
on either side of it, to form a closed loop.
c) Star topology: In this type of topology all the computers are connected to a single hub or a
switch through a cable.
d) Mesh topology: It is a point-to-point connection to other nodes or devices. All the network
nodes are connected.
e) Hybrid topology: Hybrid, as the name suggests, is mixture of two different things. Similarly,
in this type of topology that integrate two or more different topologies to form a resultant
topology which has good points (as well as weaknesses) of all the constituent basic topologies
rather than having characteristics of one specific topology.
ANSWER:
a)The Toolbox contains a set of controls that are used to place on a Form at design time thereby
creating the user interface area.
b)Form window
The form designer is the main window in the middle of the screen, in which we can design and
edit user interface
d)Project explorer
On the right side of the form design, just under the tool bar, is the Project Explorer window.
e)Properties Window
Properties are the attribute of controls. Every object has properties, for example a Pen, has its
Color, Metal Type, Ink Color, Type.
f)Menu Bar
This is where you can select actions to perform on all your project files and to access help.
g)Toolbar
It gives easy access to the menu-bar you use frequently.
415) Write an algorithm of a program that allows the user to enter(store) 24 elements in two
dimensional array
ANSWER:
BEGIN
SET a=Array[3][8] of Integer
Use variable i As integer
Use variable j As integer
WRITE “enter the array elements:”
FOR i=0 TO 2 DO
FOR j=0 TO 7 DO
READ a[i][j]
i=i+1
j=j+1
END FOR
416) Briefly explain the evolution of programming languages. In each case, identify the
generation and languages used.
ANSWER:
Evolution of programming languages:
(a) First generation – machine languages.
(b) Second generation – assembly languages.
(c) Third generation – Pascal, C, COBOL, BASIC, FOTRAN, Ada.
(d) Fourth generation – Visual Basic, Delphi Pascal, Visual COBOL etc.
(e) Fifth generation languages – PROLOG, Mercury, LISP, etc.
417) Write a C++ program using an array to find the sum and average marks obtained by 5
students.
ANSWER:
#include<iostream>
using namespace std;
int main(){
int marks[5] ,i,sum=0;
float average;
cout<<"Please enter five marks:"<<endl;
for (int i = 0; i<5; i++){
cin>>marks[i];
}
for (i = 0; i<5; i++){
sum=sum+marks[i];
}
average=sum/5;
cout<<"Sum = "<<sum<<endl;
cout<<"Averages Marks= "<<average<<endl;
return 0;
}
419) Make a flowchart to input temperature, if temperature is less than 320 then print “Below
freezing” otherwise print “Above freezing”.
ANSWER:
420) Write a VB Code for the command button to verify if the entered number is odd or even.
ANSWER:
ANSWER:
a) Data definition Language (DDL):
This part of SQL enables the creation of tables and relationship between those tables in a
database.
The most important DDL statements in SQL are:
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index
b) Data manipulation Language (DML).
This part of SQL enables to select, insert, update, and delete data in a table in a database
c) Data Control Language (DCL).
With this part of SQL it is possible to Grant or remove permissions to users in a database.
ANSWER:
a) A protocol is defined a set of rules and procedures that control communication between
computers or other network devices on a network.
423) Write Java program to allow the user to input his/her age. Then the program will show if
the person is eligible to vote or not. A person who is eligible to vote must be older than or equal
to 18 years old.
ANSWER:
import java.util.Scanner;
public class Voting {
public static void main(String[] args){
int age;
Scanner Value=new Scanner(System.in);
System.out.print("What is your age?");
age=Value.nextInt();
if(age>=18)
{
System.out.print("you are eligible to vote");
}
else
{
System.out.print("you are not eligible to vote");
}}}
424) Using switch case writes an algorithm which grades the students.
MARKS GRADES
18 and above A
from16 to18 B
From14 to16 C
from12 to14 D
from10 to12 E
Below 10 fail
ANSWER:
425) Rewrite the following code fragment so that it uses a” do….while” loop to accomplish the
same task.
int n;
Cout<<”Enter a non – negative integer :”<<endl;
cin>>n;
While(n < 0){
Cout<<”The integer you entered is negative .”<<endl;
n++;
}
ANSWER:
int n;
do{
cout<<"Enter a non - negative integer :"<<endl;
cin>>n;
if(n < 0)
cout<< " The integer you entered is negative."<<endl;
}while(n < 0);
426) With short explain give three Advantages and two Disadvantages of the Internet.
a)Advantages of Internet
E-mail: With e-mail you can send and receive instant electronic messages, which work like
writing letters.
Access Information: The search engines on the Internet can be help you to find data on any
subject that you need.
Shopping: With the Internet you do not need to leave your house and can do all your shopping
from the convenience of your home by using credit card.
Online Chat: The web can be accessed to meet new people, make new friends, as well as to stay
in touch with old friends.
Downloading different materials (items): you can download innumerable games, music ,
movies, videos , software programs and a host of other entertainment software from the Internet.
b) Disadvantages of Internet
Personal Information: If you use the Internet, your personal information such as your names,
address, etc. can be accessed by other people. If you use a credit card to shop online, then your
credit card information can also be stolen.
Pornography: There are thousands of pornographic sites on the Internet that can be easily found
and can be a detriment to letting children use the Internet.
Spamming: This refers to sending unsolicited e-mails in bulk, which serve no purpose and
unnecessarily clog up the entire system.
427) Explain objects, classes and clients? How do clients and components communicate?
ANSWER:
(a)In Object oriented approach to programming, any problem that is to be solved is divided into
objects.
(b)The set of data and the code to manipulate that data is known as a class.
The class is the plan for how to process information about a particular logically grouped data and
actions on that data.
(c)The term client may be defined as a program or a component which uses another component.
(d)The communication between the client and component is carried out through an Interface.
428) Give the meaning of the following queries (one line of explain is required).
union
ANSWER:
Aircrafts which have a capacity less than 350 passengers or localized in Nairobi.
Intersect
Intersect
ANSWER:
429) Why is a hard disk technically 80 GB but the operating system treats it as 72 GB?
ANSWER:
The computer is not exact to begin with, but it calculates the 72.72 GB’s by referencing that 1
KB equals 1024 bytes, then 1024 bytes multiplied by 1024 bytes which equals:
1,048KB or 1MB and then a gigabyte in turn equals 1,048 KB multiplied by 1,048 KB which in
turn equals 1,099.5 or 1100MB.
ANSWER:
a)Serial processing is a type of processing in which one task is completed at a time and all the
tasks are executed by the processor in a sequence. while
Parallel processing is a type of processing in which multiple tasks are completed at a time by
different processors
b)Regardless of the size and processing power, a computer can be classified according to
functions they perform. In this case, we have servers, workstations and embedded computers.
(i) A server
A server is a dedicated computer that provides hardware or software resources to other
computers on a local area network (LAN) or over the Internet
(ii) Workstation
A workstation is a name given to a computer connected to a server or network intended to be
used by one person at a time, they are commonly connected to a server.
431) Write a C++ program that allows the user to enter marks for three subjects. The program
should calculate, then display the total and mean score of the three subjects.
ANSWER:
#include <iostream>
using namespace std;
int main() {
int a, b, c, sum;
double mean;
cout <<"Enter 1st number:" << endl;
cin >> a;
cout <<"Enter 2nd number:" << endl;
cin >> b;
cout <<"Enter 3rd number:" << endl;
cin >> c;
sum = a + b+c;
mean = sum/3;
cout <<"Sum = "<< sum << endl;
cout <<"Mean = "<< sum << endl;
return 0;
}
ANSWER:
(a) Booting: The operating system is responsible for completing booting process of the
computer. Booting is starting or restarting the computer.
(b) The operating system provides an appropriate User interface: The interface enables the
user to interact with the computer software and hardware. The user interface can be Command-
line interface (CLI) or Graphical user interface (GUI). With CLI, the user interacts with OS by
typing in commands at the command prompt to perform specific tasks
(d) Memory management: The OS organizes how the primary memory is used by different
programs through partitioning.
(e) Manages user’s files: The OS manipulates how files are created, stored and retrieved using
file system
(f) Operating system controls input/output peripherals: The operating system manages
reading from the input peripheral devices and writing to all peripheral devices
(g) Operating system manages files: Operating System supervises the creation, storage,
updating and deletion of files to various storage devices e.g. hard disk, flash disk, etc.
(h) Operating system manages backup storage (secondary storage or auxiliary storage).
Operating system locates and retrieves files needed by user from backup storage and monitors
how they are used.
(i) Operating system manages security and access rights of computer users. In this case, the
operating system monitors the creation of passwords, user names or account names on a
computer. It also keeps record of who accesses the computer, the activities done and the
resources used.
(j) Operating system handles errors as they happen. When the computer is used, without user
intervention or knowledge. It can suggest to the user what to do to correct errors through error
messages.
433) Write a program that calculates the Roots of a Quadratic Equation: 2x2 +6x +4 in C++
using pointers.
ANSWER:
#include<iostream>
#include<cmath>
#include<conio.h>
using namespace std;
int main ()
{
float a=2, b=6,c=4;
float x,x1,x2,delta;
float *aptr;
float *bptr;
float *cptr;
aptr=&a;
bptr=&b;
cptr=&c;
a=*aptr;
b=*bptr;
434) Draw a flowchart that prompts for five numbers, and then calculates sum and average. The
computer should display total sum and average of the five numbers.
ANSWER:
435) (a) What were the 2 main characteristics of first generation computers?
ANSWER:
(b) Briefly, discuss how integrated circuits contributed to the development of microcomputers.
ANSWER:
Integrated circuits serve a crucial function in the history of scientific inventions and the
advancement of technology as a whole. Reducing the size of critical computing components of
varying types paved the way for the creation of a multitude of other devices. Without the
integrated circuit there might not be the slim smartphones everyone carries in their pockets, cars
might not have many of the bells and whistles that come standard in most models, and many
other technologies we consider conveniences and part of everyday life may either not exist or
look completely different.
ANSWER:
Features of C++
Portability: Programs written in C++ are portable across multiple hardware and software
platforms.
Keywords: Keywords also referred to as reserved words are words that have special
meaning in a language and can only be used for intended purpose. C++ has a large number of
reserved words such as include, main, while, for, if, else and return.
Type checking: C++ provides a rules and mechanism for checking data types before
execution starts
ANSWER:
Var A[4], x ,sum as integer
Var average as float
Begin
Sum=0
Write(“enter numbers”)
For x =0 to 3
Read(A[x])
Sum=sum+A[x ]
Average=sum/4
Write(“the sum of entered numbers is:”, sum)
Write(“the average of entered numbers is:”, average)
End
438) In real life, we need to use a computer. Describe any 7 areas where a computer can be
applied.
ANSWER:
Economics
Computers enables governments, businesses and individuals to plan, budget and tract their
revenues and expenditures. Increased computing power means that it has become possible to
perform economic analysis both at macro and micro-economic level.
Retail stores
Most retail stores use computers to help in the management of daily activities like stock control.
The stock control system keeps account of what is in stock, what is sold and what is out of stock.
The management is automatically alerted whenever a particular item or items are running out of
stock that need reordering.
Offices
Financial institutions
In the banking sector, computers and mobile devices such as cellphones can be used to withdraw
or get any service from different branches. Special cash dispensing machines called automated
teller machines (ATM’s) have enabled automation of cash deposits and withdrawal services.
Efficiency has also been increased due to better record keeping and document processing
brought about by use of computers.
Industries
Computers are being used to monitor and control industrial processes.
The computer age has seen wide use of remote-controlled devices called robots.
Health
Computers are used to keep patients’ records in order to provide easy access to a patient’s
treatment and diagnosis history. Computerized medical devices are now being used to get a cross
sectional view of the patient’s body that enables physicians to get proper diagnosis of the
affected body parts with high levels of accuracy.
Communication
Integration of computers and telecommunication facilities has made message transmission and
reception to be very fast and efficient. Because of the speed with which information can be
transmitted around the world using computers, the world is said to have become a global village.
Security
Information stored in computers such as fingerprints, images and other identification details help
law enforcers carry out criminal investigations.
Education
Computers are used in teaching and learning in schools, colleges and universities. Learning and
teaching using computers is referred to as Computer Aided Learning (CAL) and Computer
Aided Instruction (CAI).
439) Write in Visual Basic a program to find the greatest of five numbers as shown below:
lblNumber = number(0) & "," & number(1) & "," & number(2) & "," & number(3) & "," &
number(4)
lblGreatest = big
End Sub
440) A “1.44 MB” floppy disk has 80 cylinder (numbered 0 to 79); 2 heads (numbered 0 to 1)
and 18 sectors (numbered 1 to 18). Calculate its capacity in sectors.
ANSWER:
Formula:
Total Storage Capacity of a Hard Drive=Total Number of Sectors*512 bytes per sector
441) Formulate a C++ program which calculate sum of 20 float numbers received.
ANSWER:
#include<iostream>
using namespace std;
int main() {
int i;
float sum=0;
float num[20];
cout<<"enter any Twenty numbers: "<< endl;
for(i=0;i<20;i++){
cin>>num[i];}
for(i=0;i<20;i++){
sum =sum+num[i];
}
cout<<"The sum = " <<sum<< endl;
return 0;
}
442) Write a simple algorithm which will ask a user to input a value.
If the value is 1 it should display the text “The day is Monday”
If the value is 2 it should display the text “The day is Tuesday”
If the value is 3 it should display the text “The day is Wednesday”
Do the same for all days of a week.
Use the switch case statement to achieve the above
ANSWER:
Use x as integer
Start
Write “please enter number of day of week:”
Read x
Switch (x)
Case of 1:
Write “The day is Monday”
Case of 2:
Write “The day is Tuesday”
Case of 3:
Write “The day is Wednesday”
Case of 4:
Write “The day is Thursday”
Case of 5:
Write “The day is Friday”
Case of 6:
Write “The day is Saturday”
ANSWER:
a) Array a [3][8] it has three column and eight row
b)
3 11 21
10 20 22
15 14 34
12 19 38
32 18 39
17 11 33
13 25 42
27 31 45
BEGIN
SET marks=Array[3] [8] of Integer
marks[0][0]=3
marks[0][1]=10
444) Explain the difference between Peer-to-Peer network and Client-Server Network
ANSWER:
Peer to Peer (P2P) network is a type of network in which two or more computers connect
without any centralized server. Each computer in P2P behaves like a client and server. Each
computer share resources and use resources of other computers in the network.
Client-server network, the client requests information or services from the server and the server
provides the requested information or service to the client. Servers on a client-server network
commonly perform some of the processing work for client machines.
Centralization of control: Access, resources and integrity of the data are controlled by the
dedicated server so that a program or unauthorized client cannot damage the system.
Scalability: You can increase the capacity of clients and servers separately. Any element
can be increased (or enhanced) at any time, you can add new nodes to the network (clients or
servers).
Easy maintenance: Distribute the roles and responsibilities to several standalone
computers, you can replace, repair, upgrade, or even move a server, while customers will not be
affected by that change (or minimally affect).
445) Using a class, write a C++ program to find the largest number in two number entered by
the user.
ANSWER:
#include <iostream>
using namespace std;
class TwoNumbers
{
private:
int x;
int y;
public:
void input();
int largest();
void display();
};
void TwoNumbers::input()
{
cout<<"Enter two numbers: "<<endl;
cin>>x>>y;
}
int TwoNumbers::largest()
{
if(x > y)
return x;
else
return y;
}
void TwoNumbers::display()
{
cout<<"The largest number is : "<<largest()<<endl;
}
int main()
{
TwoNumbers n;
n.input();
n.display();
return 0;
}
ANSWER:
a. Relationship set
b. One to many relationship
c. Many to many relationship
d. Participation constraint
e. Weak entity set.
ANSWER:
a)Relationship set: A relationship set is a set of relationships of the same type
b)One to many relationship: An instance of one entity can relate to multiple instance of another
instance. The relationship that associates one record of entity A to more than one record of entity
B is called one-to-many relationship.
c) Many-to-many (M: M): Multiple instances of an entity can relate to multiple instances of
another entity.
Example: Many teachers can teach many students
ANSWER:
OR
449) Write a C++ program using class called Rectangle and an object called rect. This class
should have four members: two data members of type int with private access and two member
functions with public access: set_values() and area().Set_values() to initialize the values of
rectangle and area() to return the area of rectangle.
ANSWER:
#include <cstdlib>
#include <iostream>
using namespace std;
class rectangle{
int x,y;
public:
void set_values(int,int);
int area(){
int res;
res=x*y;
return(res);
}};
void rectangle::set_values(int a, int b)
{
450) Write a java Program that will asks user to enter three numbers from keyboard and it
display the sum, and average of the entered numbers. if the average is below 50 it will give the
message “Fail” otherwise “Pass”.
ANSWER:
import java.util.Scanner;
public class sumavg {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a first number: ");
int number1 = input.nextInt();
System.out.print("Enter second number: ");
int number2 = input.nextInt();
System.out.print("Enter Third number: ");
int number3 = input.nextInt();
451) With short explanations give six advantages and four disadvantages of internet.
ANSWER:
452) Develop a VB program which displays the sum of numbers ranging from 0 to 10, use
do….loop until.
ANSWER:
Private Sub Form_Load()
Form1.Show
Dim i, sum As Integer
sum = 0
i=0
Do
sum = sum + i
i=i+1
Loop Until i > 10
Print sum
End Sub
ANSWER:
#include<iostream>
int main() {
int a, b, c, product;
cin>>a>>b>>c;
product=a*b*c;
return 0;}
454) Write an algorithm and a C++ program to accept any given number and prove that the
given number is Odd or even.
ANSWER: A C ++ Program
Algorithm #include<iostream>
ANSWER:
ANSWER:
Address
Capacity
Access time
Memory circle
Debit
Volatility
Bandwidth
Access type
Physical size
Cost of Information
ANSWER:
Sequential Access: to access the information you must pass to all previous information.
Direct Access: Each information has its own address allow to locate it directly(RAM).
Semi-sequential Access: Is a combination between direct access and sequential access.
Access by Content: Each information ID identified by research key (Selective Access).
Random Access: The time to access any memory allocation is the same.
457) What are the main elements of the command unit which are used during memory searching
and instruction decoding (Research cycle)?
ANSWER:
Program counter
Timer(System lock)
Instruction decoder
ANSWER:
The implementation is free of errors. The programmer must resort to methods such as
testing to establish the corrections of a program. i.e. program error file.
The program is well documented. It is important that computer program be well
documented. Documentation exists to assist in the understanding of the uses of program. This
can be of great of value not only to those charged with maintaining or modifying a program, but
also the programmers themselves. Details particular programs or particular pieces of programs
are easily forgotten or confused without suitable documentation.
The program is maintainable. Programs require a continuing process of maintenance and
modification to keep space with changing requirements and modifiability are essential
characteristics of a real program. A program’s ability to be read and understand is important
prerequisite to its maintainability and modifiability.
The program must respect syntax.
Header file: is a file which contains all elements of that need by the program for this
execution.
Variable declaration: the variable to be used must be declared before they are used.
Comments: are explications of the program.
The functions are the principle elements that allow the execution of their instructions.
Procedures=functions
They must be correct without errors
Modular
Portability: (it must be potable) able to run very well or the big number of machine with
the different architecture.
Comprehensible: must be understood by every one.
ANSWER:
Start
fact←1 to 100
fact←fact*i
End
ANSWER:
ANSWER:
#include<iostream>
using namespace std;
int main() {
int n=100;
double factorial = 1;
for(int i = 1; i <=n; ++i) {
factorial = factorial * i;
}
cout << "Factorial of "<<n<<" = "<<factorial<<endl;
return 0;
}
OR
//If the user is requested to input a number
ANSWER:
(a) Easy Sharing of Resources: Computers are able to share various resources easily over a
network. Shared resources can be Internet, files, printer, storage and others.
(b) Performance: It is achieved by measuring the speed of data transmission with number of
network users, connectivity used and the software used. The commonly measured qualities in the
network performance are Bandwidth and Latency.
(c) Reliability: It means that computer network provides assurance of the delivery of data to the
intended recipient.
(d) Scalability: The possibility of adding new computer without affecting the network
performance.
(e) Security: computer network must be secured for the benefit of the user and data protection.
The security is achieved by protecting data from unauthorized access.
(f) Quality of Service (QoS): Quality of Service refers to the mechanism that manage congested
network traffic.
(g) Fault tolerant: A fault tolerant network limits the impact of hardware or software failure and
recovers quickly when a failure occurs
ANSWER:
Private Sub Command1_Click()
End Sub
Fact = 1
Fact = Fact * i
Next i
CalFact = Fact
End Function
ANSWER:
import java.util.Scanner;
class AreaOfRectangle
{
public static void main(String args[])
{
ANSWER:
464) Write a VB program which allow a user to Input 10 elements of an array and then displays
even and odd numbers separately.
ANSWER:
ANSWER:
1. Objects
Objects are basic runtime entities in an object system. They may represent a person, a place, a
table, of data or any item that the program must handle. Objects contain data and code to
manipulate the data.
2. Class
Class is a way to bind the data and its associated functions together. A class allows its data to be
hidden from its external use.
3. Data Encapsulation
Data Encapsulation is the wrapping up of data and functions into a single unit.
4. Inheritance
Inheritance is the process by which objects of one class acquire properties of objects of another
class.
5. Polymorphism
6. Abstraction
Abstraction refers to showing only the essential features of the application and hiding the details.
In C++, classes provide methods to the outside world to access and use the data variables, but the
variables are hidden from direct access.
TEACHER
No Names of Age Department Date of joining Salary Sex
Teacher
1 Ndahimana 36 Computer 12-Jan-99 150000 M
2 Kamili 59 Maths 4-Mar-86 250000 M
3 Neema 30 Entrepreneurship 30-Jun-12 120000 F
4 Harima 29 Geography 1 10-Apr-10 130000 F
a)To find the teacher that did not join on the date of (“1/feb/2000” , “ 4/mar/1986” , “
12/feb/1988”)
ANSWER:
ANSWER:
SELECT *FROM TEACHER WHERE DEPARTMENT=”Maths”;
c) To list the name and age of the female Teachers who are in the Geography 1 Department.
ANSWER:
SELECT NameT, age FROM TEACHER WHERE Sex=’f’ AND DEPARTMENT=
‘Geogrphy1’;
d)To list the names of all Teachers whose age is greater than 30 with their date of joining in
ascending order?
ANSWER:
SELECT NameT , DateofJoin FROM TEACHER WHERE age>’30’ ORDER BY DateofJoin;
e)To display the Names, Age and Salary for male teachers only.
ANSWER:
SELECT NameT, Salary, Age FROM TEACHER WHERE Sex=’m’;
ANSWER:
SELECT *FROM TEACHER ORDER BY NameT;
ANSWER:
ANSWER:
SELECT DISTINCT Department FROM TEACHER;
ANSWER:
467) Write a java program that allows user to enter 2 inputs through the
Keyboard and calculate the sum, average and difference, use scanner
ANSWER:
import java.util.Scanner;
class AddNumbers
{
public static void main(String args[])
{
double x, y, sum, average,difference ;
System.out.println(“Enter two numbers to calculate their sum”);
Scanner in = new Scanner(System.in);
x = in.nextInt();
y = in.nextInt();
sum = x + y;
average= (x+y)/2;
difference=x-y;
System.out.println(“Sum of the integers = “ + sum);
System.out.println(“average of the integers = “ + average);
ANSWER:
Private Sub Form_Load()
Form1.Show
Dim num As Integer
num = 0
Do While num <= 100
num = num + 1
print num
Loop
End Sub
469) According to the comparison between laptop, Smartphone, Cell phone, PDA and Tablet,
which one is most useful? Explain why.
ANSWER:
Smartphone is more useful than cell phone, PDA, Laptop and tablet because of the following
five reasons:
i. Always available: the smartphone is almost always within arm’s reach. Wherever you go it is
in your pocket.
ii. Connectivity: a smartphone has a 3G (or maybe even 4G) signal. Many smartphones can also
act as a Wi-Fi hotspot, enabling you to share the cellular data connection.
iii. Voice calls: with smartphone, you can make and receive calls from virtually anywhere.
iv. Text Messaging
Along with voice calls, smartphones also enable communication via text messaging.
v. Versatility: a smartphone can be a phone, or a camera, or a portable music player, or a GPS
device, or an e-reader, or just about anything else you need it to be.
ANSWER:
Laptop takes electricity from the battery and can use direct power source, portable
Desktops remain plugged into a power source, not portable
Laptop processors use less power, Laptop processors create less heat so
Desktop processors create great heat quantity; Desktop processors require large cooling devices
ANSWER:
471) Discuss common uses of positivo BGH laptop computer in schools and society in general.
ANSWER:
Laptop is used in:
Education field (example: Laptops are used by teachers in preparation of teaching and
learning materials, used by learners for searching information on internet)
Medicine field (example: Laptops are used by doctors to keep patient records)
Business field (Electronic commerce uses Laptops for example in marketing and selling
products or good and services.)
Accessing online services (example: National ID application at
www.irembo.gov.rw)
Entertainment field (example: Playing games and watching movies while traveling)
Communication field (example: when you send and receive an email in a public place)
Security field (example: Laptop can be used to fight against hackers: people who access
personal information without authorization of the owner. Notice that accessing of personal
information without permission is punishable crime).
ANSWER:
a. Laptop hardware maintenance is difficult comparing to a desktop computer maintenance
because Laptop components are proprietary, so you may not be able to use components made by
one laptop manufacturer to repair a laptop made by another manufacturer which makes that
technicians may have to obtain certification for each laptop manufacturer they support. Desktop
components are standardized.
b. Standalone laptop can be used for either personal or work use, Completing work,
Communication, Gaming. While
Networked laptop Connect to internet, Share resources, Share files, Share drives, Central
storage , Online gaming
473) Draw a flowchart where the user is asked to input a number and print it’s factorial
ANSWER:
ANSWER:
a.A computer network is a collection of computers connected together for the purpose of sharing
resources. The most common resources shared are connection to the internet, printer folder and file
475) Using clear examples, Distinguish Personal Area Network and Local Area Network?
ANSWER:
Personal Area Network (PAN) is a network that connects devices, such as mice, keyboards,
printers, Smartphone, and tablets within the range of an individual person. PAN has connectivity
range up to 10 meters. PAN may include wireless computer keyboard and mouse, Bluetooth
enabled headphones, wireless printers and TV remotes.
Local Area Network (LAN) traditionally, a LAN is defined as a network that covers a small
geographical area. However, the distinguishing characteristic for LANs today is that they are
typically owned by an individual, such as in a home or small business, or wholly managed by an
IT department, such as in a school or corporation. This individual or group enforces the security
and access control policies of the network.
476) Differentiate three data transmission modes in network and give example for each
ANSWER:
The data that is transmitted over the network can flow using one of three modes: simplex, half
duplex and full duplex.
Simplex: it is a single one way transmission. In a simplex transmission mode, the
communication between sender and receiver occurs only in one direction. That means only the
sender can transmit the data, and receiver can only receive the data. The receiver cannot transmit
any information back to the sender.
Example of simplex transmission is the signal that is sent from a TV station to your home TV.
Half Duplex: data flows in one direction at a time In half duplex, the channel of
communications allows alternating transmission in two directions, but not in both directions
simultaneously.
Example of Half duplex is the Talkie Walkie used by the police
Full Duplex: data flows in both directions at the same time. In a full duplex transmission mode,
the communication between sender and receiver can occur simultaneously. Sender and receiver
both can transmit and receive simultaneously at the same time.
A telephone conversation is an example of full duplex communication. Both people can talk and
be heard at the same time.
A. TV :simplex
B. Radio : simplex
C. Walkie :Talkie :half- duplex
D. Phone : Full duplex
E. Computer: Full duplex
Data on a Star network passes through the switch or concentrator before continuing to its
destination. The switch or concentrator manages and controls all functions of the network. It also
acts as a repeater for the data flow. This configuration is common with twisted pair cable;
however, it can also be used with coaxial cable or fiber optic cable.
ANSWER:
479) Define database and state five areas where databases is used
ANSWER:
A database is an organized collection of related data. It is considered to be organized because
the data is stored in categories that are accessible in a logical manner. A database is a collection
of one or more relations, where each relation is a table made of rows and columns.
ANSWER:
Using Databases to Improve Business Performance and Decision Making Businesses use their
databases to:
Keep track of basic transactions
Provide information that will help the company run the business more efficiently
Help managers and employees make better decisions
c)Discuss the concept of data independence and explain its importance in Database environment.
ANSWER:
DATA INDEPENDENCE: The ability to modify a schema definition in one level without
affecting a schema definition in the next higher level is called Data Independence. It is
independence between the programs and the data.
IMPORTANCE:
Data independence plays crucial role in database environment.
Improve performance.
Change in data structure does not require change in application program.
Hide implementation details from the users.
Allow users to concentrate on the general structure, rather than on low-level
implementation details.
ANSWER:
A pointer is a variable which contains the address in memory of another variable. There can be a
pointer to any variable type. The unary or monadic operator & gives the ``address of a variable''.
The indirection or dereference operator * gives the ``contents of an object pointed to by a pointer''.
ANSWER:
The asterisk sign (*) in the cout statements is called the dereference operator.
The ampersand sign (&) is called the reference operator. If the reference operator is used, it will
get the “address of” a variable
2. Write a c++ program using structure, facilitating user to enter and display student
identification(roll_no, student_name and age).
ANSWER:
#include <iostream>
struct student{
int roll_no;
char student_name[15];
float age;
};
student s1;
cin>>s1.roll_no;
cin>>s1.student_name;
cin>>s1.age;
ANSWER:
5. By accessing member of structure using C++ write a simple running program that will
display the output of your birthday and today date.
ANSWER:
ANSWER:
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
float a=2, b=6,c=4;
float x,x1,x2,delta;
float *aptr;
float *bptr;
float *cptr;
aptr=&a;
bptr=&b;
cptr=&c;
a=*aptr;
b=*bptr;
c=*cptr;
//calculate delta
delta=*bptr * *bptr -4 * *aptr * *cptr;
x1=(-*bptr + sqrt(delta))/(2* *aptr);
x2=(-*bptr - sqrt(delta))/(2* *aptr );
cout<<"x1="<<x1<<endl;
7. Define:
a) object
b) Polymorphism
c) Friend function
d) Class
e) Encapsulation
ANSWER:
a) Objects are basic entities in an object oriented system. They may represent a person,
a place, a table, of data or any item that the program must handle.
b) Polymorphism: means the ability to take more than one form
c) Friend Function: If a function is defined as a friend function then, the private and
protected data of a class can be accessed using the function
d) Class: this is a way of binding the data and its associated functions together.
e) Data Encapsulation is the wrapping up of data and functions into a single unit.
ANSWER:
CONSTRUCTOR DESTRUCTOR
The Same name as class The same name as class
No return type No return type
Can have parameters Cannot have parameters
No tilde sign Its name is preceded by a tilde sign
Is called when an object is created Is used to destroy an object created by a
constructor
9. List down any three advantages of Object Oriented Programming language.
ANSWER:
It facilitates to write, maintain and modify long program. It facilitates to create the
objects representing entities from real world.
The possibility of creating special functions called constructors and destructors
The possibility of overloading the operators
Program reusability
10. What are three types of access specifier? Explain each other.
Private members of a class are accessible only from other members of the same class or
from their friend classes
Protected members are accessible from members of their same class and friend classes
and also from members of their derived classes.
Public members are accessible from anywhere the class is visible
A. Single inheritance
A derived class having only one single base class
b. Multiple Inheritance
Hierarchical Inheritance
Multilevel Inheritance
12. Write a program in C++ using class called person which has 2 functions:getdata() and
putdata().The getdata()prompts the user to enter his or her name and age,putdata() displays on
screen the user name and age.
ANSWER:
#include<iostream.h>
class person
{
public:
char name[10];
int age;
void getdata();
void putdata();
};
void person::getdata()
{
cout<<”enter the your name”<<endl;
cin>>name;
cout<<”enter the your age”<<endl;
cin>>age;
}
void main(){
person p;
p.getdata();
p.putdata();
}
13. What is the concept of data hiding? What are the advantages of its applications?
ANSWER:
Encapsulation is the process of combining data and functions into a single unit called class.
Using the method of encapsulation, the programmer cannot directly access the data. Data is only
accessible through the functions present inside the class. Data encapsulation led to the important
concept of data hiding. Data hiding is the implementation details of a class that are hidden from
the user. The concept of restricted access led programmers to write specialized functions or
methods for performing the operations on hidden members of the class. Attention must be paid to
ensure that the class is designed properly.
14. Observe the figure and name the objects labeled A, B, C, D, E , F, G AND H
15. Write a VB program that requests the user to enter 2 numbers and displays their sum,
difference and product.
ANSWER:
num1 = Val(Text1.Text)
num2 = Val(Text2.Text)
Sum = num1 + num2
Difference=num1-num2
Product=num1*num2
Text3.Text = Sum
Text4.Text = Product
Text5.Text = Difference
End Sub
ANSWER:
First install Microsoft visual basic 6.0 into PC, and follow the following in order to use it.
Start>all program> Microsoft visual basic 6.0> Dialog Box > Standard EXE> form window
appear.From the New Project window we can select new, existing and recent project.
Desktop application
A desktop application is a computer program that runs locally on a computer device, such as
desktop or laptop computer, in contrast to a web application, which is delivered to a local
device over the Internet through browser from a remote server. Different user environments can
impact whether a desktop or a web application is the best solution for your needs.
Desktop applications
They must be developed for and installed on a particular operating system.
Have strict hardware requirements that must be met to ensure that they function correctly.
Updates to the applications must be applied by the user directly to their installation and may
require hardware upgrades or other changes in order to work.
A web application is any computer program that performs a specific function by using a web
browser.The user accesses the application using the web browser and works with resources
available over the internet, including storage and CPU processing power.
a)VISUAL BASIC is a high level and Event-driven Programming Language which evolved from
the earlier Desk Opening System (DOS) version called BASIC.
b)Visual basic 6.0 has the following advantages:
It is easier for the user to minimize code writing.0
The user will become more familiar with visual approach for other visual languages.
It provides Input box and Output box as interactive windows with user.
It is very easy program language compare with other.
ANSWER:
A control is a tool on the toolbox window that you place on a form to interact with the user and
control the program flow.
20. Name and give the function of labeled parts of the following toolbar
B.Label: The label is a very useful control for Visual Basic, it is used to provide
Instructions and guides to the users, and it can also be used to display outputs.
C. Check Box: The Check Box control lets the user to select or unselect an option. When the
Check Boxes checked, its value is set to 1 and when it is unchecked, the value is set to 0.
D. Combo Box: The function of the Combo Box is to present a list of items where the user can
click and select only one item from the list
E. Image Box: The Image Box is another control that handles images and pictures.
It functions almost identically to the picture box.
F. Picture Box: The Picture Box is one of the controls that used to handle graphics.
G. Text Box: is the standard control that is used to receive input from the user as well as to
display the output. It can handle string (text) and numeric.
H. Option /RadioButton: Radio Button provides the capability to make a mutually exclusive
choice among group choices.
I.List Box: A list box displays a list of items from which the user can select one or more items.
21. What are the three process of Planning and Developing a Visual Basic program
ANSWER:
Developing a VB program is mainly done in three steps namely setting up user interface,
defining the properties, and creating code.
a. Draw the interface
At this step, you will be using the object to design the interface of your application; the controls
will be taken from the tool box by dragging it from there to the form designer.
b. Set properties
At this stage, you will be setting up properties for your form and controls. Those properties are
set from the properties window.
c. Write the event code.
Coding is to be done in the code window and you get there by double clicking the object you
want to code.
22. Writes codes that display your entered full name on the form when the application is
loaded.
ANSWER:
ANSWER:
ANSWER:
25. What will be the output of this code if the user input 8.
ANSWER:
26. Write a VB procedure that reads student’s note and then displays the following grades as
shown on the figure below:
ANSWER:
27. Write a vb Code for the command button to verify if the entered number is odd or even
ANSWER:
a. Select Case format can be used when there are multiple selection possibilities.
Select case instructions are easier to write and decode than complex nested if statements.
If the “case” matches the condition is selected and all instructions within the matching case are
executed.
29. Write a vb program using while …wend to generate the sum of first 10 integers
ANSWER:
ANSWER:
31. What the following controls prefix stand for? Chk, fil,cbo,frm,txt.
ANSWER:
33. Write a VB program to calculate the values of the following arithmetic operation if the
user inputs two numbers M and N into two separate text boxes
a. M^N
b. M\N
c. M Mod N
ANSWER:
ANSWER:
Java is a computer programming language. It enables programmers to write computer
instructions using English-based commands instead of having to write in numeric codes. It is
known as a high-level language because it can be read and written easily by humans.
Advantages: Secure, portable, easy to learn, robust, dynamic, Java is fast, secure, and reliable
ANSWER:
public class ExampleProgram
{
public static void main(String[] args) {
System.out.println("Unity and Peace are the engines of development in Rwanda” and
“Rwanda is a best country");
}
}
36. Given two integer x= 55; y= 44; write a java program which is calculate and display the
sum of these two integers.
ANSWER:
package exampleprogram;
ANSWER:
Compile-time errors: occur when you violate the syntax rules of the Java language.
Run-time error: so-called because it does not appear until after the program has started running.
In Java, these errors occur while the interpreter is executing byte code and something goes
wrong. These errors are also called “exceptions” because they usually indicate that something
exceptional (and bad) has happened.
The logic error: If your program has logic error, it will compile and run without generating error
messages, but it will not do the right thing.
38. Write a program where you declare the variables firstname, lastname, age This program
should display like this: John Mugabe is 35 years old
ANSWER:
package exampleprogram;
Answer: 6
Output:
Value of x:10
Value of x:11
Value of x:12
Value of x:13
Value of x:14
Value of x:15
Value of x:16
Value of x:17
Value of x:18
Value of x:19
WHILE
Comment: A part of a program that contains information about the program, but that has no
effect when the program runs.
43. Write a Java program to print 'Hello' on screen and then print your name on a separate
line.
ANSWER:
44. Write a Java program that takes two numbers as input and display the product of two
numbers.
import java.util.Scanner;
ANSWER:
Output:
101
Uwineza
class evaluate
{
ANSWER:
Output: 1
ANSWER:
The extends is a Java keyword used in inheritance and it indicates that you are making a new
class that derives from an existing class.
ANSWER:
A default constructor is a constructor which doesn’t have any parameter and which can be called
with no arguments.
ANSWER:
{
//methods and fields
}
50. Discuss the difference between a method overloading and a method overriding in Java?
ANSWER:
Method Overloading is a feature that allows a class to have more than one method having the
same name, if their argument lists are different. While Method Overloading occurs within the
same class , Parameters must be different when we do overloading , In overloading one method
can’t hide the another
Example:
add(int, int)
add(int, int, int)
ANSWER:
System.in are connected to keyboard inputs character data input any information that is needed
by a program to complete its execution. System.out are connected to the monitor and output
character data. The output any information that the program must convey to the user.
52. List different input stream classes that can be applied to input data from user.
ANSWER:
class AreaTriangle {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the width of the Triangle:");
double base = scanner.nextDouble();
System.out.println("Enter the height of the Triangle:");
double height = scanner.nextDouble();
double area = (base* height)/2;
System.out.println("Area of Triangle is: " + area);
}
}
54. Write a java program that allows the user to enter three floats numbers and displays
them on screen
import java.util.Scanner;
import java.util.Scanner;
class youngest
{
public static void main(String[] args)
{
int karenzi,singizwa,mpore;
Scanner s=new Scanner(System.in);
System.out.println("Enter age of KARENZI: ");
karenzi=s.nextInt();
System.out.println("Enter age of SINGIZWA: ");
singizwa=s.nextInt();
System.out.println("Enter age of MPORE: ");
mpore=s.nextInt();
if (karenzi<singizwa && karenzi<mpore)
{
System.out.println("youngest is KARENZI with : "+karenzi +"age(s)");
}
else if (singizwa<karenzi && singizwa<mpore)
{
System.out.println("youngest is SINGIZWA with: "+singizwa +"age(s)");
}
else if (mpore<karenzi && mpore<singizwa)
{
System.out.println("youngest is MPORE with: "+mpore +"age(s)");
}
else
System.out.println("KARENZI, SINGIZWA and MPORE are in the same age" );
}
}
56. Write a java program to calculate area of circle
import java.util.Scanner;
class AreaOfCircle
{
public static void main(String args[])
{
Scanner s= new Scanner(System.in);
System.out.println("Enter the radius:");
double r= s.nextDouble();
57. Write a java program that allows user to enter 2 inputs through the keyboard and
calculate the sum, average and difference
import java.util.Scanner;
class AddNumbers
{
public static void main(String args[])
{
double x, y, sum, average,difference ;
System.out.println("Enter two numbers to calculate their sum");
Scanner in = new Scanner(System.in);
x = in.nextInt();
y = in.nextInt();
sum = x + y;
average= (x+y)/2;
difference=x-y;
System.out.println("Sum of the integers = " + sum);
System.out.println("average of the integers = " + average);
System.out.println("difference of the integers = " + difference);
}
}
58. Write a java program to find the roots of and quadratic equation of type ax2+bx+c.
import java.util.Scanner;
59. Write a java program which accept principle, rate and tie from the user and print the
simple interest
import java.util.Scanner;
import java.util.Scanner;
public class PositiveNegative
{
public static void main(String[] args)
{
int number;
61. Write a program to check whether the given number is even or odd
import java.util.Scanner;
import java.util.Scanner;
public class MainClass
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("How many rows you want in this pattern?");
int rows = sc.nextInt();
System.out.println("Here is your pattern....!!!");
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= i; j++)
{
System.out.print(i+" ");
}
System.out.println();
}sc.close();}}
END
1. Describe the simple measures that can be taken to protect data in the school computer lab
ANSWER:
Installing anti-virus in all computers
Protect all computers with password
Install Firewall. -Install Antivirus Software.-Install Anti-Spyware Software.
-Use Complex and Secure Passwords.-Check on the Security Settings of the Browser.
ANSWER:
a. Computer security refers to techniques developed to safeguard information and systems stored
on computers.
b. Computer security is important in the following ways:
Computer security helps to keep safely data and equipment functioning and provide
access only to appropriate people.
Computer security is important, because of keeping information protected. It’s also
important for the computer’s overall health, helping to prevent viruses and malware and helping
programs run more smoothly.
Computer and data stored can be protected from potential outside problems.
Computer security is important for helping programs to run more smoothly
Computer security is important for preventing theft of data, software, services and
equipment
3. Discuss the difference between logical and physical threats and give examples to each?
ANSWER:
Physical threats are digital storage media and hardware that can damage or destroy the computer
system.
Example: Humidity, water
While logical threats are events or attacks that remove, corrupt, deny access, or steal information.
Example: viruses and spyware
ANSWER:
A computer attack is any attempt to expose, alter, disable, destroy, steal or gain unauthorized
access to or make unauthorized use of an asset.
An active attack attempts to alter system resources or affect their operation while a
passive attack attempts to learn or make use of information from the system but does not
affect system resources
5. Explain the difference between social engineering and Shoulder Surfing techniques
ANSWER:
In computer security a social engineer is a person who is able to gain access to equipment or a
network by tricking people into providing the necessary access information
In computer security, shoulder surfing is a type of social engineer who obtain information such
as personal identification number, password and other confidential data by looking over the
owner of information.
ANSWER:
use physical equipment against fire
use metallic doors and windows against theft
use security camera, security guard and alarms to detect theft
use UPS to protect system failure and data loos due to the power failure
ANSWER:
Access control is a security technique that can be used to regulate who or what can view or use
resources in a computing environment while the Parental Controls feature is a valuable tool for
controlling the amount of time your children spend on the computer and the programs they’re
using.
9. A hard disk is connected into a broken computer system case like the one below. When
the computer is switched on, it shows that something is wrong. The user cannot work on it
properly. It is very difficult to send a document to hard disk.
Encryption is the process of encoding a message or information in such a way that only
authorized parties can access it. Simply, encryption is to transform representation so it is no
longer understandable
Decryption is the process of taking encoded or encrypted text or other data and converting it
back into text that you or the computer can read and understand.
ANSWER:
ANSWER:
a. Local Area Network (LAN) architecture is the overall design of a computers network that
interconnects computers within a limited area such as a residence, school, laboratory, university
campus of office building.
b. The LAN architecture consists of three levels: Physical, Media Access Control (MAC)
and Logical Link Control (LLC).
o The LLC provides connection management, if needed.
o The Media Access Control (MAC) is a set of rules for accessing high speed physical
links and for transferring data frames from one computer to another in a network.
The Physical level deals mainly with actual transmission and reception of bits over the
transmission medium.
ANSWER:
A LAN is made of the following main components:
o Hardware:
Computers, Network interface card (NIC) linked to physical address, Media or Cables
(Unshielded twisted pair, Coaxial cable, Optical fiber, Air for wireless)
Hub, Switches, repeaters
o Access Methods: Rules that define how a computer puts data on and takes it from the
network cable.
o Software: Programs to access and / or to manage the network.
13. Your school has classrooms, computer labs and the staff room located in three different
buildings as indicated in the figure below:
1. Students may choose between LAN, Token ring and FDDI technologies.
2. The device can be placed in any building. Students demonstrate how the wireless device to be
used can emit its signals to the whole school by indicating its coverage area. Student indicate
their choice between 2.4 GHz (~90 meters) and 5 GHz (~28 meters) wireless routers.
3. Students demonstrate their ability to choose proper network cable between Ethernet, Fast
Ethernet/100Base-T, Gigabit Ethernet/GigE and 10 Gigabit Ethernet taking into consideration
the cost and the maximum distance which cannot exceed 100 meters in our case
ANSWER:
15. Write steps How to Connect to the Internet through the Taskbar
ANSWER:
2. In the list of networks, choose the network that you want to connect to, and then select
Connect.
3. Type the security key (often called the password).
4. Follow additional instructions if there are any.
a. A network protocol defines rules and conventions for communication between network
devices. Network protocols include mechanisms for devices to identify and make connections
with each other, as well as formatting rules that specify how data is packaged into messages sent
and received.
b. Transfer electronic mail from one user to another.
File transfer over the network.
Access data on the World Wide Web
Mechanisms for devices to identify and make connections with each other, as well as formatting
rules that specify how data is packaged into messages sent and received.
c. FTP, SMTP,HTTP,POP,IMAP
17. Your school has acquired 60 computers from the Rwanda Education Board (REB) and
wishes to distribute them as follows:
Administration: 3 computers
Staff room: 7 computers
Computer lab for students in Ordinary level: 30 computers
Computer lab for students in Advanced level: 20 computers
a) List all materials needed to setup 2 wireless LANs within the school.
b) Provide specifications for your materials and equipment
c) Is it possible to secure those wireless networks?
d) Indicate the type of wireless security to be used.
ANSWER:
Two Wireless Routers, UTP cable, laptop or desktop
One Wireless Router and one Access Point, UTP cable, laptop or desktop
b) It is better to use a 2.4 GHz 802.11nstandard or 802.11ac standard wireless router / Access
Point regardless of the model because it has greater range than 5GHz routers.UTP cat6 or cat7
can be used
c) yes
18. What are the common steps in configuring both wireless routers and access points?
ANSWER:
Common steps may include but are not limited to:
Entering into the device’s configuration interface
Defining the wireless name of SSID Setting wireless security mode and password
ANSWER:
20. List seven layers in the OSI reference model and 4 layers in the TCP/IP model
ANSWER:
OSI model
Application
Presentation
Session
Transport
Network
Data Link
Physical
TCP/IP model
Application
Transport
Internet
ANSWER:
Cable testing, crimping tool, scissor, drilling machine, cable cutter, cable stripper
22. Using the color names, make a respected order while making an Ethernet cable.
568B- put the wires in the following order, from left to right;
White orange
Orange
White green
Blue
White blue
Green
White brown
Brown.
568A- put the wires in the following order, from left to right;
White green
Green
White orange
Blue
White blue
Orange
White brown
Brown.
.
ANSWER:
The network component are:
A: Modem or Broadband router
B: Ethernet cable
C: Wireless Signal
E: Linksys Wireless Router
24. What do you understand by a Wireless Access Point and Give at least 4 benefits of using
a wireless network connection?
ANSWER:
A Wireless Access Point is a specially configured node on wireless local area networks (WLAN)
which acts as a central transmitter and receiver of WLAN radio signals
Benefits of wireless network connections are:
Mobility – With a laptop computer or mobile device, access to a wireless network can be
available throughout a school, on an airplane, …
Fast setup – if your computer has a wireless adapter, locating a wireless network can be
as simple as clicking “Connect to a network”
Expandability – Adding a new computer to a wireless network is easy as turning a
computer on (as long as you do not exceed the maximum number of devices).
Cost – setting up a wireless network is not more expensive than buying and installing cables
25. What is the appropriate cable to use when you want to connect following devices?
a. PC to PC
ANSWER:
Step 1: Make sure all computers are turned off, organized and arranged.
Step 2: Install central devices (Switch or hub).
Step 3: Connect each end of the UTP CAT 6 straight through cables to connect computers to
Switch/ Hub.
Step 4: Define IP address scheme
Step 5: Configure static IP address for each computer.
Step 6: Ping each computer to verify if they are connected
Step 7: do the same as what you did on step 5 to all PCs
ANSWER:
1) Centralization
2) Proper Management
ANSWER:
ID IIE IIIA IVB VC
By using the table above, write the SQL commands to do the following
a. List the all Books records
b. What are the books that were published before 2001
c. Delete the books that were published in 1985
d. Change the edition of database to Ed2
ANSWER:
ANSWER:
SELECT * FROM BOOKS;
SELECT * FROM BOOKS WHERE Publisheddate<’2001’;
DELETE * FROM BOOKS WHERE Publisheddate=’1985’;
ANSWER:
This part of SQL enables the creation of tables and relationship between those tables in a
database. The most important DDL statements in SQL are:
32. It is common to implement database control measures to protect databases against the
loss of integrity, loss of availability and/or loss of confidentiality threats. Give and explain at
least 10 control measures that can be implemented.
ANSWER:
Access control: Refers to creating user accounts and passwords to control the login
process by the DBMS.
Inference control: The data provided to Database users should be controlled so that they
do not guess confidential information from that data if they should not see it.
Flow control: The flow control prevents information from flowing in such a way that it
reaches unauthorized users.
Data encryption: Data encryption is used to protect sensitive data (such as credit card
numbers) that is transmitted via some type of communications network. Here, data should be
encoded before it is transmitted.
Database auditing: Database auditing involves observing a database so as to be aware of
the actions of database users.
33. The table below is called Cars, observe it clearly and respond to the questions related.
Mark Plaque Series Number
BENZ R15 RLL 451212
TORD C12 RCC 421213
FUSSO CO13 RTT 421314
CARINA ES10 MAC 451315
a. What will be the output of this query on the table?
ANSWER:
SELECT Mark, Series FROM Cars order by Mark ASC;
b. Write the SQL commands to display
Plaque
R15
C12
CO13
ES10
State the output of those queries:
c. SELECT * FROM Cars WHERE Plaque =R15
d. SELECT * FROM Cars WHERE Plaque <>R15
e. SELECT * FROM Cars OREDER BY Mark ASC
a.
Mark Series
BANZ RLL
CARINA MAC
FUSSO RTT
TORD RCC
34. Group the following SQL commands (SELECT, UPDATE, REVOKE, CREATE,
DELETE, ALTER, DROP, INSERT, GRANT) according to:
a. Data Definition Language(DDL) commands,
b. Data Manipulation Language (DML) commands, and
c. Data Control Language (DCL) commands.
ANSWER:
35. Give The general format to declare a one dimensional array in vb6.0 and give an
example
ANSWER:
Dim arrayName(subs) as dataType where subs indicates the last subscript in the array.
Example
Dim StudName(10) as String
ANSWER:
37. Define function prototype and give their syntax in visual basic
ANSWER:
A function prototype is simply the declaration of a function that specifies function's name,
parameters and return type. It doesn't contain function body. A function prototype gives
information to the compiler that the function may later be used in the program.
38. Write a VB program using Input box that accept an integer value from the keyboard
displays its sinus, cosinus and tangent
ANSWER:
40. Mention when to use Function procedures and what are its characteristics?
ANSWER:
You use Function procedures when you want to execute a series of statements and return a value.
Function procedures start and end with Function and End Function statements
A function procedure may or may not take input.
Function procedures return a value by assigning the value to its name
41. Give the syntax and example of a method to add data in database connected to a VB
project using ADO.
ANSWER:
add new
Syntax: control name.recordset.Add new
Ex:Adddc1.recordset.add row
The term Front End refers to the user interface, where the user interacts with the program
through the use of the screen forms and reports.
43. Suppose you have connected your VB project to Ms_Access database, give the syntax
and example of:
a) to add a record into your database
b) to delete a record by preventing the blank record
ANSWER:
Add the ADO control on the form, perform the following steps:
1. Select the command Component in the project menu
2. Click on Controls in the dialog box which opens
3. Select
Microsoft Ado Data Controls 6.0 (OLEDB)
4. Click ok button
5. This control will be added to the toolbox.
6. To connect ADO objects on the data source use a «Connection String» and specify the
datasource (the database name you want to connect)
7. Then you have to specify the access path after clicking the connection property.
45. What are the three ways to connect to a database in visual basic?
ANSWER:
There are three ways to connect to a database: using a data link, using an ODBC data source and
connection string (that has been used in student content).
Running
ANSWER:
ANSWER:
i. Thread is the smallest unit of processing that can be performed in an Operating System. A
thread is also called a lightweight process. Threads provide a way to improve application
performance through parallelism
iii. Process control block is a data structure maintained by the Operating System for every
process. It is also called Task Control Block and it is storage for information about processes.
iv. Deadlock is a situation where a process or a set of processes are blocked, waiting for some
resource that is held by some other waiting processes. Here a group of processes are permanently
blocked as a result of each process having acquired a subset of the resources needed for its
completion and waiting for the release of the remaining resource held by other processes in the
same group. This makes it impossible for any of the processes to proceed
v. Process scheduling refers to the order in which the resources are allocated to different
processes to be executed. Process scheduling is done by the process manager by removing
running processes from the CPU and selects another process on the basis of a particular strategy
48. Consider the following set of processes with their arrival time and CPU burst time in
milliseconds.
Process CPU Burst Time (ms) Arrival time
ANSWER:
Wait Time
Process
A 0
B 24
C 27
ANSWER:
The major difference between a program and a process is that a program is a set of instructions
to perform a designated task whereas the process is a program in execution.
A program is in the secondary storage. A process is loaded into the main memory.
A program consists of a set of instructions in a programming
ANSWER:
51. What are the five major activities of an operating system in regard to process
management?
ANSWER:
52. List and explain five file operations in file management system
ANSWER:
ANSWER:
a) Ordinary Files or Regular File
Therefore, all files created by a user are Ordinary Files and belong to any type of application
program.
Ordinary Files are used for storing the information about the user Programs
Example: Notepad, Paint, C Program, Songs, Database, Image
b) Directory files
There are files stored into the particular directory or folder.
Example: a folder named songs which contains many songs.
c) Special Files
The special files are files which are not created by the user and are files needed to run a System
and are created by the Operating System. It means all the files of an operating system are
referred as special files.
ANSWER:
There are 3 ways to access files: Sequential access, Direct Access and Index Access
ANSWER:
File space allocation is the method by which data is apportioned physical storage space in the
operating system.
ANSWER:
A file management program is a tool for organizing files into folders on your computer, as well
as locating, moving, opening and copying existing files.
ANSWER:
The OS allows you to organize the contents of your computer in a hierarchical structure of
directories that includes files, folders, libraries, and drives. Windows Explorer helps you manage
your files and folders by showing the location and contents of every drive, folder, and file on
your computer
58. What are the principle problems to be handled by the operating system’s memory
management?
ANSWER:
To provide the memory space to enable several processes to be executed at the same
time.
To provide a satisfactory level of performance (process execution speed) for the system
users.
To protect each process from each other.
Where desired, to enable sharing of memory space between processes.
ANSWER:
A page is a fixed subdivision of a process. This division is done according to the fixed size. A
segment is a variable subdivision of a process. The size reflects the logical structure of a process.
ANSWER:
Virtual memory is a memory created by the operating system when swapping processes
between the space on the secondary memory and the main memory.
61. Briefly, give the difference between fixed partition and variable partition?
ANSWER:
Fixed partition is a process of dividing a memory into fixed blocks which cannot
be changed.
Variable partition is a process of dividing a memory into variable blocks which
can be changed according to the size of the process.
ANSWER:
Capacity
Type (Primary: RAM, registers, cache memory. Secondary: Hard disk, CD,DVD,
memory card, etc)
Speed (Read/Write)
Form (depends on manufacturer)
Non-volatility
ANSWER:
The term memory refers to the amount of RAM installed in the computer whereas the term
storage refer to the capacity of the computer’s hard disk. Computers have two kinds of storage:
temporary and permanent. A computer’s memory is used for temporary storage, while a
computer’s hard drive is used for permanent storage.
64. Explain the following policies: best fit policy, first fit policy, and worst fit policy
ANSWER:
Best fit policy: an incoming process is placed in a hole in which it fits mostly ‘tightly’
ANSWER:
In reality, all processes are not of same size but they are of different size. With this scheme,
small process will occupy some partition and a lot of space in this partition will be wasted,
because in one partition only one program (process) can be loaded. This wastage is called
“Internal fragmentation”. Sometimes some programs occupy some memory area, after their
completion; they release this area. But if these released areas are far (non-contiguous), a big
program cannot be loaded in memory. This problem is called “External Fragmentation”.
134) Write a VB program using Input box that accepts an integer value from the keyboard
displays its sinus, cosinus and tangent.
ANSWER:
135) You are given a flat database named “Library”, with a relation Book (ISBN (Text, primary
key), title (text), author (text), pages (integer), and price (integer)).
i.Create this database and relation, then insert at least five records.
ANSWER:
Create database Library;
Use Library;
Create Table Book(ISBN Text(50), title text(20) , author text(20), pages int(20), price int(20),
primary key(ISBN)) ;
Insert into Book values (………..);
ii. Retrieve the amount to get when all books are sold.
ANSWER:
ANSWER:
Select Title, max (Price) as Most_Expensive from Book;
vii. Reverse the name of the author who wrote the book “Imigenzo”.
ANSWER:
Select Author, reverse(Author) as Reversed_Name from Book where Title=’ Imigenzo’
Select strcmp(‘Aloys’,’Alex’);
ANSWER:
There are primarily four qualities that make Java Collections Framework extremely useful for
the programmers.
Performance – Collection classes are highly efficient data structures to improve speed
and accuracy.
Reusability – Collection classes can intermix with other types to promote reusability.
Maintainability – Supports consistency and interoperability in the implementation and
hence makes the code easy to maintain.
Extensibility – Allows customization of primitive collection types as per developer’s
requirements.
67. A tree is a connected simple path without cycles. The traversal is the process of visiting
all the nodes in the tree. Since the tree is non-linear data structure, there is no unique traversal.
Consider this traversal visits nodes by levels, from top to bottom left right:
Visiting a Tree:
Pre-order: 8, 5, 9, 7, 1, 12, 2, 4, 11, 3
In=order: 9, 5, 1, 7, 2, 12, 8, 4, 3, 11
Post-order: 9, 1, 2, 12, 7, 5, 3, 11, 4, 8
Level-order: 8, 5, 4, 9, 7, 11, 1, 12, 3, 2
68. a. What interface represents a collection that does not allow duplicate elements?
ANSWER: Set
b.What interface represents a double-ended queue?
ANSWER: Deque
ANSWER: Queue
ANSWER: Map
482) Write a pseudocode that takes length and width of a rectangle, then calculates its area and
perimeter.
ANSWER:
BEGIN
PRINT Enter length of rectangle
READ length;
PRINT Enter width of rectangle
READ width;
Area = length x width
Perimeter = 2 x (length + width)
PRINT area, perimeter
END
483) Neema deposited FRW 200,000 in his savings account. The amount deposited earns a 3%
annual interest. Design an algorithm that would be used to calculate interest after n years.
ANSWER:
484) Write an algorithm to accept any given number and prove that the given number is Odd or
Even.
ANSWER:
Var number as integer
Start
Write(“ Enter any number”)
Read number
ANSWER:
Var number1, number2, product as integer
Read(number1, number2)
Product=number1*number2
If(product>0)then
Else
End if
End
486) Write a VB program that requests the user to enter 2 numbers and displays their sum,
difference and product.
Answer:
num2 = Val(Text2.Text)
Sum = num1 + num2
Difference=num1-num2
Product=num1*num2
Text3.Text = Sum
Text4.Text = Product
*
* *
* * *
* * * *
* * * * *
* * * * * *
ANSWER:
#include <iostream>
using namespace std;
int main()
{
int rows=6;
488) Write an algorithm and and a C++ program to accept any given number and prove that the
given number is odd or even.
ANSWER:
An algorithm
Variable a as integer
Start
Write(“Enter any number “)
Read
If(a mod2 ==0) then
Write(“ a is even”)
Else
Write (“a is odd”)
End if
C++ program
# include<iostream>
Using namespace std;
Int main () {
Int x;
Cout<< “ Enter any number”<<endl;
Cin>>x;
If(x%2==0){
Cout<<x<<” : is even ”<<endl;}
Else{
Cout<<x<<” : is Odd”<<endl;}
Return 0;
}
489) Write an algorithm which receives a number and informs the user whether the given
number is Positive or Negative.
ANSWER:
Var number as integer
Start
Write(“ Enter any number”)
Read number
If(number mod 2=0) then
Write(“the given number is even”)
Else
Write(“the given number is odd”)
End if
End
490) Write a C++ program that decreases the numbers from 100 to 1 number and when it
reaches to number 67 it skips that iteration, using a while loop.
ANSWER:
#include<iostream>
using namespace std;
int main (){
int number;
for(number=100; number > = 1; number--){
if (number==67) continue;
492) Write a C++ program that would be used to display odd integers between 1 and 200.
ANSWERS:
ANSWER: ANSWER:
#include <iostream> #include <iostream>
using namespace std; using namespace std;
int main () { int main () {
int number ;
for (int count=1; count<=200;
number=1;
count=count+2 ) { while (number <= 200) {
cout << count << " , "; if(number%2 !=0)
} cout <<number <<endl;
returnQUESTIONS
0;} AND ANSWERS OF COMPUTER SCIENCE number ++; 235
}
return 0; }
ANSWER:
ANSWER: #include<iostream>
#include <iostream> using namespace std;
using namespace std; int main () {
int main () { int number ;
int number ; number=1;
number=1; do {
while (number <= 200) { cout <<number <<endl;
cout <<number <<endl; number = number + 2;
number = number + 2; }while (number <= 200);
} return 0;
return 0; } }
493) Write a C++ program that asks the user to input the radius of the circle and displays its
Area and Circumference, Using Const double PI=3.14.
ANSWER:
#include<iostream>
using namespace std;
int main () {
const double PI = 3.14;
double radius, area, circumference;
cout << "Enter the radius of Circle:"<<endl;
cin >> radius;
circumference= (2 * radius )* PI;
area = (radius * radius )* PI;
cout <<"Circumference = "<<circumference<< endl;
cout << "Area = "<<area<< endl;
return 0;}
ANSWER:
495) Write a C ++ program that prompts a user to enter the radius of a sphere, the program then
calculates the surface area and volume of the sphere. In the source code, you must declare Pi as a
symbolic constant whose value is 3.142.
ANSWER:
#include<iostream>
using namespace std;
int main(){
const double pi = 3.142;
double radius, volume, area;
cout << "Please enter the radius of sphere" << endl;
cin >> radius;
volume = ((4.0 / 3.0) * pi * radius*radius*radius);
area = 4.0 * pi * radius*radius;
cout << "The volume area is: "<< volume << endl;
cout << "The surface area is: "<< area << endl;
return 0;
}
OR
496) Write an algorithm that asks the user to enter two numbers and it displays the product of
those numbers if it is null, negative or positive.
ANSWER:
Var a:integer
Var:integer
Start
Write(“Enter The First Number”)
Read(a)
Write(“Enter The Second Number”)
Read(b)
If(a < 0 and b > 0)
Write(“The Product is Negative”)
Else If (a< 0 and b=0)
Write(“The Product is Null”)
Else If (a< 0 and b < 0)
Write(“The Product is Positive”)
Else If (a > 0 and b > 0)
Write(“The Product is Positive”)
Else If (a = 0 and b = 0)
Write(“The Product is Null”)
End if end
OR
Advantages
High level languages are portable i.e. they are transferable from one computer to another.
High level languages are user friendly and easy to use and learn.
High level languages are more flexible, hence they enhance the creativity of the
programmer and increase productivity in the workplace.
A program in high level languages is easier to debug.
Disadvantages
Their nature encourages use of many instructions in a word or statement hence the
complexitof these instructions cause slower program processing.
They have to be interpreted or compiled to binary form before the computer can execute
them.
They require large computer memory to run.
498) Using pow () Function, write a C++ program to compute the power of a given number.
ANSWER:
#include<iostream>
#include<cmath>
int main()
{
double base, ThePower, result;
cout<<"The Power of entered number: "<< base << "^" << ThePower << " = " << result;
return 0;}
#include <iostream>
using namespace std;
int main() {
int n;
return 0;
}
500) Write a C++ program that calculates and displays alternative roots of a quadratic equation:
root = ax2 + bx + c.
ANSWER:
#include <iostream>
#include <cmath>
using namespace std;
int main() {
double a, b, c;
double x1, x2, delta;
cout<< "Enter the coefficient: a"<<endl;
cin >> a;
cout<< "Enter the coefficient: b "<<endl;
cin>> b;
cout<< "Enter the coefficient: c "<<endl;
cin>> c;
if (delta == 0) {
cout<<"The delta is " << delta <<endl;
cout <<"x1=x2 :"<<x1<<endl;
}
else if (delta > 0) {
cout<<"The delta is " << delta <<endl;
cout<<"x1 = "<< x1<<endl;
cout<<"x2 = "<< x2<<endl;
501) Write a C++ program that uses an array to find the sum and average marks obtained by 20
students.
ANSWER:
#include<iostream>
using namespace std;
int main(){
int marks[20] ,i, sum=0;
float average;
cout<<"Please enter Twenty marks:"<<endl;
for (int i = 0; i < 20; i++){
cin>>marks[i];
}
for (i = 0; i < 20; i++){
sum=sum+marks[i];
}
average=sum/20;
cout<<"Sum = "<<sum<<endl;
cout<<"Averages Marks= "<<average<<endl;
return 0;}
502) Write a function program named “multiplying ()” in C ++ programming language to get
the product of two numbers entered by a user.
ANSWER:
#include<iostream>
using namespace std;
int x, y, product;
cout<<"Please enter the first number:"<<endl;
cin>>x;
ANSWER:
504) Write a C++ program that prompts the user to input a positive integer and calculate, then
display the Factorial of that given number.
ANSWER:
When you run the program, you should be able to see the interface as shown in. If you enter a
value each in the radius box and the height box, then click Calculate; the value of the volume
will be displayed in the volume box.
ANSWER:
Const Pi As Double = 22 / 7
radius = Val(Text1.Text)
height = Val(Text2.Text)
Text3.Text = volume
End Sub
TEACHER
No Names of Age Department Date of joining Salary Sex
Teacher
1 Ndahimana 36 Computer 12-Jan-99 150000 M
2 Kamili 59 Maths 4-Mar-86 250000 M
3 Neema 30 Entrepreneurship 30-Jun-12 120000 F
4 Harima 29 Geography 1 10-Apr-10 130000 F
5 Kasiimu 43 Geography 2 12-Feb-88 200000 M
6 Nzabandora 32 Physics 1-Feb-00 230000 M
7 Ruterana 45 Kinyarwanda 12-Aug-85 240000 M
8 Shakilla 29 Maths 13-Jul-12 150000 F
9 Jackline 31 Geography 1 12-Jan-11 120000 F
10 Jack 40 Physics 11-Sep-99 200000 M
11 Mutessa 28 Computer 9-Nov-14 120000 M
a) To find the teacher that did not join on the date of (“1/feb/2000” , “ 4/mar/1986” , “
12/feb/1988”)
ANSWER:
ANSWER:
c) To list the name and age of the female Teachers who are in the Geography 1 Department.
ANSWER:
d)To list the names of all Teachers whose age is greater than 30 with their date of joining in
ascending order?
ANSWER:
e)To display the Names, Age and Salary for male teachers only.
ANSWER:
ANSWER:
ANSWER:
ANSWER:
a. Window 8
b. Ms word, Kaspersky, ms excel2016, photoshop, ms access 2016
c. Ms Word
d. Ms Access
e. Ms Excel
f. Ms Word, Ms Excel, Ms Access
g. Photoshop
h) Kaspersky
i) Windows 8: It is an Operating System, if is not installed firstly, that new computer cannot
work.