Thursday, October 3, 2024

IMP programming for class 9

 

QBASIC CLASS IX


WRITE THE PROGRAMS FOR THE FOLLOWINGS

1. Write a program to input three different numbers and print their sum and product.
CLS
INPUT "Enter first number";n1
IPNUT "Enter second number";n2
IPNUT "Enter third number";n3
PRINT "SUM = ";n1+n2+n3
PRINT "PRODUCT = ";n1*n2*n3
END
2. WRITE A PROGRAM TO INPUT THE LENGTH AND PRINT THE PERIMETER OF A SQUARE
CLS
IPNUT "ENTER LENGTH";L
PRINT "PERIMETER = ";4*L
END
3. WRITE A PROGRAM TO INPNUT NEPALI CURRENCY AND CONVERT IT INTO INDIAN CURRENCY.
CLS
INPUT "ENTER NEPALI CURRENCY";N
PRINT "EQUIVALENT INDIAN CURRENCY =";N/1.6
END
4. WRITE A PROGRAM TO ENTER A NUMBER AND CHECK WHETHER TH NUMBER IS PALINDROME OR NOT.
CLS
INPUT "ENTER A NUMBR";N
T=N
WHILE N>0
                        R=N MOD 10
                        REV=REV*10+R
                        N=INT(N/10)
WEND
IF T=REV THEN
                        PRINT "THE NUMBER IS PALINDROME"
ELSE
                        PRINT "THE NUMBER IS NOT PALINDROME"
END IF
END
5. WRITE A PROGRAM TO INPUT A NUMBER AND CHECK WHETHER THE NUMBER IS ARMSTRONG OR NOT.
CLS
INPUT "ENTER A NUMBER";N
T=N
WHILE N>0
                        R = R MOD 10
                        ARM = ARM + R ^ 3
                        N = N \ 10
WEND
IF ARM = T THEN
                        PRINT "THE NUMBER IS ARMSTRONG"
ELSE
                        PRINT "THE NUMBER IS NOT ARMSTRONG"
END IF
END
6. WRITE A PROGRAM TO CHECK WHETHER A STRING IS PALINDROME OR NOT.
CLS
INPUT "ENTER A WORD";W$
FOR I = LEN(W$) TO 1 STEP -1
                        REV$ = REV$ + MID$(W$,I,1)
NEXT I
IF W$ = REV$ THEN
                        PRINT "PALINDROME"
ELSE
                        PRINT "NOT PALINDROME"
END IF
END
7. WRITE A PROGRAM TO CHECK WHETHER AN INPUT NUMBER IS PRIME OR COMPOSITE.
CLS
INPUT "ENTER A NUMBER";N
FOR I = N -1 TO 2 STEP -1
                        IF N MOD I = 0 THEN
                                                PRIME = 0
                                                GO TO DOWN
                        ELSE
                                                PRIME =1
                        END OF
NEXT I
DOWN:
IF PRIME = 1 OR N =1 OR N =2 THEN
                        PRINT "PRIME"
ELSE
                        PRINT "COMPOSITE"
END IF
END
8. WRITE A PROGRAM TO DISPLAY "SWARNIM PUBLICATION PVT LTD" 10 TIMES USING WHILE....WEND
CLS
I = 1
WHILE I<=10
                        PRINT "SWARNIM PUBLICATION   PVT LTD"
                        I = I + 1
WEND
END
9. WRITE A PROGRAM TO PRINT FIRST 25 NUMBERS USING DO...LOOP
CLS
I = 2
DO
   PRINT I,
   I = I + 2
LOOP WHILE I <= 50
END
10. WRITE A PROGRAM TO FIND OUT FACTORIAL OF A GIVEN NUMBER USING FOR... NEXT
CLS
INPUT "ENTER A NUMBER";N
F = 1
FOR I = 1 TO N
   F = F * I
