SEE COMPUTER SCIENCE FINAL REVISION 2081 - LAST HOUR REVISION 2081– DEEPAK SHRESTHA
What is web browser?
Web browser is a
computer program that access web pages and displays them on the user’s computer.
Mention any two services provided by Internet.
Any two services provided by Internet are E-Commerce and
E-Mail
What is search engine?
A search engine is an online tool that helps
users find information on the internet using keywords or phrases and provide
relevant results.
Write the name of any two search engines.
The name of any two search engines is google and bing.
What is Ecommerce?
E-commerce
refers to the buying and selling of goods and services over the internet.
What is the business done through internet?
The business done through internet is
e-commerce.
What is the business done through the mobile?
The business done through the mobile is M-Commerce
What is unguided media?
Unguided media is
a communication channel in which data and information are transferred through
the air using electromagnetic waves, such as radio waves or microwaves without
using wire or cable.
Give the name of
any two unguided transmission media
Any two unguided
transmission media are Microwave and Radio wave.
What is network protocol?
A set of rules
followed for interconnection and communication between computers in a network
is called network protocol.
What is social media?
Social media refers to online platforms like Facebook and
Instagram that allow people to connect, share
information, and interact with each other.
Write any two
benefits of e-governance service.
Any two benefits
of e-governance service are:
· Citizens can access government services
and information conveniently from anywhere.
· E-governance systems promote transparency
by making government actions and decisions visible to the public.
Which data type is used
to store alpha numeric characters or special symbols in MS-Access?
The text data type is used to store alpha
numeric characters or special symbols in MS-Access.
What is the default size of text field in MS-Access?
The default size of a text field is
50 characters (2003 version) and 255 characters (2007 version) in MS-Access.
What is the default extension of MS-Access?
The default extension of Ms-Access is : .mdb (2003 version)
and .accdb (2007 version).
Which data type is used to store date of birth in MS-Access?
Date/Time is the data type is used to store date of birth in
MS-Access
Which data type is suitable to store photographs of students
in MS-Access?
The suitable data type to store photographs of students in
MS-Access is OLE object.
Which in the logical data type of MS-Access?
Ans: The logical data type of MS-Access is Yes/No.
What is the
maximum length of the field name in MS-Access?
Ans: The maximum
length of the field name in MS-Access is 64 characters.
Write any two elements of database.
Field and Record are the two elements of database
Which view is used to modify a table structure in MS-Access?
Design View is used to modify a table structure in
MS-Access.
Which type of
query do you use to calculate the total marks of students from table in MS
Access?
Select Query is
used to calculate the total marks of students from table in MS Access
Which object of MS-Access is used to retrieve data from the
table?
Query is used to retrieve data from a table.
What is modular programming?
Modular programming is a technique used to
divide program into many small, manageable, logical and functional modules or
blocks.
Write any one advantage of Modular Programming.
Ans: Any one advantage of Modular Programming is it is easy
to design, code and test the program modules independently.
List the different
types of procedures in Qbasic.
The different
types of procedures are: Sub Procedure and Function Procedure
Which statement is used to call sub-procedure?
CALL statement is used to call sub-procedure.
What is looping?
Looping
is the process of repeating the execution of a statement or a block of
statements until a specific condition is satisfied.
Write any two features of C language.
Any two features of C language are:
· Portability:
C code can be compiled and executed on different systems with minimal
modifications.
· C is
a case-sensitive programming language. It understands the capital alphabets and
small alphabets as different values
Mention any two basic data types of C language.
Ans: Any two basic data types of C language are char and int
Which format
specifier do you use in C language for 'int' data type ?
Ans: %d format
specifier is used in C language for 'int' data type.
Write appropriate technical terms for the
following: [2×1=2]
Law that governs the legal issues of cyberspace. Cyber
Law
The smallest unit to represent information on a
quantum computer Qubit (Quantum bit)
Digital trails
created while using internet. Digital Footprint
Data transmission
in only one direction. Simplex Mode
A secret group of characters used to protect computer system
from unauthorized users. Password
An artificial environment created by a computer system that
appears real. Virtual reality
A program that can disinfect a file from virus. Antivirus
software
Computer program that protects computer from computer
virus. Antivirus software
Learning through the electronic media. E-Learning
A system of copying data and information reading in computer
into another location. Backup
A company which provides services of Internet. Internet
Service Provider (ISP)
Network of Networks. Internet
STP: Shielded Twisted Pair
WAP: Wireless Application Protocol
NIC – Network
Interface Card
OTP – One Time
Password
URL – Uniform Resource Locator
G2G – Government to Government
ISP – Internet Service Provider
POP – Post Office Protocol
IoT – Internet of Things
FTP: File Transfer Protocol
MAN: Metropolitan Area Network
AI: Artificial Intelligence
What is computer
network? Enlist any two advantages of it.
Computer network is a
group of two or more computers and devices connected to each other through
wired or wireless media to exchange data and information and share hardware,
software and other resources.
Any two advantages of
computer network are:
· A
network connected computers can share hardware devices such as scanner,
printer, hard disk, etc.
· It
also provides the facility of data and software backup system.
Define
Bus topology? Write any two advantages of Bus topology
Ans:
The type of topology in which all nodes and network devices are connected to
single cable is called bus topology.
Any
two advantages of Bus topology are:
l It is cost
effective and cable required is least compared to other network topology.
l It is used in
small networks and easy to expand networks.
Define network topology. Sketch a
drawing of star topology.
Network
topology refers to the layout or inter - connected pattern of computers and
devices in a network.
What is network topology? List any
two types of network topology.
Ans: Network topology refers to the
layout or inter - connected pattern of computers and devices in a network. Two types are
star topology and bus topology.
What is computer ethics?
Write any two of them.
Computer ethics is a set
of moral principles or code of conducts that regulate the use of computers
systematically without making harm to other users.
Any two cyber ethics
are:
· Do
not use a computer to publish fake information.
· Do
not search the file or record of other people.
Write any four commandments of
computer ethics.
·
Do not use a computer to publish
fake information.
·
Do not search the file or record of
other people.
·
Do not destroy or delete the records
of other people.
·
Do not use a computer to steal
someone's privacy.
What
is social media? Write any one reason why it is popular now days.
Social media are online
platforms like Facebook, Twitter, and Instagram that let users create, share,
and interact with content while connecting with others.
It's popular now a days
because it enables instant communication, allowing people to connect and share
information globally in real-time.
Write any two advantages and
disadvantages of social media.
Ans: Any two advantages of social
media are:
1.
It
creates awareness and innovate the way people live.
2.
Social
media let us share anything with others around the world.
Any two disadvantages of social
media are:
1.
Personal
data and privacy can be easily hacked and shared on the internet.
2.
More
chances of creating fake accounts.
Define software security. Write any
two protection measures for it.
Ans: Software
security means protecting software from
being hacked or misused which ensures the software works properly and keeps
data safe.
Any two protection measures for
software security are: Backup
and Password
What is computer security? Write any
two hardware security measures.
Ans: Computer security refers to the
protection of computer systems and data from unauthorized access, theft or
misuse and damage and action to prevent such incidents.
Any two hardware security measures
are Insurance and Power Protection Device.
What
is Backup? How it helps to secure data?
Backup is the system of copying data and programs into
another location or creating a duplicate copy of it in a secured place.
A
backup secures data by creating a duplicate copy stored separately from the
original, protecting against data loss due to hardware failure, accidental
deletion, cyber threats, and disasters. It ensures data can be restored if the
original is compromised, maintaining data integrity and availability for
recovery.
What is password? Write any two
importance of password protection.
Any two importance of password
protection are:
1.
Password
secures the data by protecting from unauthorized access.
2.
It
safeguards personal information from being stolen or misused.
What are the computer security
threats? Mention any two measures to protect from security threats.
Computer security threat is a risk
which can potentially harm computer systems and organization.
Any two measures to protect from
security threats are: Firewall and Cryptography
What is antivirus software? Name any
two popular antivirus software.
Antivirus software is a program that
scans, detects, and removes malicious software from a computer or device to
protect it from security threats.
Any two popular antivirus software are Kaspersky and Norton
Antivirus.
Write ant two symptoms of computer
virus.
Any symptoms of computer virus are:
· Program takes
long time to load.
· Increased use of
disk space and growth in file size.
Define cyber law and cyber crime.
the law which governs the legal issues in
the cyber space regarding the internet or WWW for digital data processing and
transaction is called cyber law.
Cyber
crime refers to criminal activities that are carried out using computers or the
internet.
List any two E-commerce companies in
Nepal.
Any two E-commerce companies in
Nepal are sastodeal and daraz
Define e-commerce. Write any two
benefits of it.
Ans: E-commerce
is the buying and selling of goods and services over the internet.
Any two benefits of e-commerce are:
1.
Faster
buying/selling procedure, as well as easy to find products.
2.
There
are no geographical limitations, can deliver service globally.
What is M-Commerce?
Write any two important services.
M-commerce (Mobile
Commerce) refers to buying, selling, and conducting business transactions
through mobile devices like smartphones and tablets.
Any two important
services are: mobile banking and mobile shopping.
Give two differences between
E-commerce and Traditional Commerce.
Two differences between E-commerce
and Traditional Commerce are
Traditional Commerce |
E-commerce |
Traditional commerce is the buying
and selling of goods and services through physical stores and in-person
transactions, without using digital technology. |
Ecommerce
refers to the buying and selling of goods or services using the internet. |
Delivery of goods is instant. |
Delivery of goods takes
time. |
What is IoT? Write any
two importance of it.
IoT (Internet of
Things) refers to a network of interconnected devices that communicate and
share data over the internet.
Any two importance of
IoT are:
· Information
is easily accessible from any place at any time on any device.
· Tasks
can be performed automatically without human intervention.
Define Artificial Intelligence with
examples.
Artificial
Intelligence (AI) refers to the simulation of human intelligence in machines
that are programmed to think and learn like humans.
Examples are self driving cars,
speech recognition (Siri) , face recognition etc.
Write any two uses of AI.
Any two uses of AI are
· AI
can be used to detect fraud in financial transactions, such as credit card
fraud.
· AI
can be used to diagnose diseases more accurately and efficiently than humans
can.
Define virtual reality. Write any
two areas where virtual reality is used.
Virtual Reality (VR)
is a technology that creates a simulated (virtual) world where users can feel
and interact with things as if they are real, using devices like VR headsets
and gloves.
Any two areas where virtual reality is used are : Gaming and
Education & Training (medical or flight training).
What is database? Give
any two examples.
A collection of
systematically organized inter-related data which store, organize and retrieve
data is called a database. E.g. Dictionary and Telephone Directory.
Define
DBMS with any two examples of it.
DBMS
is a computerized system that stores data, processes them and provides
information in an organized form.
Any
two examples of DBMS are : MS-Access and Oracle
Write four objects of MS-Access.
Any four objects of MS-Access are
Table, Form, Query and Report.
Write any two advantages of DBMS.
Any two advantages of DBMS are:
1.
It
reduces data redundancy which means duplication of data.
2.
Large
volume of data can be stored and updated easily.
List any four features of MS-Access.
· It provides the flexible ways to add, edit, delete and
display the related data.
· Queries help to view, change and analyse the data
indifferent ways.
· Forms are used for viewing and editing the information.
· Reports are used for summarizing and printing the data.
What is primary key?
List any two advantages of it.
A primary key is a
unique field in a database table that identifies each record uniquely.
Any two advantages of
primary key are:
· It
sets the relationship between tables.
· It
reduces and controls duplication of record in a table
What is data sorting?
List any two advantages of using it.
The process of arranging
all the records in a table either ascending or descending order based on field
or fields is known as sorting.
Any two advantages of
sorting are:
· Sorting
helps to organize data and make it easier to find and retrieve specific
information.
· Sorting
can save time and improve efficiency by allowing users to quickly access the
data they need.
What type of work is
done in MS-Access using form and query object.
· Form
provides graphical interface to view, modify and add data in a table or
multiple linked tables.
· Query
is used to view, retrieve, change and analyze records from a table or multiple
linked tables based on specified condition.
What
is query? List two types of it.
Query
is an object of database that is used to view, retrieve, change and analyze
records from a table or multiple linked tables based on specified condition.
The
types of query are: Select Query and Action Query (Update query, Delete query,
Append query and Make Table query)
Define
report and mention any two uses of it.
Report
is one of the MS-Access database objects used to present information in an
effective and organized format that is ready for printing.
Any
two uses of report are:
· Reports provide a formatted presentation of data that is
easy to read and understand.
· Reports enable users to summarize, analyze, and visualize
data in meaningful ways.
Mention the importance of report in
database.
Importance of report is to print
documents according to user’s specifications of the summarized information
through query or table.
Give the differences
between the Select Query and Action Query.
Select Query |
Action Query |
Select query is simply used to
select and display the relevant data from the database. |
An action query is a query that
makes changes to or removes many records in just one operation. |
It does not make change to
database. |
It makes change to database. |
Identify a record and field from the
following table structure:
Symbol No. |
Name |
Marks |
00100202S |
Aarambha Shrestha |
91 |
00100203T |
Suhisha Rayamajhi |
99 |
Field = Symbol No. , Name and Marks
Record 1 = 001002020S, Aarambha
Shrestha, 91
Record 2 = 00100203T, Suhisha
Rayamajhi, 99
List the field name from the
following table structure.
Symbol No. |
Name |
Marks |
00100200Q |
Surya Gurung |
85 |
00100201R |
Birendra Sharma |
91 |
Ans: The
field names are Symbol No., Name and Marks.
What are validation text and
validation rule?
Validation
Text is a field property which displays an error message that appears if the
data entered is invalid according to the specified validation rule.
Validation
Rule is a field property which is used to limit the values that can be entered
into a field.
What is form? Write any two
advantages of it.
Form
is one of the MS-Access database objects which provides graphical interface to
view, modify and add data in a table or multiple linked tables.
Any two advantages of form are:
1.
Form
displays complete record one at a time, so we can view and modify records using
the form.
2.
Forms
provides GUI (Graphical Users Interface) using which users interact with
MS-Access database.
Why is primary key necessary in
record?
A primary key is necessary in a
database record because it reduce and control duplication of the record in a
table, sets the relationship between tables and identifies each record of a
table uniquely.
Define field and record.
A
field is a column in a table which contains information about a certain type
for all records. Field is a smallest unit of information.
A
record is a row in a table which contains information about single items in a
database. Record is complete set of information.
5. Write the output of the given
program: Show with dry run in
table. [2]
DECLARE SUB SHOW(A)
CLS
N=87
CALL SHOW(N)
END
SUB SHOW(A)
DO
B=A MOD 6+3
IF B MOD 4=0 THEN GOTO AA
PRINT B;
AA:
A=A-10
LOOP WHILE A>=50
END SUB
Dry run table
N |
A |
B =A MOD 6+3 |
B MOD 4=0 |
PRINT B; |
A=A-10 |
|
87 |
87 |
87 MOD 6 + 3=6 3+3=6 |
6 MOD 4=0 2=0 NO |
6 |
87-10=77 |
77>=50 yes |
|
77 |
77 MOD 6 + 3 =8 5+3=8 |
8 MOD 4=0 0=0YES |
|
77-10=67 |
67>=50 yes |
|
67 |
67 MOD 6 + 3=4 1+3=4 |
4 MOD 4=0 0=0 YES |
|
67-10=57 |
57>=50 yes |
|
57 |
57 MOD 6 + 3=6 3+3=6 |
6 MOD 4=0 2=0 NO |
6 |
57-10=47 |
47>=50 no |
|
47 |
|
|
|
|
|
The output of a program is:
6 6
5. Write down the
output of the given program and show them in dry run table.
DECLARE FUNCTION
Series (N)
CLS
A=2
PRINT "Sum of
the series"; Series (A)
END
FUNCTION Series
(N)
Sum=0
FOR J = 1 TO 4
Sum=Sum + N
N=N+3
NEXT J
Series= Sum
END FUNCTION
Dry Run
A |
PRINT "Sum of the
series"; Series (A) |
N |
Sum |
FOR J = 1 TO 4 |
Sum=Sum + N |
N-N+3 |
Series = Sum |
2 |
Sum of the series 26 |
2 |
0 |
1 TO 4 Yes |
0+2=2 |
2+3=5 |
|
|
|
5 |
2 |
2 TO 4 Yes |
2+5=7 |
5+3=8 |
|
|
|
8 |
7 |
3 TO 4 Yes |
7+8=15 |
8+3=11 |
|
|
|
11 |
15 |
4 To 4 Yes |
15+11=26 |
11+3-=14 |
|
|
|
14 |
26 |
5 To 4 No Loop Exits |
|
|
26 |
The output of the
program is:
Sum of the series
26
5. Write down the output of the given program and
show them in dry run table:
DECLARE FUNCTION SQN (N)
CLS
S=0
FOR L=1 TO 3
READ NUM
S=S+SQN (NUM)
NEXT L
PRINT "Sum of square"; S
DATA 1, 4, 5
END
FUNCTION SQN (N)
SQN = N^2
END FUNCTION
Dry Run
S |
L=1 TO 3 |
Read Num |
S=S+SQN(NUM) |
SQN=N^2 |
0 |
1 TO 3 yes |
1 |
0+1=1 |
1^2=1 |
17 |
2 TO 3 yes |
4 |
1+16=17 |
4^2=16 |
42 |
3 TO 3 yes |
5 |
17+25=42 |
5^2=25 |
|
4 TO 3 No Loop Exits |
|
|
|
The output of the program is :
Sum of square 42
5. Write down the output of the given program:
DECLARE SUB Series(A)
CLS
A=20
CALL Series(A)
END
SUB Series(A)
FOR K=1 to 5
PRINT A;
A=A+10
NEXT K
END SUB
Dry Run Table
A |
K=1 to 5 |
PRINT A; |
A=A+10 |
20 |
1 to 5 yes |
20 |
20+10=30 |
30 |
2 to 5 yes |
30 |
30+10=40 |
40 |
3 to 5 yes |
40 |
40+10=50 |
50 |
4 to 5 yes |
50 |
50+10=60 |
60 |
5 to 5 yes |
60 |
60+10=70 |
70 |
6 to 5 no Loop exits |
|
|
The output of the program is:
20 30 40 50 60
Write down the output of the given program. Show in dry run
table.
DECLARE SUB Result (C$)
C$= “COMPUTER"
CALL Result (C$)
END
SUB Result (C$)
FOR C=1 TO LEN(C$) STEP 2
M$=MIDS (C$,C,1)
N$=N$+MS
NEXT C
PRINT N$
ENF SUB
Dry Run
C$ |
C=1 To LEN(C$) STEP 2 |
MS=MID$(C$,C,1) |
N$=N$+M$ |
PRINT N$ |
COMPUTER |
1 to 8 step 2 |
MID$(COMPUTER,1,1) =C |
C |
|
|
3 to 8 step 2 |
MID$(COMPUTER,3,1) =M |
C+M=CM |
|
|
5 to 8 |
MID$(COMPUTER,5,1) =U |
CM+U=CMU |
|
|
7 to 8 |
MID$(COMPUTER,7,1) =E |
CMU+E=CMUE |
|
|
9 to 8 Loop exits |
|
|
CMUE |
Output
CMUE
5. Write the output of the given program: (Workout with a
dry run). 2
DECLARE SUB ABC(A)
CLS
A=2
CALL ABC(A)
END
SUB ABC(A)
FOR J= 1 TO 5
PRINT A;
A=A+3;
NEXT J
END SUB
Dry run
A |
J=1 TO 5 |
PRINT A; |
A=A+3 |
2 |
1 to 5 Yes |
2 |
2+3=5 |
5 |
2 to 5 Yes |
5 |
5+3=8 |
8 |
3 to 5 Yes |
8 |
8+3=11 |
11 |
4 to 5 Yes |
11 |
11+3=14 |
14 |
5 to 5 Yes |
14 |
14+3=17 |
17 |
6 to 5 No (loop exits) |
|
|
The output of the program is
2 5 8 11 14
Re-write the given program after correcting the bugs: [2]
REM to add record in an existing file
CLS
OPEN “Record.Dat” FOR OUTPUT AS #1
AA:
INPUT “Enter Name, Class and Roll No.”; Nm$, Cl, Rn
INPUT #2, Nm$, Cl, Rn
INPUT “More records”; Y$
IF UCASE$(Y$)=”Y” THEN GOTO aa
CLOSE “Record.dat”
END
Debugged program:
REM to add record in an existing file
CLS
OPEN “Record.Dat” FOR APPEND AS #1
AA:
INPUT “Enter Name, Class and Roll No.”; Nm$, Cl, Rn
WRITE #1,
Nm$, Cl, Rn
INPUT “More records”; Y$
IF UCASE$(Y$)=”Y” THEN GOTO AA
CLOSE #1
END
6. Re-Write the
given program after correcting the bags:
REM to display
name, post and salary of 10 employees
OPEN
"EMP.TXT" FOR IN AS #1
FOR I=10 TO 1
INPUT #1, Name$,
Post$, Salary
DISPLAY Name$,
Post$, Salary
NEXT I
CLOSE “EMP.TXT”
END
Corrected Program:
REM to display
name, post and salary of 10 employees
OPEN
"EMP.TXT" FOR INPUT AS #1
FOR I=1 TO 1
0
INPUT #1, Name$,
Post$, Salary
PRINT Name$, Post$,
Salary
NEXT I
CLOSE #1
END
6. Re-Write the given program after correcting the bugs:
DECLARE SUB Square (A)
REM to print square of a input number
CLS
GET "Enter a number"; N
Square (N)
END
SUB Square (A)
Sq = A^ 4
Display "Square of a number is "; Sq
End Sub
Debugged Program
DECLARE SUB Square (A)
REM to print square of a input number
CLS
INPUT "Enter
a number"; N
CALL Square
(N)
END
SUB Square (A)
Sq = A^ 2
PRINT "Square
of a number is "; Sq
End SUB
6. Re-Write the given program after correcting the bugs:
REM program to make a word reverse
DECLARE FUNCTION Rev$(N$)
CLS
LNPUT “Enter a word”; N$
DISPLAY “Reversed is”; Rev$(N$)
END
EUNCTION Rev$(N$)
FOR K=LEN$(N$) To 1 STEP-1
B$=B$+MID$(N$,1,K)
NEXT K
B$=Rev$
END FUNCTION
Debugged Program
REM program to make a word reverse
DECLARE FUNCTION Rev$(N$)
CLS
INPUT “Enter
a word”; N$
PRINT “Reversed
is”; Rev$(N$)
END
FUNCTION Rev$(N$)
FOR K=LEN (N$) To 1 STEP-1
B$=B$+MID$(N$,K,1)
NEXT K
Rev$=B$
END FUNCTION
Rewrite the given program after correcting the bugs:
REM to display records from existing file.
OPEN "emp.text" FOR APPEND AS #1
WHILE NOT EOF (#1)
WRITE # 1, eN$, posts, salaryS
PRINT eN$, post$, salary
NEXT
CLOSE #1
END
Debugged Program
REM to display records from existing file.
OPEN "emp.txt" FOR INPUT AS
#1
WHILE NOT EOF (1)
INPUT #
1, eN$, posts, salary$
PRINT eN$, post$, salary
WEND
CLOSE #1
END
6. Re-write the given program after correcting the
bugs: 2
DECLARE SUB Series ( )
CLS
EXECUTE Series
END
SUB Series( )
REM Program to generate 1 1 2 3 5 .....upto the 20th terms
A=1
B=1
FOR ctr=10 to 1
DISPLAY A:B:
A=A+B
B=A+B
NEXT ctr
END Series ( )
Debugged Program
DECLARE SUB Series ( )
CLS
CALL Series
END
SUB Series( )
REM Program to generate 1 1 2 3 5 .....upto the 20th terms
A=1
B=1
FOR ctr=1 TO 10
PRINT
A; B;
A=A+B
B=A+B
NEXT ctr
END SUB
7. Study the
following program and answer the given
questions. [2×1=2]
OPEN “Detail.dat” FOR INPUT AS #1
OPEN “Temp.dat” FOR OUTPUT AS #2
INPUT “Enter name of the students”; S$
FOR I=1 TO 10
INPUT #1, Nm$, Cl, A
IF S$< >Nm$ THEN
WRITE #2, Nm$, Cl, A
END IF
NEXT I
CLOSE #1, #2
KILL “Detail.dat”
NAME “Temp.dat” AS “Detail.dat”
END
a. What is the main
objective of the program given above?
The main objective of the program is to
delete the record of a specific student, identified by their name from the data
file Detail.dat.
b. Do you get any
problem in the above program if “Kill” statement is removed? Give reason.
Yes, there would be a problem if the KILL
statement is removed. Because without the KILL statement, both Detail.dat and
Temp.dat will exist, and the renaming (NAME "Temp.dat" AS
"Detail.dat") will fail because a file cannot be renamed to an
existing file's name, causing an error and preventing the update.
7. Study the
following program and answer the given questions:
DECLARE SUB SEE (A$)
A$="COMPUTER
SCIENCE”
END
SUB SEE (A$)
L=LEN(A$)
FOR I=L TO 1
STEP-2
PRINT MID$ (A$, I,
1)
NEXT I
END SUB
a) Which statement
should be added in the main module to execute the program?
Ans: CALL SEE(A$)
should be added in the main module to execute the program
b) List out the
variables used in the above program.
Ans: The variables
used in the above program are: A$, L and I .
7. Study the following program and answer the given
questions:
DECLARE FUNCTION Count (W$)
INPUT "Enter a word"; R$
C = Count (R$)
PRINT C
END
FUNCTION Count (W$)
FOR L = 1 TO LEN (W$)
Ch$MID$ (W$, L, 1)
IF UCASES (Ch$) = "K" THEN
N=N+1
END IF
NEXT L
Count = N
END FUNCTION
a) List any two library functions used in the above program.
UCASE$( ) and MID$( ) are the two library functions used in
the above program
b) Write the use of variable 'C' in line 3 [i.e. C = Count
(R$)] given in the above program.
The use of variable ‘C’ in line 3 [i.e. C = Count
(R$)] given in the above program is to store the value returned by the function
count( ).
7. Study the following program and answer the given
questions:
DECLARE FUNCTION SUM(N)
CLS
INPUT “Enter any number”; N
X=SUM(N)
PRINT “The sum of individual digit is “; X
END
FUNCTION SUM(N)
WHILE N<>0
R=N MOD 10
S=S+R
N=INT(N/10)
WEND
SUM=S
END FUNCTION
a) Write the function of INT.
Ans: The INT function returns the integer part of a number,
removing the decimal part.
b) How many times does the WHILE ….WEND loop repeat if the
value of N is 123?
Ans: The WHILE ….WEND loop repeats 3 times if the value of N
is 123.
Study the following program and answer the given questions.
DECLARE FUNCTION prod (A,B)
CLS
INPUT “Enter first number'; A
INPUT ‘Enter second number"; B
PRINT ‘“The product of the two number="; prod (A,B)
END
FUNCTION prod (A,B)
P=A*B
prod=P
END FUNCTION
(क) माथिको प्रोग्राममा प्रयोग भएको न्युमेरिक भेरिएबलहरू लेख्नुहोस् ।
List all the numerical variables used in the program above.
Ans: The numerical variables used in the program above are
A, B and P
ख) माथिको प्रोग्राममा प्रयोग भएको लोकल भेरिएवलहरू लेख्नुहोस् ।
List the local variables used in program above.
Ans: The local variables used in the program above is P.
7. Study the following program and answer the given
questions. 2x1=2
DECLARE FUNCTION TEST(X)
X=100
Z=TEST(X)
PRINT Z
END
FUNCTION TEST(X)
FOR R=1 TO X
S=S+I
NEXT R
TEST=S
END FUNCTION
a) How many parameters are used in the above program?
Ans: One parameters is used in the
above program.
b) How many times does the statement S=S+I execute in the
above program?
The statement S=S+I will execute 100
times in the above program
8. Convert /
Calculate as per the
instruction. [4×1=4]
a. (11001101)2 =
(?)16
Soln:
Converting Binary to octal
Binary
value in four bits |
1100 |
1101 |
Octal
number |
C |
D |
(11001101)2 = (CD)16
b. (524)10 =
(?)2
Soln:
|
|
Remainder |
2 |
524 |
|
2 |
262 |
0 |
2 |
131 |
0 |
2 |
65 |
1 |
2 |
32 |
1 |
2 |
16 |
0 |
2 |
8 |
0 |
2 |
4 |
0 |
2 |
2 |
0 |
2 |
1 |
0 |
2 |
0 |
1 |
(524)10 = (1000001100)2
c. (1010)2 ×
(110)2 – (1011)2 = (?)2
|
|
1 |
0 |
1 |
0 |
|
|
× |
1 |
1 |
0 |
|
|
0 |
0 |
0 |
0 |
|
1 |
0 |
1 |
0 |
× |
+
1 |
0 |
1 |
0 |
× |
× |
1 |
1 |
1 |
1 |
0 |
0 |
|
- |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
(1010)2 × (110)2 – (1011)2 =
(110001)2
d. (10110)2 ¸ (101)2
101) |
1 |
0 |
1 |
1 |
0 |
(100 |
|
-1 |
0 |
1 |
|
|
|
|
0 |
0 |
0 |
1 |
0 |
|
|
|
|
|
|
-0 |
|
|
|
|
|
1 |
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quotient=100
Remainder=10
7. Convert/Calculate
as per the instruction:
i) (10011011)2
= (?)8
Convert every 3
binary digits (from bit0) to octal digit (see conversion table below):
10011011
010 = 2
011 = 3
011 = 3
= 2 3 3
= (10011011)2
= (233)8
ii) (99)10
= (?)16
Divide by the base
16 to get the digits from the remainders:
Division |
Quotient |
Remainder (Digit) |
(99)/16 |
6 |
3 |
(6)/16 |
0 |
6 |
= (63)16
(99)10
= (63)16
iii) (10110)
2 x (101)2 = (?)2
|
|
|
1 |
0 |
1 |
1 |
0 |
|
|
|
|
x |
1 |
0 |
1 |
|
|
|
1 |
0 |
1 |
1 |
0 |
|
|
0 |
0 |
0 |
0 |
0 |
x |
|
1 |
0 |
1 |
1 |
0 |
x |
x |
|
1 |
1 |
0 |
1 |
1 |
1 |
0 |
|
|
|
|
|
|
|
|
10110 × 101
= 1101110
iv) (101101)2
/ (11) 2
11) |
1 |
0 |
1 |
1 |
0 |
1 |
(1111 |
|
- |
1 |
1 |
|
|
|
|
|
|
1 |
0 |
1 |
|
|
|
|
|
|
1 |
1 |
|
|
|
|
|
|
1 |
0 |
0 |
|
|
|
|
|
|
1 |
1 |
|
|
|
|
|
|
|
1 |
1 |
|
|
|
|
|
|
1 |
1 |
|
|
|
|
|
|
0 |
0 |
|
Q = 1111
R = 0
8. Convert/Calculate as per the instruction:
a) (ABC)16 = (?)8
Convert each hex digit to 4 binary digits
ABC
= A B C
A = 1010
B = 1011
C = 1100
= 101010111100
Convert every 3 binary digits (from bit0) to octal digit
101010111100
= 101 010 111 100
101 = 5
010 = 2
111 = 7
100 = 4
= 5274
(ABC)16 = (5274)8
b) (435)10 = (?)2
Division by 2 |
Quotient |
Remainder(Digit) |
(435)/2 |
217 |
1 |
(217)/2 |
108 |
1 |
(108)/2 |
54 |
0 |
(54)/2 |
27 |
0 |
(27)/2 |
13 |
1 |
(13)/2 |
6 |
1 |
(6)/2 |
3 |
0 |
(3)/2 |
1 |
1 |
(1)/2 |
0 |
1 |
= (110110011)2
(435)10 = (110110011)2
iii) (101)2x (101)2=(?)2
|
|
|
1 |
0 |
1 |
|
|
|
X |
1 |
0 |
1 |
|
|
|
|
1 |
0 |
1 |
|
|
|
0 |
0 |
0 |
X |
|
+ |
1 |
0 |
1 |
X |
X |
|
|
1 |
1 |
0 |
0 |
1 |
|
(101)2x (101)2=(11001)2
iv) (101101) /¸(101)
|
101) |
1 |
0 |
1 |
1 |
0 |
1 |
(1001 |
|
- |
1 |
0 |
1 |
|
|
|
|
|
|
0 |
0 |
0 |
1 |
0 |
1 |
|
|
|
|
|
- |
1 |
0 |
1 |
|
|
|
|
|
|
0 |
0 |
0 |
|
|
|
|
|
|
|
|
|
|
Quotient = 1001
Remainder = 0
8. Convert/Calculate as per the instruction:
a) (10110011)2 – (?)16
Soln:
Paired Binary Digit |
1011 |
0011 |
Binary Equivalent value |
B |
3 |
(10110011)2 = (B3)16
c) (1001 + 110)2 – (1000)2
|
1 |
0 |
0 |
1 |
|
+ |
1 |
1 |
0 |
|
1 |
1 |
1 |
1 |
- |
1 |
0 |
0 |
0 |
|
0 |
1 |
1 |
1 |
(1001 + 110)2 – (1000)2 = (0111)2
b) (410)10 = (?)2
2 |
410 |
Remainder |
2 |
205 |
0 |
2 |
102 |
1 |
2 |
51 |
0 |
2 |
25 |
1 |
2 |
12 |
1 |
2 |
6 |
0 |
2 |
3 |
0 |
2 |
1 |
1 |
2 |
0 |
1 |
(410)10 =
(110011010)2
d) (10110)2 ¸ (101)2
iv) (10110) 2 ¸ (101) 2
101) |
10110( |
100 |
|
-101 |
|
|
00010 |
|
|
-0 |
|
|
10 |
|
Quotient
= 100
Remainder
= 10
Convert/Calculate as per the instruction:
i) (214) 10 = (?)2
Divide by the base 2 to get the digits from the remainders:
Division |
Quotient |
Remainder (Digit) |
(214)/2 |
107 |
0 |
(107)/2 |
53 |
1 |
(53)/2 |
26 |
1 |
(26)/2 |
13 |
0 |
(13)/2 |
6 |
1 |
(6)/2 |
3 |
0 |
(3)/2 |
1 |
1 |
(1)/2 |
0 |
1 |
= (11010110)2
(214) 10 = (11010110)2
iii) (1011)2×(101) 2
|
|
|
|
1 |
0 |
1 |
1 |
|
|
|
|
x |
1 |
0 |
1 |
|
|
|
|
1 |
0 |
1 |
1 |
|
|
|
0 |
0 |
0 |
0 |
x |
|
|
1 |
0 |
1 |
1 |
x |
x |
|
|
1 |
1 |
0 |
1 |
1 |
1 |
(1011)2×(101) 2 = (110111)2
ii) (ABC) 16 = (?)2
Convert each hex digit to 4 binary digits (see conversion
table below):
ABC
= A B C
A= 1010
B=1011
C=1100
= 101010111100
(ABC) 16 = (101010111100)2
iv) (10101)2 / (11)2
11) |
1 |
0 |
1 |
0 |
1 |
(111 |
|
|
1 |
1 |
|
|
|
|
|
1 |
0 |
0 |
|
|
|
|
|
1 |
1 |
|
|
|
|
0 |
0 |
1 |
1 |
|
|
|
|
|
1 |
1 |
|
|
|
|
|
0 |
0 |
|
Q=111
R=0
8. Convert / Calculate as per the
instruction. 4x1=4
i) (11111101)2 = (?)16
Soln:
Paired Binary Digit |
1111 |
1101 |
Binary Equivalent value |
F |
D |
(11111101)2 = (FD)16
ii) (245)10 = (?)2
Soln:
2 |
245 |
Remainder |
2 |
122 |
1 |
2 |
61 |
0 |
2 |
30 |
1 |
2 |
15 |
0 |
2 |
7 |
1 |
2 |
3 |
1 |
2 |
1 |
1 |
|
0 |
1 |
(245)10 = (11110101)2
iv) (101110) 2 ¸ (110) 2
110) |
101110( |
0111 |
|
000 |
|
|
1011 |
|
|
-110 |
|
|
1011 |
|
|
-110 |
|
|
1010 |
|
|
-110 |
|
|
100 |
|
Quotient
= 111
Remainder = 100
iii) (1010) 2 x (101) 2 =(?)2
|
|
1 |
0 |
1 |
0 |
|
|
x |
1 |
0 |
1 |
|
|
1 |
0 |
1 |
0 |
|
0 |
0 |
0 |
0 |
x |
1 |
0 |
1 |
0 |
x |
x |
1 |
1 |
0 |
0 |
1 |
0 |
(1010) 2 x (101) 2 =(110010)2
8.
Convert / Calculate as per the instruction. 4x1=4
i)
(214)10 = (?)2
Soln:
2 |
214 |
Remainder |
2 |
107 |
0 |
2 |
53 |
1 |
2 |
26 |
1 |
2 |
13 |
0 |
2 |
6 |
1 |
2 |
3 |
0 |
2 |
1 |
1 |
1 |
0 |
1 |
(214)10 =
(11010110)2
i)
(ABC)16 = (?)2
Soln:
Hexadecimal digit |
A |
B |
C |
Binary Equivalent value |
1010 |
1011 |
1100 |
(ABC)16 =
(101010111100)2
iii)
(1011) 2 × (101) 2 + (101) 2 =(?)2
|
|
1 |
0 |
1 |
1 |
|
|
x |
1 |
0 |
1 |
|
|
1 |
0 |
1 |
1 |
|
0 |
0 |
0 |
0 |
x |
1 |
0 |
1 |
1 |
x |
x |
1 |
1 |
0 |
1 |
1 |
1 |
Now,
1
1 0 1 1 1
+
1 0 1
1
1 1 1 0 0
(1011) 2 ×
(101) 2 + (101) 2 =(?)2 =(111100)2
iv) (101110) 2 ¸ (110) 2
11) |
10101 |
111 |
|
|
|
|
-11 |
|
|
100 |
|
|
- 11 |
|
|
11 |
|
|
-11 |
|
|
00 |
|
Quotient = 111
Remainder = 00
8. Convert/Calculate as per the
instruction:
i)
(11001101)2 = (?)16
Soln:
Paired Binary Digit |
1100 |
1101 |
Binary Equivalent value |
C |
D |
(10110011)2 = (CD)16
ii) (524)10 =
(?)2
2 |
524 |
Remainder |
2 |
262 |
0 |
2 |
131 |
0 |
2 |
65 |
1 |
2 |
32 |
1 |
2 |
16 |
0 |
2 |
8 |
0 |
2 |
4 |
0 |
2 |
2 |
0 |
2 |
1 |
0 |
2 |
0 |
1 |
(524)10 = (1000001100)2
iii)
(1010)2 ´ (110)2 – (1011)2 = (?)2
|
|
1 |
0 |
1 |
0 |
|
|
× |
1 |
1 |
0 |
|
|
0 |
0 |
0 |
0 |
|
1 |
0 |
1 |
0 |
× |
1 |
0 |
1 |
0 |
× |
× |
1 |
1 |
1 |
1 |
0 |
0 |
|
- |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
(1010)2 ´ (110)2 –
(1011)2 = (110001)2
iv) (10110)2 ÷
(101)2
101) |
10110( |
100 |
|
-101 |
|
|
00010 |
|
|
-
0 |
|
|
10 |
|
Quotient = 100
Remainder = 10
Write a program in QBASIC that asks length,
breadth and height of room and calculate its area and volume. Create a user
defined function to calculate area and sub-program to calculate volume. Hint:
[A=L×B], [V=L×B×H]
DECLARE FUNCTION AREA(L,B)
DECLARE SUB VOL(L,B,H)
CLS
INPUT “Enter Length”; L
INPUT “Enter Breadth”; B
INPUT “Enter Height”; H
PRINT “Area of room=”; AREA(L,B)
CALL VOL(L,B,H)
END
FUNCTION AREA(L,B)
AREA = L * B
END FUNCTION
SUB VOL(L,B,H)
V=L*B*H
PRINT “Volume of Room=”; V
END SUB
Write a program in
QBASIC that asks radius and height of a cylinder Create a User Defined Function
to calculate total surface area and a Sub Program to calculate the volume of a
cylinder.
[Hint: TSA=2pr (r+h) and Volume
pr2h]
DECLARE FUNCTION AREA(R, H)
DECLARE SUB VOL(R,H)
Cls
INPUT "Enter radius"; R
INPUT "Enter height"; H
PRINT AREA(R, H)
Call VOL(R, H)
END
FUNCTION AREA (R, H)
AREA = 2 * 3.14 * R * (R +
H)
END FUNCTION
SUB VOL (R, H)
V = 3.14 * R ^ 2 * H
PRINT "Volume of
cylinder"; V
END SUB
Write a program in QBASIC that asks radius of a circle to
calculate its area and circumference. Create a user defined function to
calculate area and sub program to calculate circumference.
[Hint A= pr2, C= 2pr]
DECLARE FUNCTION AREA (R)
DECLARE SUB CIR (R)
CLS
INPUT “ENTER RADIUS”; R
PRINT “AREA OF SQUARE ”; AREA(R)
CALL CIR (R)
END
FUNCTION AREA (R)
AREA = 3.14 * R ^ 2
END FUNCTION
SUB CIR (R)
C = 2 * 3.14 * R
PRINT “CIRCUMFERENCE OF CIRCLE”; C
END SUB
Write a program in Q-BASIC that asks length and breadth of a
room and calculate its area and perimeter. Create a user-defined FUNCTION to calculate
area and SUB program to calculate perimeter. [Hint: A=L×B, P=2(L+B)]
DECLARE FUNCTION AREA(L,B)
DECLARE SUB PER(L,B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
PRINT “AREA OF A ROOM=”; AREA(L,B)
CALL PER(L,B)
END
FUNCTION AREA(L,B)
AREA=L*B
END FUNCTION
SUB AREA(L,B)
P=2*(L+B)
PRINT “PERIMETER OF RECTANGLE=”; P
END SUB
Write a program in QBASIC that will asks the user to input
length, breadth and height of a room then use SUB procedure calculate its
volume and FUNCTION procedure to calculate its area of four walls.
DECLARE SUB
VOL(L,B,H)
DECLARE
FUNCTION AREA(L,B,H)
CLS
INPUT “Enter
length”; L
INPUT “Enter
breadth”; B
INPUT ”Enter
height”; H
CALL VOL(L,
B, H)
PRINT “Area
of four walls=”; AREA(L, B, H)
END
SUB VOL(L,
B, H)
V=L*B*H
PRINT
“Volume of room”; V
END SUB
FUNCTION
AREA(L, B, H)
AREA=2*H*(L+B)
END FUNCTION
A sequential data file called “Record.txt” has
stored data under the field heading Roll No., Name, Gender, English, Nepali,
Maths and Computer. Write a program to display all the information of those
students whose gender is “F” and obtained marks in computer is more than 90.
OPEN “Record.txt” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1, R, N$, G$, E, N, M, C
IF UCASE$(G$)=”F” AND C>=90 THEN
PRINT R; N$; G$; E; N; M; C
END IF
WEND
CLOSE #1
END
Employee's name, address, gender and salary are stored in
the "EMP.DAT" sequential data file. Write a QBASIC program that
displays all information about personnel whose salaries exceed 60000.
OPEN "EMP.DAT" FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
INPUT #1, N$, A$, G$, S
IF S > 60000 THEN PRINT N$, A$,
G$, S
WEND
CLOSE #1
END
A sequential data file called “Record.dat” has stored data
under the field headings: Roll No., Name, Gender, English, Nepali, Maths and
Computer. Write a program to display all the information of those students
whose marks in English is more than 40.
OPEN
"Record.dat" FOR INPUT AS #1
CLS
WHILE
NOT EOF (1)
INPUT
#1, R, N$, G$, E, NP, M, C
IF
E > 40 THEN PRINT R, N$, G$, E, NP, M, C
WEND
CLOSE
#1
END
Students' name, class, section and address are stored in a
data file called "STUDENT.DAT" Write a program to print all the
records of students.
OPEN “STUDENT.DAT” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1, N$, C, S$, A$
PRINT N$, C, S$, A$
WEND
CLOSE #1
END
Write a program to
create a sequential data file "student.dat" to store 10 students name
and obtain marks in four different subjects.
OPEN "student.dat"
FOR OUTPUT AS #1
FOR I = 1 TO 10
INPUT "Enter Name"; N$
INPUT “Enter Marks in English”; E
INPUT “Enter Marks in
Nepali”; NE
INPUT “Enter Marks in
Maths”; M
INPUT “Enter Marks in
Science”; S
WRITE #1, N$, E, NE, M, S
NEXT I
CLOSE #1
END
Write a program to create a sequential data file
“salary.dat” to store programmer’s name, salary and post according to the need
of the user.
OPEN “salary.dat” FOR OUTPUT AS #1
DO
CLS
INPUT “Enter name”; N$
INPUT “Enter Salary”; S
INPUT “Enter Post”; P$
WRITE #1, N$, S, P$
INPUT “Do you want to continue(Y/N)”; CH$
LOOP WHILE UCASE$(CH$)=”Y”
CLOSE #1
END
Write a program in C language that asks a number
and check whether it is odd or even.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n % 2 = = 0 )
printf("%d is even number", n);
else
printf("%d is odd number", n);
return 0;
}
Write a program in
C language that asks for an integer value and checks whether it is divisible by
7 or not.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n%7==0)
printf("%d is divisible by 7",n);
else
printf("%d is not divisible by 7",n);
return 0;
}
Write a program in C language to input a number then check
whether the number is fully divisible by 5 or not.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter
any number: ");
scanf("%d",
&n);
if(n%5= =0)
printf("%d
is fully divisible by 5",n);
else
printf("%d
is not fully divisible by 5",n);
return 0;
}
Write a C program that asks a number and check whether it is
negative, positive or zero.
#include<stdio.h>
#include<conio.h>
int main()
{
int n;
printf("Enter any number: ");
scanf("%d", &n);
if(n>0)
printf("%d is positive number",n);
else if(n<0)
printf("%d is negative number",n);
else
printf("%d is zero number",n);
return 0;
}
Write a program in 'C' language to find simple interest
where user need to input Principle, Rate and Time.
#include<stdio.h>
#include<conio.h>
int main()
{
float p, t, r, i;
printf("Enter principal: ");
scanf("%f", &p);
printf("Enter time: ");
scanf("%f", &t);
printf("Enter rate: ");
scanf("%f", &r);
i = (p*t*r)/100;
printf("Simple Interest = %.2f", i);
return 0;
}
Write C program to find average number of any two numbers. (४)
#include <stdio.h>
int main()
{
int num1, num2;
float avg;
printf("Enter first number:
");
scanf("%d",&num1);
printf("Enter second number:
");
scanf("%d",&num2);
avg= (num1+num2)/2;
printf("Average of two number
is: %f",avg);
return 0;
}
Write a program in C language that asks any two numbers and
displays the greatest among them.
#include<stdio.h>
#include<conio.h>
int main( )
{
int a,b;
printf("Enter any two numbers:\n ");
scanf("%d %d", &a, &b);
if(a>b)
printf("The greatest number is %d", a);
else
printf("The greatest number is %d", b);
return 0;
}
Write a program in C language to display the
series with their sum.1, 2, 3, 4 upto 10th terms.
#include<stdio.h>
#include<conio.h>
int main()
{
int i, s=0;
i=1;
while(i<=5)
{
printf("%d \n", i);
s = s + i;
i++;
}
print("%d \n Sum=", s);
return 0;
}
Write a program in
C language to display the series with their sum 1, 4, 9, 16.... up to 10th
term.
#include
<stdio.h>
int main( )
{
int i, t, s = 0;
printf("Series: ");
for (i = 1; i <= 10; i++)
{
t = i * i;
printf("%d ", t);
s += t;
}
printf("\nSum of the series:
%d\n", s);
return 0;
}
Write a program in C-language to display the series 2, 4, 6,
8 up to the 10th term.
#include<stdio.h>
void main( )
{
int i,a=2;
for(i=1;i<=10;i++)
{
printf(“%d”, a);
a=a+2;
}
}
Write a program in C language to display first 10 odd
numbers.
#include<stdio.h>
#include<conio.h>
int main()
{
int i, a;
i=1;
a=1;
while(i<=10)
{
printf("%d \n", a);
a=a+2;
i++;
}
return 0;
}
No comments:
Post a Comment