1.Which of the following statement is also known as bi-directional statement?
(a) If-Then-ElseIf
(b) If-Then
(c) End
(d) None of these
Answer: (a) If-Then-ElseIf
2.Which of the following is not a reserved word?
(a) If-Then-ElseIf
(b) Then
(c) End
(d) None of these
Answer: (a) If-Then-ElseIf
3.The __________ program for a specific number of times.
(a) Goto
(b) If-Then
(c) Three
(d) None of these
Answer: (b) If-Then
4.In how many categories does the control statements divided in Small Basic?
(a) Two
(b) Three
(c) Four
(d) Five
Answer: (a) Two
5.__________ statement is used to check a number of conditions in the program.
(a) If-Then
(b) If-Then-ElseIf
(c) If-Then-Else
(d) None of these
Answer: (b) If-Then-ElseIf
B. Write ‘T’ for true and ‘F’ for false:
1.The word If is followed by the condition.
Answer: T
2.The Goto statement is referred to as a conditional transfer control.
Answer: F
3.We can assign the same name to more than one label.
Answer: F
4.The If-Then statement is also known as bi-directional statements.
Answer: F
5.If the condition is true then the instruction specified after Then is executed.
Answer: T
C. Fill in the blanks:
1.Branching statements are also known as __________.
Answer: control statements
2.The __________ statement is the simplest conditional statement in Small Basic.
Answer: If-Then-Else
3.A __________ identifies a location within a program.
Answer: label
4.__________ statement is an action to be taken when a condition is met.
Answer: Goto
D. Answer the following questions:
1.What are branching statements?
Answer: Branching statements are statements that allow the program to change the normal sequential flow of execution based on certain conditions.
2.Explain the use of If-Then statement with the help of an example.
Answer: The If-Then statement is used to execute a block of code only when a given condition is true.
Example:
If marks >= 40 Then
Print "Pass"
End If
3.What is the use of If-Then-Else statement?
Answer: The If-Then-Else statement executes one block of code when the condition is true and another block when the condition is false.
4.Explain the use of If-Then-ElseIf statement.
Answer: The If-Then-ElseIf statement is used to check multiple conditions in sequence and execute the block for the first true condition.
Example:
If marks >= 75 Then
Print "Distinction"
ElseIf marks >= 60 Then
Print "First Class"
ElseIf marks >= 40 Then
Print "Pass"
Else
Print "Fail"
End If
5.Write a short note on Goto statement.
Answer: The Goto statement transfers program control unconditionally to a specified label. It is used to jump to another part of the program.
6.Explain the use of If-Then statement with Goto statement.
Answer: If-Then statement with Goto is used for conditional jumping. The program jumps to a label only if the condition is true.
Example:
If age < 18 Then Goto Minor
Print "Adult"
Goto EndProgram
Minor:
Print "Minor"
EndProgram:

No comments:
Post a Comment