NEXT I
PRINT N;"! = ";F
END
11. WRITE A PROGRAM TO INPUT MARKS OF ALL YOUR SUBJECTS AND PRINT TOTAL, PERCENTAGE, RESULT AND DIVISION
CLS
INPUT "MARKS IN NEPALI";N
INPUT "MARKS IN SCIENCE";S
INPUT "MARKS IN SOCIAL";SO
INPUT "MARKS IN ENGLISH";E
INPUT "MARKS IN MATHS";M
INPUT "MARKS IN OPT";O
INPUT "MARKS IN HPE";H
INPUT "MARKS IN COMPUTER";C
IF N>=40 AND S>=40 AND SO>=40 AND E>=40 AND M>=40 AND O>=40 AND H>=40 AND C>=40 THEN
                        RESULT$="PASS"
ELSE
                        RESULT$="FAIL"
END IF
TOTAL = N + S + SO + E + M + O + H + C
PERCENT = (TOAL / 800) * 100
IF PERCENT >=80 THEN
                        DIV$ = "DISTINCTION"
ELSEIF PERCENT >=60 THEN
                        DIV$ = "FIRST"
ELSEIF PERCENT >= 45 THEN
                        DIV$ = "SECOND"
ELSE
                        DIV$ = "THIRD"
END IF
PRINT "TOTAL: ";TOTAL
PRINT "PERCENT: ";PERCENT
PRINT "DIVISION: ";DIV$
PRINT "RESULT: ";RESULT$
END
12. WRITE A PROGRAM TO FIND THE AREA OF A CUBE. [HINT: A=6L2]
CLS
INPUT "ENTER THE LENGTH";L
PRINT "AREA = "; 6 * L ^ 2
END
13. WRITE A PROGRAM TO FIND THE CURVED SURFACE AREA OF A SQUARE.[A=2πRH]
CLS
PI = 22/7
INPUT "ENTER THE RADIUS";R
INPUT "ENTER THE HEIGHT";H
PRINT "CURVED SURFACE AREA = ";2 * PI * R * H
END
14. WRITE A PROGRAM TO FIND THE TOTAL SURFACE AREA OF A CYLINDER.[A=2πR(R+H)]
CLS
PI = 22/7
INPUT "ENTER THE RADIUS OF BASE OF CYLINDER";R
INPUT "ENTER THE HEIGHT OF THE CYLINDER";H
PRINT "SURFACE AREA = "; 2 * PI * R * (R + H)


END
15. WRITE A PROGRAM TO CALCULATE THE DISTANCE TRAVELLED BY BODY. [S=UT+1/2AT2]
CLS
INPUT "ENTER THE INITIAL VELOCITY"; U
INPUT "ENTER TIME";T
INPUT "ENTER ACCELERATION";A
PRINT "DISTANCE TRAVELLED = "; U * T + (1/2) * A * T ^ 2
END
16. WRITE A PROGRAM TO INPUT THE TEMPERATURE IN FAHRENHEIT AND DISPLAY IN DEGREE CELSIUS.
CLS
INPUT "TEMPERATURE IN FAHRENHEIT";F
PRINT "TEMPERATURE IN CELCIUS = "; ((F - 32) * 5)/9
END

6. WRITE PROGRAM TO GENERATE FOLLOWING SERIES
A. 2, 4, 6, 8......... UP TO 10TH TERM
CLS
FOR I = 2 TO 20 STEP 2
PRINT I;
NEXT I
END
B. 1, 8, 27, 64, .......... UP TO 10TH TERM
CLS
FOR I = 1 TO 10
PRINT I^3;
NEXT I
END
C. 100, 98, 96, 94.... UP TO 10TH TERM
CLS
I = 1
A = 100
WHILE I<=10
PRINT A;
A = A - 2
I = I + 1
WEND
END
D. 1, 4, 9, ......... UP TO 10TH TERM
CLS
FOR I = 1 TO 10
PRINT I ^ 2;
NEXT I
END
E. 5, 25, 125 .......... UP TO 10TH TERM
CLS
FOR I = 1 TO 10
PRINT 5 ^ I;
NEXT I
END
F. 1, 2, 3, 6, 11, 20, 37.... UP TO 10TH TERM
CLS
A = 1
B = 2
C = 3
FOR I = 1 TO 10
D = A + B + C
SWAP A, B
SWAP B, C
SWAP C, D
PRINT D;
NEXT I
END
G. 5, 16, 8, 4, 2, 1, 4, 2, 1, 4
CLS
A = 5
FOR I = 1 TO 10
PRINT A;
IF A MOD 2 = 0 THEN
A = A \ 2
ELSE
A = A * 3 + 1
END IF
NEXT
END
H. 66666, 6666, 666, 66, 6.
CLS
A = 66666
FOR I = 1 TO 5
PRINT A;
A = A \ 10
NEXT I
END
I. 2, 8, 18, 32, ........ UP TO 10TH TERM
CLS
A = 2
B = 6
FOR I 1 TO 10
PRINT A;
A = A + B
B = B + 4
NEXT I
END
J. 7, 22, 11, 34, 17, 52, 26, 13, 40, 20.
CLS
A = 7
FOR I = 1 TO 10
PRINT A;
IF A MOD 2 = 0 THEN
A = A \ 2
ELSE
A = A * 3 + 1
END IF
NEXT I
END
K. 1/2, 2/3, 3/4, ...... UP TO 10TH TERM
CLS
FOR I = 1 TO 10
PRINT I; "/"; I + 1;
NEXT I
END
7. WRITE A PROGRAM TO DISPLAY THE GICEN OUTPUT.
A. 54321
   4321
   321
   21
   1
