Class-6 Chapter 7 Solutions To Lab Assignments and Exercise

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Class-6 Chapter 7 Solutions to lab assignments and exercise

Page 82
1. WAP to accept a number from the user and check whether the number is positive, negative or
equal to zero.
Ans:- CLS
INPUT “ Enter any number:-“, N
IF N>0 THEN PRINT “ The number entered is positive”
IF N<0 THEN PRINT “ The number entered is negative”
IF N=0 THEN PRINT “ The number entered is zero”
END
2. WAP to accept a number. If the number is 10 then display “You Won” otherwise display “Sorry!
You Lost”.
Ans:- CLS
INPUT “Enter any number:-“, N
IF N=10 THEN PRINT “You Won” ELSE PRINT “Sorry! You Lost”
END
3. WAP to accept the age of a person, if the age is above or equal to 18 years, then display “Eligible
to vote” else display “Not eligible to vote”.
Ans:- CLS
INPUT “Enter the age of the person:-“,Age
IF Age>=18 THEN PRINT “Eligible to vote”
IF Age<18 THEN PRINT “Not eligible to vote”
END
4. WAP to display “Pass” if the marks in Maths is above 35, else display “Fail”.
Ans:- CLS
INPUT “Enter the marks of Maths:-“, M
IF M>35 THEN PRINT “Pass”
IF M<35 THEN PRINT “Fail”
END
Page -84
1. WAP to accept year number from the user and check if it is a leap year.
Ans:- CLS
INPUT “Enter the year number:-“,Y
R=Y MOD 4
IF R>0 THEN PRINT “Leap Year”
ELSE PRINT “Not a Leap Year”
END
2. WAP to accept two numbers and display the smaller number.
Ans:- CLS
INPUT “Enter any two number:-“, A, B
IF A>B THEN PRINT B ;”is the smaller number”
ELSE PRINT A ;”is the smaller number”
END
3. WAP to accept mrks of four subjects and find the sum and average. If the average is greater than
60 then print the average along with a message “WELL DONE” else give the message “WORK
HARD”.
Ans:- CLS
INPUT “Enter marks of English :-“,E
INPUT “Enter marks of Hindi :-“,H
INPUT “Enter marks of Maths :-“,M
INPUT “Enter marks of Science :-“,S
Sum= E + H + M + S
Avg= Sum/4
IF Avg>60 THEN PRINT “Average=”;Avg ;” WELL DONE”
ELSE PRINT “Average=”;Avg ;” WORK HARD”
END
4. WAP to accept a number from the user and find whether the number is divisible by 9 or not.
Ans:- CLS
INPUT “Enter any number:-“,N
R= N MOD 9
IF R = 0 THEN PRINT “ The number is divisible by 9”
ELSE PRINT “The number is not divisible by 9”
END
EXERCISE
1. What will be the output of the following programs:-
(a) It will display the product of the number P and Q as entered by the user
(b) It will display the quotient of X divided by Y and the sum of X and Y as entered by the
user.
(c) It will display the message UR2 SWEET after that the Name entered and in the next line
it display SORRY.
(d) It will display the first 6 multiples of any number B as entered by the user.
2. Correct the following programs:-
(a) INPUT P
PRINT P +100 (Correct)
(b) INPUT R
PRINT R (Correct)
(c) INPUT A, B
PRINT A, B (Correct)
(d) INPUT M (Correct)
PRINT M/6:M (Correct)
(e) INPUT X,Y
PRINT X,Y
(f) INPUT L (Correct)
LET Z=L*L
PRINT Z
3. Match the column:-
(a) Executable Statement PRINT
(b) Assignment Statement LET
(c) Non Executable Statement REM
(d) Decision Making Statement IF……THEN
4. (a) If A=B then print “A is equal to B” else A<>B.
(b) Wrong Statement
(c) (Correct Statement)
(d) (Correct Statement)
5. Differentiate between ‘If….. Then’ and ‘If…. Then…..Else’ statement.
Ans:- If……then statement is a simple decision making statement is used in a program in a
situation when there in only one answer or alternative for solution.
If…..then……else statement consists of one condition along with two alternatives of
action for solution.
6. What is decision making?
Ans: When we come across many situation in which we are required to take decision in a
particular one we use decision making statements like If….Then, If…..Then else etc.
7. INPUT ‘Enter the Name of Employee:-, NAME$
(Correct Statement)
INPUT ‘Enter the no. of working days in June :’, WD
(Correct Statement)
SALARY= WD * PDW
PRINT ‘No. of working days in June :”, WD
(Correct Statement)
8. (a) CLS
INPUT “Enter the side of the square:-“, S
AREA = S * S
PRINT “Area of the square is “,AREA
END
(b) Same as Pg 82 Question no. 3
(c) CLS
INPUT “Enter the number:-“, N
A=N MOD 2
IF A=0 THEN PRINT “No. entered is even”
ELSE PRINT “No. entered is odd”
END
(d) CLS
INPUT “Enter the three numbers:-“, A, B, C
SUM=A+B+C
AVG=SUM/3
PRINT “Average of three numbers=”,AVG
END
(e) CLS
INPUT “Enter the three numbers:-“, A, B, C
SUM=A+B+C
PRINT “Sum of three numbers=”,SUM
END
(f) CLS
PRINT “WELCOME”
9. (a) INPUT
(b) Correct program will be-
LET E=78, M=94
TOTAL = E+M
PRINT TOTAL
END

You might also like