Question:

Which of the following is a valid BASIC statement?

Show Hint

Exam Tip:
BASIC syntax:

• LET variable = expression.
• String variables: variable$ = "text".
• Line numbers are optional in some versions.
  • 80 LET N = 'DELHI'
  • 10 LET X + Y = A + B + C
  • LET A = 15
  • 60 LET S = (A + B + C)/2
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Step 1: Understanding the Concept:
BASIC is a programming language. The LET statement is used to assign values to variables.

Step 2: Key Syntax Rules:


• In BASIC, each statement can have a line number.
• The LET statement has the format: LET variable = expression.
• String variables in BASIC are denoted with a $ sign (e.g., N$).

Step 3: Analyzing the Options:


(A) 80 LET N = 'DELHI': String literals in BASIC are enclosed in double quotes, not single quotes. Also, string variables should have a $ sign. Invalid.
(B) 10 LET X + Y = A + B + C: The left side of the assignment must be a single variable, not an expression. Invalid.
(C) LET A = 15: This is valid but missing a line number. In some BASIC versions, line numbers are optional.
(D) 60 LET S = (A + B + C)/2: This is valid. It has a line number, LET, a variable, and a valid expression.

Step 4: Final Answer:

Therefore, option (D) is correct.
Was this answer helpful?
0
0