CLS
FOR I = 5 TO 1 STEP -1
FOR J = I TO 1 STEP -1
PRINT J;
NEXT J
PRINT
NEXT I
END

B. 11111
   2222
   333
   44
   5
CLS
FOR I = 1 TO 5
FOR J = 5 TO I STEP -1
PRINT I;
NEXT J
PRINT
NEXT I
END

C. 5
   54
   543
   5432
   54321
CLS
FOR I = 5 TO 1 STEP -1
FOR J = 5 TO I STEP -1
PRINT J;
NEXT J
PRINT
NEXT I
END

D. 1
   13
   135
   1357
CLS
FOR I = 1 TO 7 STEP 2
FOR J = 1 TO I STEP 2
PRINT J;
NEXT J
PRINT
NEXT I
END

E. 1 2 3
   2 3 4
   3 4 5
   4 5 6
   5 6 7
CLS
FOR I = 0 TO 4
FOR J = 1 TO 3
PRINT I +J;
NEXT J
PRINT
NEXT I
END

F. 1
   33
   555
   7777
CLS
FOR I = 1 TO 7 STEP 2
FOR J = 1 TO I STEP 2
PRINT I;
NEXT J
PRINT
NEXT I
END

Class 9 computer Science

  Group A [10 Marks]

1. Answer the following questions in one sentence:     (6×1=6)

a) List any two features of a  computer system.

b) Why are buses used for motherboards?

c) List any two hard copy output devices.

d) Define utility software.

e) What is flowchart?

f) What is HTML?

2. Write the technical term for the following statements: (2×1=2)

a) The software which is designed to meet the requirement of a specific group of users.

b) The smallest and fastest memory located in the CPU.

3. Write the full forms of the following:                          (2×1=2)

a) BD

b) UPS

             Group B [ 24 marks ]

4. Answer the following questions:                                (9×2=18)

a) What is a computer system? Draw the basic architecture of the computer system.

b) What is a soft copy output device? Give any two examples of soft copy output devices.

c) Why is RAM called volatile memory?

d) Differentiate between compiler and interpreter.

e) Why is windows called a multitasking operating system?

f) Why do you use the universal selector?

g) What is a programming language? List any two types of programming language.

h) Write any four rules for naming the variable in QBASIC program.

i) What is the operating system? List any two functions of it.

5. Write the output of the given program showing the dry run table. (2)

CLS

A= 10

B= 10

D= A-B

PRINT D

SWAP A, B

D= A-B

PRINT D

END

6. Debug the following program: (2) 

CLS

REM to check whether the inputted number is Prime or Composite.

INPUT "Enter a number:-";N

FOR I= 1 to N-1

LET R= A\I

IF R= 0 THEN F=F+1

WEND I

IF F= 2 THEN

PRINT "PRIME"

ELSE

PRINT "COMPOSITE"

IF END

END

7. Read the following program and answer the given questions. (2)

CLS

S= 0

X= 1

While X <= 5

i= X^2

S= S+i

X= X+1

Wend

Print S

END

Questions:

a) How many times does the loop execute in this program?

b) What will happen if statement X= X+1 is removed?

    Group C Long question [16 marks]

