110 likes | 221 Views
This document analyzes common errors found in TrueBASIC sample problems related to variables, data handling, and output generation. It highlights issues such as the improper use of keywords (e.g., using "REM" as a variable), missing statements, and incorrect syntax in read and print operations. The program output is examined, demonstrating how variable assignments and data reading can lead to errors or unexpected results. It is aimed at helping beginners in programming to understand and resolve typical mistakes in coding.
E N D
What are the errors? (2 total) PRINT "REM" LET REM = 50 reAD currency$, amount DAta "Dollar", 50
What are the errors? (2 total) PRINT "REM" LET REM = 50 reAD currency$, amount DAta "Dollar", 50 END • REM is a keyword, cannot be used as a variable • Missing END statement
What is the output? DATA 1000, 5, "fraternity power walk" READ attendees, ticket_price LET revenue = attendees * ticket_price READ event$ DATA 5, "the fraternity power walk" PRINT event$; " generated $";revenue END
What is the output? DATA 1000, 5, "fraternity power walk" READ attendees, ticket_price LET revenue = attendees * ticket_price READ event$ DATA 5, "the fraternity power walk" PRINT event$; " generated $";revenue END the fraternity power walk generated $ 5000
What is the error? READ yo$, I, got DATA "$",523,432 DATA "100",100 READ number$ READ name PRINT "number": I END
What is the error? READ yo$, I, got DATA "$",523,432 DATA "100",100 READ number$ READ name PRINT "number": I END Commas or Semi-colons must separate the list of arguments to PRINT (not colons)
What are the errors? REM REM LET x = "5000" LET string$s = "Good Evening" LET 1number = 44 PRINT "I dunno";" whatsgoin", " on" END
What are the errors? REM REM LET x = "5000" LET string$s = "Good Evening" LET 1number = 44 PRINT "I dunno";" whatsgoin", " on" END • Cannot assign a string to a number variable • string$s is not a valid variable name (must end with $) • 1number is not a valid variable name (cannot begin with a number)
What is the output of this program? READ x READ y READ x LET y = x + 2 PRINT "x= ";x, "y= ";y DATA 1,2,3,4,5,6 READ y PRINT "x= ";x, "y= ";y END
What is the output of this program? READ x READ y READ x LET y = x + 2 PRINT "x= ";x, "y= ";y DATA 1,2,3,4,5,6 READ y PRINT "x= ";x, "y= ";y END x= 3 y= 5 x= 3 y= 4