## Term 2 - Quiz 1

On this range of dates, Quiz No. 1 covering QBasic Programming was given.

Coverage for the quiz included the CLS, PRINT, Simple Math statements, variable declaration using DIM statements, and INPUT statements. These topics are covered in videos 1, 2, 3, 4, and the first half of video 5 in the QBasic Tutorial Series on YouTube.com. Type "QBasic Tutorial Series" in the YouTube search bar to produce the index of QBasic videos that we studied in class.

Coverage for the quiz included the CLS, PRINT, Simple Math statements, variable declaration using DIM statements, and INPUT statements. These topics are covered in videos 1, 2, 3, 4, and the first half of video 5 in the QBasic Tutorial Series on YouTube.com. Type "QBasic Tutorial Series" in the YouTube search bar to produce the index of QBasic videos that we studied in class.

## Term 2 - QBasic Hands-On Activity 3

(QBasic Programming)

This is the third QBasic program created this term.

Create a QBasic program that will accept values for X and Y variables and compute for the value for the Z variable.

The program will be saved using the filename: NUMBERS

Remember:

1. In your program, start by creating your variables, X, and Y.

Hint:

If X and Y are supposed to be declared as type INTEGER. Data type INTEGER means the value stored in the

variable involves a whole number that would be used for computations.

Sample:

DIM X AS INTEGER

DIM Y AS INTEGER

(This portion is similar to what is presented in the 2nd half of Video 5.)

2. Screen Output:

--------------------------------------------------------------------------------------------------------------------------------------

Enter the first number: <accept the first number from the keyboard>

Enter the second number: <accept the second number from the keyboard>

Results:

X + Y = _____

X - Y = _____ (or Y - X = _____ will appear on the screen if Y is the bigger number)

X * Y = ______

X / Y = ______ (or Y / X = _____ will appear on the screen if Y is the bigger number).

-----------------------------------------------------------------------------------------------------------------------------------------

Note: For the screen output, the characters "X" and "Y" should not appear literally on the screen.

Instead it should be the variables' values which should appear on the screen together with the

operator symbols (+, -, *, and /) and the equals (=) sign. The computed values for addition,

subtraction, multiplication, and division should likewise appear in the results.

3. Using IF-THEN-ELSE statement

Remember to consider what could happen if X is the bigger number or Y is the bigger number when

performing the subtraction and the division process. Use the IF-THEN-ELSE statement to get around

this problem.

*Watch the 2nd half of Video 5 (User Input) and at least the first half of Video 6 (If Statements) to see similar examples to serve as a pattern for this activity (youtube.com). Use the term

Create a QBasic program that will accept values for X and Y variables and compute for the value for the Z variable.

The program will be saved using the filename: NUMBERS

Remember:

1. In your program, start by creating your variables, X, and Y.

Hint:

If X and Y are supposed to be declared as type INTEGER. Data type INTEGER means the value stored in the

variable involves a whole number that would be used for computations.

Sample:

DIM X AS INTEGER

DIM Y AS INTEGER

(This portion is similar to what is presented in the 2nd half of Video 5.)

2. Screen Output:

--------------------------------------------------------------------------------------------------------------------------------------

Enter the first number: <accept the first number from the keyboard>

Enter the second number: <accept the second number from the keyboard>

Results:

X + Y = _____

X - Y = _____ (or Y - X = _____ will appear on the screen if Y is the bigger number)

X * Y = ______

X / Y = ______ (or Y / X = _____ will appear on the screen if Y is the bigger number).

-----------------------------------------------------------------------------------------------------------------------------------------

Note: For the screen output, the characters "X" and "Y" should not appear literally on the screen.

Instead it should be the variables' values which should appear on the screen together with the

operator symbols (+, -, *, and /) and the equals (=) sign. The computed values for addition,

subtraction, multiplication, and division should likewise appear in the results.

3. Using IF-THEN-ELSE statement

Remember to consider what could happen if X is the bigger number or Y is the bigger number when

performing the subtraction and the division process. Use the IF-THEN-ELSE statement to get around

this problem.

*Watch the 2nd half of Video 5 (User Input) and at least the first half of Video 6 (If Statements) to see similar examples to serve as a pattern for this activity (youtube.com). Use the term

**QBasic Tutorial Series**in the youtube.com search box.