8. Create a table using HTML, tags as given below,                        (4)

                           Awarded Students

S.N.Name of StudentsClassPosition
1.Parbati Paudel91st
2.Aarshee Acharya102nd

9. a) Define Hyperlink. List and explain types of link with suitable examples. (4)

    b) Write a program to input the side of a cube and display volume and total surface area. (Hint VOC= length3 and TSA=6*Length2] (4)

10. WAP to input a number and display its factors. (4)

                                    OR

 WAP to input a number and find whether it is Armstrong or not.

Wednesday, July 10, 2024

Grade 9 Computer Questions model question

 Model Question Set 10

Group A 
“Fundamentals” [22 marks]
1.        Answer the following questions.               5×2=10
         a) Write down the functions of system software.
         The function of system software is that it is used for designing to operate the computer hardware, to provide basic functionality, and to provide platform for running applications software.

         b) Define software with any four examples of it.
         Software is an organized collection of programs, which is responsible for controlling and managing the hardware components of computer system to perform specific tasks. Any four examples of it are:-
         i) Operating System
         ii) Device Driver
         iii) Language Translator
         iv) Utility Software

         c) Wrie any two advantages of flowchart.
         Any two advantages of flowchart are:-
         i)  Flowcharts are better way of communicating the logic of a system to all concerned.
         ii) With the help of flowchart, problem can be analysed in more effective way.

         d) What do you know about monitor? Explain.
         Monitor is a piece of computer hardware that displays the videos and graphics information generated by a connected computer through the computers video card. Monitors are similar to TVs but usually display information at a much higher resolution.

         e) Define the term output device with any four examples of it.
         Any devices that displays information from computer is called output device. Any four examples of it are:-
         i) Monitor
         ii) Speaker
         iii) Projector
         iv) Printer

2.       a) Convert the following number.             2
            i) (740)10 = (?)16 ii) (746)8= (?)10
         b) Perform binary operation.                       2
            i) 111001 - 1010  ii) (10100)2 × (1010)2
3.       Match the following pairs:                    2
a.   HTML                  b. Direct storage access
b.  Hard disk         - Low level language
c.   C                 a. Markup language
d.  Moderm          c. High level language
                              d. Peripheral
4.       State true or false.                          2
         a) ROM is permanent memory. True
         b) Hard disk is also used a backup memory. True
         c) Pen dirve is used as secondary storage. True
         d) QBASIC is a low-level language. False
5.       Give the appropriate technical term:                2
         a) A peripheral device which does mathematical as well as logical operations. ALU
         b) A device loses the stored information in a very short time if power supply is off. RAM
6.       Give the full form:                           2
         a) IBM PC – International Business Machine Personal Computer     
b) IKBS – Intelligent Knowledge Based System
c) CMOS - Complementary Metal-Oxide Semiconductor
d) OCR – Optical Character Recognition 
Group B :
DOS + Windows [5 marks]
7.       a) Mention any two reasons why windows is more popular than DOS.1
         Any two reasons why windows is more popular than DOS are:-
         i) Ease of use: All versions of Microsoft Windows have something common in it which makes users easy to shift from one version to another.
         ii) Software support: Windows platform is best suited for game and software developers.

         b) Give the meaning of ‘Drag’ and ‘Drop’ in windows OS.           1
         Drag and drop is a pointing device gesture in which the user selects a virtual object by “grabbing” it and dragging it to a different location or onto other virtual object.

         c) Is the operating system of computer and mobile same ?           1
         No, the operating system of computer and mobile is not same.

         d) Write the functions carried out by following DOS commands:  2
            a) C:\>XCOPY/TEMP\*.*\S  D:\
            It It copies all the directories and sub directories of sub directory TEMP of C drive except empty ones to D drive
            b) C:\>COPY  C:\MYFILES\*.DOC A:\DATA
            It copies all the files having DOC as extension of sub directory MYFILES of C drive to the sub directory of A Drive.
