Challenge Test [ Using the 900 Series HP 3000: Advanced Skills Module 6: Variables and Expression ] MPE/iX 5.0 Documentation
Using the 900 Series HP 3000: Advanced Skills Module 6: Variables and Expression
Challenge Test
1. Which of the following is a legal variable name:
a. VAR_1
b. VAR-1
c. VARIABLE#1
d. VARIABLE_1
e. VAR 1
f. 1_VAR
2. Which of the following system-defined variables have values that
can be altered?
a. HPPROMPT
b. HPJOBLIMIT
c. HPSESLIMIT
d. HPPATH
3. TRUE OR FALSE
User-defined variables can have real numbers (decimals or
fractions) as values.
4. TRUE OR FALSE
You can set a variable to a specific value in this manner:
SETVAR VARIABLE1,5
5. How would you display the value set in question 4?
6. How would you print this message on the screen with or without
using variables:
HELLO -- WELCOME TO THE ADVANCED SKILLS COURSE
7. How would you prompt a user for his or her name and then print
this message:
HELLO username -- WELCOME TO THE ADVANCED SKILLS COURSE
8. Which series of statements is correct for prompting a user for an
integer value (VAR_A), adding 2 to that value, assigning the
result to VAR_B, and then displaying VAR_B?
a. INPUT VAR_A;PROMPT="What is the value of variable A?
SETVAR VAR_B,VAR_A + 2
SHOWVAR VAR_B
b. INPUT VAR_A;PROMPT="What is the value of variable A?"
SETVAR VAR_B,!VAR_A + 2
SHOWVAR VAR_B
c. INPUT VAR_A;PROMPT="What is the value of variable A? "
SETVAR VAR_A,!VAR_A
SETVAR VAR_B,VAR_A + 2
SHOWVAR VAR_B
9. Compare the following command files, CFA and CFB. Answer the
questions about them:
CFA:
INPUT NAME;PROMPT="What is your name (enter // to stop): "
IF NAME <> `//' THEN
INPUT COUNTRY;PROMPT="What is your native country &
(8 characters or less): "
ECHO *** HELLO !NAME FROM !COUNTRY ***
ELSE
ECHO ***SORRY, NO MESSAGE***
ENDIF
CFB:
INPUT NAME;PROMPT="What is your name (enter // to stop): "
WHILE NAME <> `//' DO
INPUT COUNTRY;PROMPT="What is your native country &
(8 characters or less): "
ECHO *** HELLO !NAME FROM !COUNTRY ***
INPUT NAME;PROMPT="What is your name (enter // to stop: "
ENDWHILE
ECHO ***SORRY, NO MESSAGE***
If you respond in the following manner to CFA and CFB, what
happens in each case?
-------------------------------------------------------------------------------------------------
| | | | |
| | Responses | CFA | CFB |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| a. | JULIO | | |
| | SPAIN | | |
| | | | |
| b. | // | | |
| | | | |
| c. | GINA | | |
| | ITALY | | |
| | // | | |
| | | | |
-------------------------------------------------------------------------------------------------
MPE/iX 5.0 Documentation