STD 6 CH 5 HW SCH 05

You might also like

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

Page number : 1

UNIT TEST 4
HOME WORK SCHEDULE NUMBER: 05
CLASS: VI (6) SUBJECT: COMPUTER SCIENCE
Chapter: 5 Basics Of Small Basics

Exercise question answer


Objective Type Questions
1. Fill in the blanks with the correct words.
a) A Program is a set of instructions written for the computer to perform a
particular task.
b) Debug means to check for errors and remove them.
c) Press F5 to run the program written in the Editor.
d) 1234 and -54.34 are the examples of Numeric constants.
e) A Variable is an area in a computer’s memory that has a name and that
stores data temporarily.
2. write True and False.
a) You cannot use a keyword as a variable name. True
b) Mathematical calculation can also be performed with string constant. False
c) The string concatenation operator is &. False
d) / operator is executed before + operator. True
e) Comparison operators result in either true or false. True

3. Choose the correct option.

a) This is a comparison operator used for non-equality


Ans. iv). <>
b) The comment statement starts with this symbol.
Ans. ii). ‘
c) This method is used to read string as an input.
Ans. iii). Read()
d) What is the output of Math.Power(-2,3)?
Ans. ii). -8
Page number : 2

e) What is the output of 23 + 33 / 3 ?


Ans. i). 34

Descriptive Type Questions


Answer the following:
1. What is a comment statement? How will you add a comment
statement in a program?
Ans. In computer programming, the comment statement is used to provide
an explanation about the code.
In Small Basic, an apostrophe (‘) is used as the comment symbol. Anything
written after the comment symbol will be ignored by the compiler when we
run the program.
For example:
RollNo = 20 ‘class roll number of the student

2. What is concatenation? Explain with an example.


Ans. Concatenation means to join one string to another. The concatenation
or joining operator is a plus sign (+).

For example:
ConcatenatedString = “Learning Small Basic “ + “ is Fun!”
After execution of this statement, the variable ConcatenatedString will
have the value “Learning Small Basic is Fun!”.

3. List all the comparison operators available in Small Basic.


Ans. All the comparison operators available in Small Basic are:
Operator Operation
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
= Equal to
<> Not equal to

4. What are the three formats of If statement in Small Basic?


Ans. The three formats of If statement in Small Basic are:
i). If-Then Statement
Its syntax is:
If (condition) Then
Page number : 3

(Statements to be executed if the condition is true)


EndIf

ii). If-Then-Else Statement

Its syntax is:


If (condition) Then
(Statements to be executed if the condition is true)
Else
(Statements to be executed if the condition is false)

EndIf

iii). If-Then-ElseIf Statement

Its syntax is:


If (condition 1) Then
(Statements to be executed if the condition 1 is true)
ElseIf (condition 2) Then
(Statements to be executed if the condition 1 is false and condition 2
is true)
ElseIf (condition 3) Then
(Statements to be executed if the condition 1 and 2 are false and
condition 3 is true)
Else
(Statements to be executed if all the given conditions are false)
EndIf

5. Write the rules for naming a variable in Small Basic.


Ans. The rules for naming a variable in Small Basic are:
i). A variable name can only include letters, numbers and the
underscore character.
ii). The first character must be a letter.
iii). The variable name cannot be a reserved word of Small Basic
Page number : 4

Extra question answer


1. What is the full form of BASIC?
Ans. The full form of BASIC is Beginners All-purpose Symbolic Instructions
Code.
2. Give some suggestions to write a variable name properly.

Ans. Some suggestions to write a variable name properly are:


• If a variable name consists of more than one word, the words should be
joined together using an uppercase letter or an underscore character.
• Variable names should be meaningful, i.e., it should indicate the data stored
in the variable. For example, StudentName, TotalMarks, and Emp_Salary.
3. Explain the following Math Library Methods with example.
Ans. Method Explanation Example
Math.Max(Arg1,Arg2) It compares two numbers and Math.Max(90, 100) = 100
returns the greater of the two
numbers.
Math.Min(Arg1Arg2) It compares two numbers and Math.Min(90, 100) = 90
returns the smaller of the two
numbers.
Math.Floor(Arg1) It returns an integer that is less Math.Floor(35.28) = 35
than or equal to the specified Math.Floor(67.99) = 67
decimal number.
Math.Remainder It gives the remainder obtained Math.Remainder(14, 8)
(Arg1, Arg2) when two whole numbers are =6
divided. Math.Remainder(14,3) =2
Math.Power(Arg1, Arg2) It gives the result obtained by Math.Power(2,4) = 16
multiplying Arg1 by itself, Arg2
number of times.
Math.SquareRoot(Arg1) It gives the positive square root Math.SquareRoot(36) = 6
of a given number.

You might also like