Group C :
HTML [5 marks]
8.       Answer the following questions.                     2
         a) For what purpose is IMG tag used ?
         It is used to insert image in HTML document.


         b) What is meant by email ?Explain ?
         Email is method of exchanging messages between people using electronic devices. It allows you to send and receive messages to and from anyone
         with an email address, anywhere in the world.

         c)  What is the importance of HTML ?
         HTML is essential because of its web paged application. HTML also helps to introduce beginners to the programming world. HTML has many applications and uses which makes it very important programming language in the world.
         d) State true or false.                                   2
            i) Pictures in HTML documents cannot be used as links. False
            ii) Font color can not be used with <font> tag. False
            iii) HTML is basic for markup language. True
            iv) The collection Web Page is called Web Site. True
Group D :
Programming [18 marks]
9.       Answer the following questions.                     2
         a) Give any two features of QBasic.                1
         Any two features of QBASIC are:-
         i) It is simple and easy to learn.
         ii) It has dynamic program debugging.

         b) What is operator ? Explain with example.        1
         Operators are the symbols which help us to perform various types of operation within a program. Its examples are:-
         i) Arithmetic Operator – MOD, +, *, /
         ii) Relational Operator - <, >, =
         iii) Logical Operator – AND, NOT, OR
         iv) String Operator 

10.      Write an algorithm to display multiplication table of any number. 2
         
11.       a) Write the output of the program.              2
            FOR I = 1 TO 3
                  LET J = 1
            WHILE J < = 4
            LET B = I
                  PRINT B;
            LET J = J + 1
            WEND
            PRINT
            NEXT I
            END
1    1  1  1
2   2  2  2
3   3  3  3
         b) Debug the program.                             2
         CLS
         A=5
         B=1
         DO WHILE B<=5
         PRINT   A
         A=A*5
         B=B+1
         LOOP
         END
12.      Read the following program and answer the following questions:  2
            CLS
            FOR I = 1 TO N - 1
                  IF N MOD I = 0 THEN
            IF I = 1 OR I = 2 OR I = 3 THEN
                  PRINT I;
            END IF
            IF I>=4 THEN
            FOR J = 2 TO I - 1
            IF I MOD J = 9 THEN
                  GOTO X
            END I F
            NEXT J
            PRINT I;
            END IF
            END IF
            X:
            NEXT I
            END
a)  What will be output of the program if the value of N = 10.
Output:
1  2  5
b)  What is the function of MOD which is used in the program.
To return remainder.
13.      a) Write a program to enter any sentence and count total number of vowels, consonants and spaces.                   3
            CLS
INPUT "ENTER ANY STRING"; S$
VC = 0
CC = 0
WC = 0
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
VC = VC + 1
ELSEIF C$ < > "A" AND C$ < > "E" AND C$ < > "I" AND C$ < > "O" AND C$ < > "U" THEN
CC = CC + 1
ELSEIF B$ = " " THEN
WC = WC + 1
END IF
NEXT I
PRINT "TOTAL NO. OF VOWELS= "; VC
PRINT "TOTAL NO. OF CONSONANTS="; CC
PRINT "TOTAL NO. OF SPACES="; WC
END
         b) Write a program to display fibonacci series up to nth terms.  3
         CLS
         INPUT “Enter any number”; N
A=1
         B=1
         FOR I = 1 TO N
            PRINT A
            C=A+B
            A=B
            B=C
         NEXT I
         END


c) Write a program to enter any two numbers and find addition, subtraction, multiplication and division by using SELECT CASE statement.                                        2

CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
TOP:
PRINT "PRESS 1. FOR ADDITION"
PRINT "PRESS 2. FOR SUBTRACTION"
PRINT "PRESS 3. FOR MULTIPLICATION"
PRINT "PRESS 4. FOR DIVISION"
INPUT "ENTER YOUR CHOICE"; C
SELECT CASE C
    CASE 1
        PRINT "SUM OF TWO NUMBERS="; A + B
    CASE 2
        PRINT "SUBTRACTION OF TWO NUMBERS="; A - B
    CASE 3
        PRINT "PRODUCT OF TWO NUMBERS="; A * B
    CASE 4
        PRINT "DIVISION OF TWO NUMBERS="; A / B
    CASE ELSE
        PRINT "CHOOSE NO.S FROM 1 TO 4 ONLY"
END SELECT
INPUT "DO YOU WANT TO CONTINUE(Y/N)"; CH$
IF UCASE$(CH$)="Y" THEN GOTO TOP
END




End