Set
2: SOLVED PABSON 2080 (MADHESH)
Opt.
II Computer Science
Time : 2 hours Full Marks: 50
Candidates are required
to give their answer according to the given instructions.
Attempt all
questions.
Group
'A
1. Answer the
following questions in one sentence:
a)
What is data communication?
Ans:
Data communication is the exchange of data between devices through a
transmission medium.
b)
What is computer virus?
Ans:
A computer virus is a destructive program that copies itself and infects a PC,
spreading from one file to another, and then from one PC to another when the
files are copied or shared.
c)
Name any two types of data file in Qbasic.
Ans:
Any two types of data file in QBasic are: Sequential file and Random file
d)
What is primary key?
Ans:
A primary key is a field or combination of fields in a table that uniquely
identifies each record, and is used to establish relationships between tables
and enforce data integrity
e)
What is field?
Ans:
A field is a column in a table which contains information about a certain type
for all records.
f)
What is C language?
Ans:
C Language is a high-level structured programming language which is used to
develop system software.
2. Write appropriate
technical term for the following:
a)
A
network limited with a room or building. LAN (Local Area Network)
b)
Commercial
transaction through mobile devices. M-Commerce (Mobile Commerce)
3. Write the full
form of the following:
a)
UPS
– Uninterruptible Power Supply
b)
WWW
– World Wide Web
Group
'B'
4. Answer the
following questions:
a)
What is transmission media? Write its types.
Ans:
A channel or path through which data and information are transmitted between
connected devices in a network environment is called transmission media.
Its
types are:
1. Guided
(Wired/bounded) communication media (Fiber optic, Twisted Pair and Co-axial)
2.
Unguided (Wireless/unbounded) communication media (Radiowave, Microwave,
Satellite)
b)
What is loT? Write any two importance of it.
Ans:
The Internet of Things (IoT) refers to the network of physical objects embedded
with sensors, software, and other technologies to connect and exchange data
with other devices and systems over the internet.
Any
two importance of IoT are:
It reduces the human effort, so it saves
a lot of time.
Information is easily accessible from any
place at any time on any device
c)
Write any four opportunities and threats its social media.
Ans:
Any four opportunities and threats its social media are:
Opportunities
of using social media
a) It creates awareness and innovate the way people live
b) Social media let us share anything with others around the world.
c) It keeps us informed about the world.
d) It creates brand exposure for business to the largest audience.
Threats
of using social media
a)
Personal
data and privacy can be easily hacked and shared on the internet.
b)
More
chances of creating fake accounts.
c)
Negative
impact on the health.
d)
Spreading
false or unreliable information.
d)
What is E-commerce Write its types.
Ans:
E-commerce refers to the buying and selling of goods and services over the
internet.
Its
types include Business to Consumer (B2C), Business to Business (B2B), Consumer
to Consumer (C2C), and Consumer to Business (C2B).
e)
What is information security? Write any two ways to
protect our data.
Ans:
Information security is the practice of protecting digital information from
unauthorized access, corruption, or theft. Two ways to protect data are:
·
Using strong passwords and changing them
regularly.
·
Implementing encryption to secure
sensitive data.
f)
What is database? Write any two examples.
Ans:
A collection of
systematically organized inter-related data which store, organize and
retrieve data is called a database. E.g. Dictionary and Marks Ledger.
g)
What is table? Write the basic components of table.
Ans:
Tables are the primary building block of database which stores and manages
large volume of data into rows and column.
The
basic components of a table are fields (columns) and records (rows).
h)
What is action query? Write its type.
Ans:
An action query in a database performs a task on the data, such as inserting,
updating, or deleting records. Its types include append queries, update
queries, delete queries, and make-table queries.
i)
Define input mask and validation rule.
Ans:
Input mask is a field property that controls the value of a record and sets in
a specific format.
5. Write down the
output of the given program. Show with dry run in table.
DECLARE SUB SERIES ( )
CES
CALL SERIES
END
SUB SERIES
A=4
B=5
PRINT A
PRINT B
FOR 1=1 to 5
C=A + B
PRINT C
A=B
B=C
NEXT I
END SUB
Dry Run Table:
A |
B |
PRINT A |
PRINT B |
FOR C = 1 TO 5 |
C=A+B |
PRINT C |
A=B |
B=C |
4 |
5 |
4 |
5 |
1 TO 5 Yes |
4+5=9 |
9 |
5 |
9 |
5 |
9 |
|
|
2 To 5 Yes |
5+9=13 |
14 |
9 |
14 |
9 |
14 |
|
|
3 to 5 Yes |
9+14=23 |
23 |
14 |
23 |
14 |
23 |
|
|
4 To 5 Yes |
14+23=37 |
37 |
23 |
37 |
23 |
37 |
|
|
5 To 5 Yes |
23+37=60 |
60 |
37 |
60 |
37 |
60 |
|
|
6 To 5 No |
|
|
|
|
The output of the program is:
4
5
9
14
23
37
60
6. Re-write the
given program after correcting the bugs:
REM add some more
record on a sequential data file "emp.dat"
CLS
OPEN "emp.dat"
FOR INPUT AS #1
UP:
INPUT "ENTER
NAME:”; N$
INPUT "ENTER
DEPARTMENT” ; D$
INPUT "ENTER
POST”; P$
INPUT "ENTER
SALARY”; SL
WRITE #2, N$, D$,
P$, SL
INPUT "DO YOU
WANT TO ADD MORE RECORD?(Y/N)”; AN$
IF UCASE$(ANS$)=
"Y" THEN GOTO UP
CLOSE
END
Debugged Program
REM add some more
record on a sequential data file "emp.dat"
CLS
OPEN
"emp.dat" FOR APPEND AS #1
UP:
INPUT "ENTER
NAME: "; N$
INPUT "ENTER
DEPARTMENT: "; D$
INPUT "ENTER
POST: "; P$
INPUT "ENTER
SALARY: "; SL
WRITE #1,
N$, D$, P$, SL
INPUT "DO YOU
WANT TO ADD MORE RECORD? (Y/N)"; AN$
IF UCASE$(AN$) =
"Y" THEN GOTO UP
CLOSE
END
7. Study the
following program and answer the given questions:
DECLARE FUNCTION
TEST$(A$)
CLS
A$= “KATHMANDU”
B$=TEST$(A$)
PRINT B$
END
FUNCTION TEST$ (A$)
FOR I = TO LEN(A$)
DS=MID$(A$, I, 1)
IF I MOD 2=0 THEN
C$=C$+UCASES$(D$)
ELSE
C$=C$+LCASES$(D$)
END IF
NEXT I
TEST$=C$
END FUNCTION
Questions:
a)
What is the name of the function procedure?
The
name of the function procedure is TEST$(
)
b)
List the different library functions used in the program.
The
different library functions used in the program
are: MID$( ), UCASE$( ), LCASE$( ),
MID$( )
Group
'C"
8.
Convert/calculate as per the instruction:
a. (511)10 into
Binary number
Divide by the base
2 to get the digits from the remainders:
Division |
Quotient |
Remainder (Digit) |
Bit # |
(511)/2 |
255 |
1 |
0 |
(255)/2 |
127 |
1 |
1 |
(127)/2 |
63 |
1 |
2 |
(63)/2 |
31 |
1 |
3 |
(31)/2 |
15 |
1 |
4 |
(15)/2 |
7 |
1 |
5 |
(7)/2 |
3 |
1 |
6 |
(3)/2 |
1 |
1 |
7 |
(1)/2 |
0 |
1 |
8 |
= (111111111)2
(511)10 =
(111111111)2
b. (756)8 into
Hexadecimal number
Convert every
octal digit to 3 binary digits, then convert every 4 binary digits to1 hex digit (see conversion tables):
756
7 = 111
5 = 101
6 = 110
= 111 101 110
Convert binary to
hexadecimal
= 1 1110 1110
1=1
1110=E
1110=E
(756)8 =(1EE)16
c. 1001 × 101 – 11
|
|
|
|
|
|
1 |
0 |
0 |
1 |
|
|
|
|
|
|
x |
1 |
0 |
1 |
|
|
|
|
|
|
1 |
0 |
0 |
1 |
|
|
|
|
|
0 |
0 |
0 |
0 |
x |
|
|
|
|
1 |
0 |
0 |
1 |
x |
X |
|
|
|
|
1 |
0 |
1 |
1 |
0 |
1 |
|
|
|
|
|
|
|
- |
1 |
1 |
|
|
|
|
1 |
0 |
1 |
0 |
1 |
0 |
1001 × 101 – 11 =
101010
d. 1001001 ¸11001
11001) |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
(10 |
|
- |
1 |
1 |
0 |
0 |
1 |
|
|
|
|
|
1 |
0 |
1 |
1 |
1 |
|
|
|
|
|
|
|
- |
0 |
|
|
|
|
1 |
0 |
1 |
1 |
1 |
|
Q=10
R = 10111
9. a. Write a
program in ghasic that ask the radius and
height of a cylinder then calculate its volume and Total surface area.
Create a user-defined function VLM(r, h) to calculate volume and sub procedure
TOTSA (r, h) to calculate total surface area of a a hemisphere [Hints: TSA=2pr(r+h), V=pr2h.
DECLARE FUNCTION
VLM(r, h)
DECLARE SUB
TOTSA(r, h)
CLS
INPUT "Enter
radius: ", r
INPUT "Enter
height: ", h
PRINT "Volume
of the cylinder: "; VLM(r, h)
CALL TOTSA(r, h)
END
FUNCTION VLM(r, h)
VLM = 3.1416 * r *
r * h
END FUNCTION
SUB TOTSA(r, h)
tsa = 2 * 3.1416 *
r * (r + h)
PRINT "Total
Surface Area of the cylinder: "; tsa
END SUB
b. A sequential
data file called "marks.dat" has stored data under the field heading
student's name. Eng, Nep and Math. Write a program to display all the record
whose marks is greater than 35 in all subjects.
OPEN
"marks.dat" FOR INPUT AS #1
CLS
PRINT
"Students with marks > 35 in all subjects:"
DO WHILE NOT
EOF(1)
INPUT #1, name$,
eng, nep, math
IF eng > 35 AND
nep > 35 AND math > 35 THEN
PRINT name$, eng,
nep, math
END IF
LOOP
CLOSE #1
END
10. Write a
program in C language to ask to enter a number then find out whether it is odd
or even number
#include
<stdio.h>
int main()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2 == 0) {
printf("%d is even.\n", num);
} else {
printf("%d is odd.\n", num);
}
return 0;
}
Copyright
© 2024 Deepak Shrestha [2081 B.S.]
No comments:
Post a Comment