write a qbasic program to convert binary number to octal equivalent number
CLS
INPUT "enter binary number"; n#
WHILE n# <> 0
r = n# MOD 10
s = s + r * 2 ^ i
i = i + 1
n# = n# \ 10
WEND
i = 1
WHILE s <> 0
r1 = s MOD 8
d = d + r1 * i
s = s \ 8
i = i * 10
WEND
PRINT "Octal equivalent number="; d
END
SEE Computer Science Specification Table 2076, Networking and Telecommunication, Ethical and Social Issues in ICT, Computer Security, E-Commerce, Contemporary Technology, Number System, Database Management System (MS Access), Modular Programming, Sequential File Handling, C Programming Basics, SEE Computer E-Book Grade IX and X
Wednesday, February 20, 2019
Solved SLC Examination-2065(2009)
Solved SLC Computer Science 2065
SLC Examination-2065(2009)
Computer Fundamental (22 marks)
- Answer the following questions:
Define star topology with figure.
Ans: The topology in which all computers or the network devices are connected through a central device in the shape of star structure is called star topology.
Diagram of star topology
- List out any four services of internet.
Ans: Any four services of internet are
- i) E-mail (Electronic mail)
ii) FTP (File Transfer Protocol)
iii) IRC (internet Relay Chat)
iv) E-commerce
Define computer ethics.
Ans: Computer ethics is the set of moral principles or code of conducts that should be followed by computer user.
Write down two measures of each to protect computer hardware and software.
Ans: Any two hardware security measures are:
- ii) Insurance Policy
ii) Power Regulator Device
Any two software security measures are:
i) Backup
iv) Password
i) Backup
iv) Password
What is anti-virus? Write down any two examples of anti-virus software.Ans: Antivirus software is software designed to detect and remove virus from computer system to ensure virus free environment.
Any two examples of antivirus software are:
i) Kaspersky ii) NOD32
i) Kaspersky ii) NOD32
- Match the following:
Group A Group B
a) Server i) HTTP
b) Node ii) Work station
c) Protocol iii) Main computer
d) Coaxial cable iv)Repeater
v) Communication Media
Answers
Group A Group B
a) Server Main computer
b) Node Work stationc) Protocol HTTPd) Coaxial cable Communication Media
a) Server Main computer
b) Node Work stationc) Protocol HTTPd) Coaxial cable Communication Media
- Select the best answer:
a)Which refers to the communication media?
i) UTP cable ii) Fiber optic cable iii) Satellite iv) All of the above
All of the above
- b) Which is the correct Email ID?
i) Yahoo@rameshii) Ramesh@yahoo.com iii) @ramesh.yahoo.com iv) None of the above
Ramesh@yahoo.com
c) Route of virus transmission:
i) Pen driveii) Microphone iii) Printer iv) Mouse
Pen drive
- d) Main component of multimedia is:
i) Floppy disk ii) Floppy drive iii) Sound card iv) Magnetic tape
Sound card
5) Give appropriate technical terms:
a) A computer network limited within a room.
5) Give appropriate technical terms:
a) A computer network limited within a room.
LAN (Local Area Network)
- b) A program that destroys other program
Computer Virus
- c) Law regarding internet (or Legal issues of Cyber Space).
Cyber Law
- d) Buying and selling products and services online.
E-Commerce
- Write the full forms:
- a) UPS= Uninterruptible Power Supply
- b) TCP = Transmission Control Protocol
- c) STP= Shielded Twisted Pair
- d) NIC= Network Interface Card
Group B- Database (10 marks)
- Answer the following question:
a) What is database?
Ans:Database is a collection of related and organized information that can be used for different purpose.
b) While designing table structure which data types are suitable to store information about teacher’s name, address, salary, and date of birth.
While designing table structure the data types are suitable to store information about
teacher’s name = Text
Address = Memo
Salary = currency
Date of birth = Date / Time
c) Write down any two advantages of Query.
Any two importance of query are:
- It allows user to make calculations and change data in automated fashion.
- It provides option to delete all the unwanted data matching certain criteria.
- Select the best answer:
a) …………… is not the data type of MS-Access.
i) Numberii) Text iii) Memo iv) Form
Form
- b) …………… is the DBMS.
i) Fox-Proii) MS-Excel iii) Lotus-123 iv) All of the above
Fox-pro
- c) Primary key does not accept ……………
i) Text ii) Number iii) Null value iv) None of the above
Null value
- d) In MS-Access we enter data using ………….
i) Form ii) Table iii) Report iv) Both (i) &(ii)
Both (i) &(ii)
- Match the following:
Group AGroup B
a) Query i)Printed format
b) Form ii) Stored data
c) Table iii) Allows view, edit, input data
d) Report iv) Extracts the selected record for view
v) DBMS
Answers
Group A Group B
a) Query Extracts the selected record for view
b) Form Allows view, edit, input data
c) Table Stores data
d) Report Printed format
a) Query Extracts the selected record for view
b) Form Allows view, edit, input data
c) Table Stores data
d) Report Printed format
Group C-Programming (18 marks)
- a) Write down one difference between function and sub procedure.
Ans: One difference between function and sub procedure is
SUB-procedure | FUNCTION-procedure |
SUB-procedure does not return value. | FUNCTION-procedure must return a value. |
- b) List any two data type used in C language.
Ans: Any two data type used in C language are char and int
c) Write down the functions of:
i) RMDIR
Ans: It is used to remove or delete only the subdirectories from a disk. It can remove only empty subdirectories.
- ii) NAME
Ans: The NAME statement renames a file on a disk.
11.Write the output of:
DECLARE SUB RESULT(A$)
A$ = “EDUCATION”
CALL RESULT(A$)
END
11.Write the output of:
DECLARE SUB RESULT(A$)
A$ = “EDUCATION”
CALL RESULT(A$)
END
SUB RESULT (A$)
FOR C = 1 TO LEN(A$) STEP 2
X$ = MID$(A$, C, 1)
PRINT X$
NEXT C
END SUB
FOR C = 1 TO LEN(A$) STEP 2
X$ = MID$(A$, C, 1)
PRINT X$
NEXT C
END SUB
- Re-write the following program after correcting:DECLARE FUNCTION SUM(a,b)
REM Program to sum given two numbers
Input ”Enter first number”; x
Input “Enter second number; y
PRINT SUM(a,b)
ENDFUNCTION SUM(x,y)
SUM=a+b
END
Debuged Program
DECLARE FUNCTION SUM (a,b)
REM Program to sum given two numbers
Input ”Enter first number”; x
Input “Enter second number”; y
PRINT SUM (x, y)
END
REM Program to sum given two numbers
Input ”Enter first number”; x
Input “Enter second number”; y
PRINT SUM (x, y)
END
FUNCTION SUM(a, b)
SUM=a+b
END FUNCTION
SUM=a+b
END FUNCTION
- Study the following program and answer the following question:
DECLARE FUNCTION xyz(N)
FOR I = 1 TO 5
READ N
Z=xyz(N)
S=S+Z
NEXT I
PRINT S
DATA 10,13,15,4,6
ENDFUNCTION xyz(N)
IF N MOD 2=0 THEN xyz=N
END FUNCTION
a) What is the name of the function used in the above program?
Ans: The name of the function used in the above program is xyz.
- b) How many times the function will be called in the above program?
Ans: The function will be called five times in the above program.
- a) Write a program to store records regarding the information of Book number, Book’s name and Writer’s name in a sequential data file called “Library.dat”.
OPEN “Library.dat” FOR OUTPUT AS #1
DO
CLS
INPUT “ENTER BOOK’S NUMBER”; BN
INPUT “ENTER BOOK’S NAME”; B$
INPUT “ENTER WRITER’S NAME”; N$
WRITE #1, BN, B$, N$
INPUT “DO YOU WANT TO CONTINUE”; CH$
LOOP WHILE UCASE$(CH$) = “Y”
CLOSE #1
END
- b) Using FUNCTION……END FUNCTION, write a program to calculate distance travelled by a body. (Hint: s=ut+ (1/2) at2)
DECLARE FUNCTION DISTANCE (U,T, A)
CLS
INPUT “ENTER INITIAL VELOCITY, TIME AND ACCELERATION”; U, T, A
PRINT “DISTANCE TRAVELLED BY BODY”; DISTANCE (U, T, A)
END
FUNCTION DISTANCE (U, T, A)
DISTANCE = U*T+1/2*A*T^2
END FUNCTION
c) Using SUB……….END sub, write a program to print the following serial 9, 7, 5,……1
DECLARE SUB SERIES ( )
CLS
CALL SERIES
END
SUB SERIES ( )
FOR I = 9 TO 1 STEP-2
PRINT I
NEXT I
END SUB
***
Solved SLC Examination-2066(2010)
SLC Examination-2066(2010)
Computer Fundamental (22 marks)
- Answer the following question:
a) What is computer network?
Ans: computer network means two or more computers connected with each other to share data, hardware, software and other resources.
- b) What is internet?Ans: Internet is an interconnection of several thousands of computers of different types belonging to the various networks all over the world.
- c) Write any four preventive measures to protect computer system from virus infection.Ans: Any four preventive measures to protect computer system from virus infection are:
i) Write protect your floppy disks when using them on other computers.
ii) Scan the mail or unknown files of internet before opening in your computers.
iii) Use a good antivirus program to scan floppy disk, CD, etc. before copying.
iv) Don’t install pirated software, especially computer games.
- d) Write any two software used for multimedia.Ans: Any two software used for multimedia are:
- i) Windows Media Player
- ii) VLC Media Player
- e) What is hardware security?
Ans: The security given to the various hardware tools or equipment from being lost or damaged due to accidental or intentional harm is hardware security.
- Match the following:
Group AGroup B
a) T-connector i)Network
b) Bridge ii) Power protection
c) CD-ROM iii) Coaxial cable
d) Spike Guard iv)Multimedia component
v)Virus scanningAnswers
Group A Group B
a) T-connector Coaxial cable
b) Bridge Networkc) CD-ROM Multimedia componentd) Spike Guard Power protection
a) T-connector Coaxial cable
b) Bridge Networkc) CD-ROM Multimedia componentd) Spike Guard Power protection
- Select the best answer:
a) Which one is not a network topology?
i) Starii) Ring iii) Client / Server iv) Bus
Client/Server
- b) When was cyber law introduced in Nepal?
i) 2061 B.S.ii) 2062 B.S. iii) 2007 B.S. iv) 2016 B.S.
2061 B.S.
- c) Multimedia technology is used in ………
i) Educationii) Business iii) Health care iv) All of the above
All of the above
- d) Boot sector virus infects ……..
i) System fileii) Master boot record iii) Application software iv) Document file
Master boot record - Give appropriate technical terms:
a) Rules and format to accept and transfer data in the computer network.
Protocol
b) Moral rules to be followed by computer and other professionals.
b) Moral rules to be followed by computer and other professionals.
Computer ethics
c) Making an extra copy of data and software.
c) Making an extra copy of data and software.
Backup
d) A virus that corrupts system files of operating system.
d) A virus that corrupts system files of operating system.
File Infector virus
6. Write the full forms:
6. Write the full forms:
a)WWW = World Wide Web
b)MAN = Metropolitan Area Network
c)OS = Operating System
d)NIC = Network Interface Card
Group B-Database (10 marks)
- Answer the following question:
- a) What is DBMS? Write any two examples of DBMS software.
Ans: DBMS is a software which is used to manage data, manipulate them and provide the information. Examples of DBMS are MS-Access and Oracle.
- b) List any four data types used in MS-Access.Ans: Any four data types used in Ms-Access are:
- i) Text
- ii) Memo
iii) Number
- iv) Yes/No
- c) What is form? Write any two advantages of using form.Ans: Form is an object of MS-Access which provides a user friendly interface to enter data in a table or multiple linked tables.
Any two advantages of using form are:
- It helps to display data in more presentable form than a datasheet can.
- It provides an interactive platform for input of data into the database.
- Select the best answer:
a) Date/Time occupies ……….bytes of memory.
i) 4 ii) 2 iii) 8 iv) 16
8
- b) The extension of database file in MS-Access is……….
i) DBFii) DBM iii) MDB iv)DMB
MDB
- c) The object of MS-Access that is used to generate hard copy of records.
i) Queryii) Table iii) Form iv) Report
Report
- d) A ………….. Key uniquely identifies a record.
i) Primaryii) Foreign iii) Composite iv) None
Primary - Match the following:
Group AGroup B
a) Default value i) 255 Characters
b) Fox Pro ii) Column Name
c) Text iii) DBMS
d) Field iv)Field Properties
v) Search fast
Answers
Group A Group B
a) Default value Field Properties
b) Fox Pro DBMSc) Text 255 Characters
d) Field Column Name
Group A Group B
a) Default value Field Properties
b) Fox Pro DBMSc) Text 255 Characters
d) Field Column Name
Group C-Programming
- a) What is modular program?Modular program is a technique used to divide program into many small, manageable, logical and functional modules or blocks.
- b) Write any two advantages of Structured programming.Ans: Any two advantages of Structured programming
- i) It is a high level language with some features of low level language.
ii) It is mostly used to prepare system software. - c) Write the function of following statement:
- i) Files
Ans: The FILES statement displays the files of the current sub directory or specified sub directory.
- ii) KILL
Ans: The KILL statement deletes the file or files from the specified drive and directory. - Debug the given program:
DECLARE SUB Fibonic()
REM *Fibonic series*
CALL SUB Fibonic
ENDSUB Fibonic
a=1
b=1
FOR x=1 to 10
DISPLAY a;
a=a+b
b=a+b
END Fibonic
Debugged program
DECLARE SUB Fibonic( )
REM *Fibonic series*
CALL FibonicEND
DECLARE SUB Fibonic( )
REM *Fibonic series*
CALL FibonicEND
SUB Fibonic
a=1
b=1
FOR x=1 to 10
PRINT a;
a=a+b
b=a+b
a=1
b=1
FOR x=1 to 10
PRINT a;
a=a+b
b=a+b
NEXT x
END SUB
END SUB
- Write the output of the following program.
DECLARE SUB Series()
CALL Series
ENDSUB Series
X=1
Y=1
FOR Z=1 TO 4
PRINT X;
Y=Y+1
X=X*10+Y
NEXT Z
END SUB
- Read the given program and answer the following questions:
DECLARE FUNCTION Num(N)
INPUT N
S=Num(N)
PRINT S
ENDFUNCTION Num(N)
X=Int(17/N)
Y=15 MOD N
Num=X +Y
END FUNCTION - i) Write the name of the function used in the above program.
Ans: The name of the function used in the above program is Num.
- ii) List out the mathematical function (Library function) used in the above program.
Ans: The mathematical function (Library function) used in the above program is INT ( ).
14. i) Write a program using Function Module to calculate and print the volume of a box.
DECLARE FUNCTION VOLUME(L, B, H)
CLS
INPUT “ENTER LENGTH, BREADTH AND HEIGHT”; L, B, H
PRINT “VOLUME OF BOX”; VOLUME(L, B, H)
END
FUNCTION VOLUME (L, B, H)
VOLUME = L*B*H
END FUNCTION
ii) Write a program to declare SUB procedure to print only the vowels from a given word.
DECLARE SUB DISPV (S$)
CLS
INPUT “ENTER ANY WORD”; S$
CALL DISPV(S$)
END
SUB DISPV(S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = “A” OR C$ = “E” OR C$ = “I” OR C$ = “O” OR C$ = “U” THEN
PRINT B$
END IF
NEXT I
END SUB
iii) Write a program to create a sequential data file “Employee.Dat” to store employees’ name, address, age, gender and salary.
OPEN “Employee.dat” FOR OUTPUT AS #1
DO
CLS
INPUT “ENTER EMPLOYEE’S NAME”; N$
INPUT “ENTER ADDRESS”; A$
INPUT “ENTER AGE”; A
INPUT “ENTER GENDER”; G$
INPUT”ENTER SALARY”; S
WRITE #1, N$, A$, A, G$, S
INPUT “DO YOU WANT TO CONTINUE”; CH$
LOOP WHILE UCASE$(CH$) = “Y”
CLOSE #1
END
***
Saturday, February 16, 2019
Wap to display 1, 31,. 531, 7531, 97531
Wap to display
1
3 1
5 3 1
7 5 3 1
9 7 5 3 1
1
3 1
5 3 1
7 5 3 1
9 7 5 3 1
CLS
FOR i = 1 TO 5
c = 2 * i - 1
FOR j = 1 TO i
PRINT c;
c = c - 2
NEXT
PRINT
NEXT
END
Monday, February 4, 2019
PABSON, Kathmandu SEE QUALIFYING EXAM-2075 Answer Solved
SEE QUALIFYING EXAM-2075
Opt II. Computer
Group A
Computer Fundamental (22 marks)
1. Answer the following questions: (5×2=10)
a. What is network interface card? Write down the advantage of it in a network.
Ans: It is a card that connects computer within a network. The advantage is to present the platform for a communication between the computers within a network.
b. What is search engine? For what it is used?
Ans: Search engine is the website that allows the
user to search the information based on keywords on combination of keywords.
They are used to locate specific sites and information.
c. What is the role of multimedia in an advertisement?
Ans: The role of multimedia in advertisement is to
promote any items and approach new user to use it perfectly.
d. Why do the computer systems need regular maintenance?
Ans: Computer system need regular maintenance to keep
the computer hardware in good working condition and it also helps to find out
problems in hardware and correct the problems before they cause several
damages.
e. List any two points to protect your computer from the virus.
Ans: Any two points to protect your computer from the virus are
i) Install a good antivirus program and update its virus definition file frequently.
ii) Do not use pirated software.
i) Install a good antivirus program and update its virus definition file frequently.
ii) Do not use pirated software.
2. a. Perform the binary operation. (2×1=2)
i. (1111 + 1101) – (1001)
Soln:
1 1 1 1
+1 1 0 1
1 1 1 0 0
- 1 0 0 1
1 0 0 1 1
(1111 + 1101) – (1001) = 10011
ii. 1101 ´ 11 ¸ 101
Soln:
1 1 0 1
´ 1 1
1 1 0 1
1 1 0 1
1 1 0 1 ´
1 0 0 1 1 1
Now, Dividing
101) 100111 ( 111
-101
1001
-101
1001
-101
100
-101
100
Quotient = 111
Remainder = 100
b. Convert as indicated. (2×1=2)
i. (235)8 into decimal
Soln:
Converting Octal into Decimal
=2 ´82 + 3 ´ 81 + 5 ´ 80
(235)8 = (157)10
=2´64
+ 3´8
+ 5´1
=128
+ 24 + 5
=157
(235)8 = (157)10
ii. (BA5)16 into binary
Soln:
Converting hexadecimal into Binary,
B = 1011
A = 1010
5 = 0101
=(101110100101)2
(BA5)16 = (101110100101)8
3. Match the following. (4 x 0.5 = 2)
Group A Group B
a. Animation i. The creation and manipulation of picture images in the computer
b. Graphics ii. A system that enables one or more users to move and react with
computer graphics
computer graphics
c. Multimedia iii. The moving graphic images
d. VR iv. The combination of different media
Ans:
Group A Group B
a. Animation i. The moving graphic images
b. Graphics ii. The creation and manipulation of picture images in the
computer graphics
Group A Group B
a. Animation i. The moving graphic images
b. Graphics ii. The creation and manipulation of picture images in the
computer graphics
c. Multimedia iii. The combination of different media
d. VR iv. A system that enables one or more users to move and react with
computer graphics
computer graphics
4. Give the appropriate technical terms of the following: 2 (4×0.5=2)
a. A mode of transmission in which data flows in the both directions, but only one at a time.
Ans: Half Duplex Mode
b. Message sent electronically through computer network.
Ans: E-mail
c. A class of program that searches your hard drive and floppy disks for any known or potential virus.
Ans: Antivirus Software
d. The technique used to provide medical information and services through the internet.
Ans: E-medicine
4. Choose correct answer. (4 x 0.5 = 2 )
6. Write the full forms of the followings. (4X 0. 5 = 2)
POP : Post Office Protocol
DVD : Digital Versatile Disk
MBR : Master Boot Record
VHF : Very High Frequency
a. Opera and Firefox is a/an.................
i. chat program ii. Web browser
iii. search engine iv. None of the above
b. The temperature in the computer system should be maintained between ..... to ....
i. 210
C to 240 C ii. 220
C to 250 C iii. 230
C to 260 C iv. None of above
c. Main component of multimedia
i. Floppy disk ii. Magnetic disk iii. Sound card iv. All of the above
d. Some of the methods of hardware protection are
i. Password Policy ii. Security Lighting iii. Scan disk iv. All of the above
Group ‘B’
[Database Management System - 10 Marks]
7. Answer the following questions: (3×2=6)
a. What is an electronic database? List any two advantages of it.
Ans: An electronic database refers to an organized collection of data stored in a computer in such a way that its content can be easily accessed. Any two advantages are:
i) We can search data very easily.
ii) Modification is very easy in comparison of manual database.
i) We can search data very easily.
ii) Modification is very easy in comparison of manual database.
b. What is DBMS? What are the applications of DBMS?
Ans: DBMS is a software that helps to extract, view, and manipulate data in an organized way. MS-Access and FoxPro are the applications of DBMS.
c. What is a form and what are the uses of form in MS-Access?
Ans: Form is an object of MS-Access that helps to view, add and modify the content of a file. It gives a separate platform to handle data.
8. Choose the correct answer: (4×0.5=2)
a. A field name can be upto 255 characters long. False
b. OLE is the data type of MS-Access. True.
c. Collecting multiple related fields is called report. False
d. Validation rule specifies the expression that checks the invalid data. True
b. OLE is the data type of MS-Access. True.
c. Collecting multiple related fields is called report. False
d. Validation rule specifies the expression that checks the invalid data. True
9. Match the following. (4 x 0.5 = 2)
Group A Group B
Query - view data
Report - Relationship
One to One - Action query
Delete Query - Extract selected data
- Database software
Group A Group B
Query - Extract selected data
Report - view data
One to One - Relationship
Delete Query - Action query
Group C
[Programming-18 marks]
10. Answer the following questions.
a. What is procedure?
Ans: Procedure is a section of code which performs one or more specific tasks and can be accessed from remote location.
b. Write down the name of different types of operators used by C language?
Ans: The name of different types of operators used by C language are Arithmetic, Relational, Logical, Unary, Conditional and Assignment operator.
c. Write the function of the following statements.
i. NAME...AS: Rename the data file.
ii. LINE INPUT#: Read data assuming a single value.
11. Rewrite the given program after correcting the bugs. 2
REM to copy from old file to new file
OPEN "info.dat" for INPUT AS #1
OPEN "temp.dat" for OUTPUT AS #2
DO UNTIL EOF(1)
INPUT #2, n$, p$, d$, s
WRITE #1, n$, p$, d$, s
WEND
CLOSE #2, #2
END
OPEN "info.dat" for INPUT AS #1
OPEN "temp.dat" for OUTPUT AS #2
DO UNTIL EOF(1)
INPUT #2, n$, p$, d$, s
WRITE #1, n$, p$, d$, s
WEND
CLOSE #2, #2
END
Debugged program:
REM to copy from old file to new file
OPEN "info.dat" for INPUT AS #1
OPEN "temp.dat" for OUTPUT AS #2
DO UNTIL EOF(1)
INPUT #1, n$, p$, d$, s
WRITE #2, n$, p$, d$, s
LOOP
CLOSE #1, #2
END
OPEN "info.dat" for INPUT AS #1
OPEN "temp.dat" for OUTPUT AS #2
DO UNTIL EOF(1)
INPUT #1, n$, p$, d$, s
WRITE #2, n$, p$, d$, s
LOOP
CLOSE #1, #2
END
12. Find the output of the given program. 2
DECLARE FUNCTION RESULT (N)
N = 4
PRINT RESULT (N)
END
FUNCTION RESULT (N)
FOR I = 1 TO N
T = I + 2
D = D + T
NEXT I
RESULT = D
END FUNCTION
Ans: Output is:
N = 4
PRINT RESULT (N)
END
FUNCTION RESULT (N)
FOR I = 1 TO N
T = I + 2
D = D + T
NEXT I
RESULT = D
END FUNCTION
Ans: Output is:
18
13. Study the following program and answer the following questions that follow: 2
DECLARE SUB SERIES(A, R, N)
CLS
CLS
INPUT "ENTER FIRST TERM"; X
INPUT "NUMBER OF TERMS TO BE GENERATED:"; Z
CALL SERIES (X,Y,Z)
END
SUB SERIES (A, R, N)
FOR I = 1 TO N
PRINT A
A=A*R
NEXT
END SUB
INPUT "NUMBER OF TERMS TO BE GENERATED:"; Z
CALL SERIES (X,Y,Z)
END
SUB SERIES (A, R, N)
FOR I = 1 TO N
PRINT A
A=A*R
NEXT
END SUB
a. What will be the output if the user input 3, 2 and 4 for variables X, Y and Z variables?
Ans: The output will be
3
6
12
24
3
6
12
24
b. What type of parameter X, Y and Z are?
Ans: X, Y and Z are actual parameters.
14.
a. WAP to convert Celcius temperature in Fahrenheit using FUNCTION.....END FUNCTION. 3
Solution:
DECLARE FUNCTION TEMP(C)
CLS
INPUT "ENTER THE TEMPERATURE IN CELCIUS:"; C
PRINT "TEMPERATURE IN FAHRENHEIT="; TEMP(C)
END
FUNCTION TEMP(C)
TEMP = 9*C/5+32
END FUNCTION
CLS
INPUT "ENTER THE TEMPERATURE IN CELCIUS:"; C
PRINT "TEMPERATURE IN FAHRENHEIT="; TEMP(C)
END
FUNCTION TEMP(C)
TEMP = 9*C/5+32
END FUNCTION
b. WAP to check whether the input number is palindrome or not using SUB.....END SUB. 3
Solution:
DECLARE FUNCTION CHECK(N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL CHECK(N)
END
SUB CHECK(N)
A=N
REV=0
WHILE N < > 0
R = N MOD 10
REV=REV*10+R
N=INT(N/10)
WEND
IF REV = A THEN
PRINT "IT IS PALINDROME"
ELSE
PRINT "IT IS NOT PALINDROME"
END IF
END SUB
CLS
INPUT "ENTER ANY NUMBER"; N
CALL CHECK(N)
END
SUB CHECK(N)
A=N
REV=0
WHILE N < > 0
R = N MOD 10
REV=REV*10+R
N=INT(N/10)
WEND
IF REV = A THEN
PRINT "IT IS PALINDROME"
ELSE
PRINT "IT IS NOT PALINDROME"
END IF
END SUB
c. Create a sequential data file "std.dat" to store names and marks obtained in English, Math Science subjects for few students. 3
OPEN "std.dat" FOR OUTPUT AS #1
DO
CLS
INPUT"Enter your name"; N$
INPUT "Enter marks in English"; E
INPUT "Enter marks in Math"; M
INPUT "Enter marks in Science"; S
WRITE #1, N$, E, M, S
INPUT "Do you want to continue or not(y/n)"; ch$
LOOP WHILE UCASE$(ch$)="Y"
CLOSE #1
END
DO
CLS
INPUT"Enter your name"; N$
INPUT "Enter marks in English"; E
INPUT "Enter marks in Math"; M
INPUT "Enter marks in Science"; S
WRITE #1, N$, E, M, S
INPUT "Do you want to continue or not(y/n)"; ch$
LOOP WHILE UCASE$(ch$)="Y"
CLOSE #1
END
óóó
Subscribe to:
Posts (Atom)