Basic Programing III - SS3 ICT Past Questions and Answers - page 1
What is the purpose of the FOR-NEXT statement in BASIC?
To declare variables
To create loops
To print text
To define functions
Which BASIC statement is used for creating loops based on a condition?
IF-THEN
GOTO
WHILE-END
In a FOR-NEXT loop, if you want to execute a block of code 5 times, what is the appropriate syntax?
FOR i = 1 TO 10
FOR i = 1 TO 5
FOR i = 1 UNTIL 5
FOR i = 5 TO 1
How many times will the following FOR-NEXT loop execute?
css Copy code
FOR x = 3 TO 7
3 times
4 times
5 times
7 times
What is the purpose of the DIM statement in BASIC?
To display text
To define a function
To declare variables
To allocate memory for arrays
Which BASIC statement is used to check a condition and execute code based on whether the condition is true or false?
GOTO
IF-THEN
WHILE-END
What is the output of the following code?
java Copy code
x = 1
WHILE x < 5
PRINT x
x = x + 2
WEND
1 2 3 4
1 3 5
2 4 6
1 2 4
Which statement is used to store data in an array in BASIC?
ASSIGN
STORE
INPUT
DIM
To calculate the average of values in a one-dimensional array, what is the typical approach in BASIC?
Using the GOTO statement
Using a WHILE-END loop
Using the DIM statement
Using an IF-THEN statement
How do you declare an array of 20 integers in BASIC?
DIM numbers(20)
DIM array(20)
DIM int_array[20]
DECLARE array AS INTEGER[20]