HPlogo Using HP 3000 MPE/iX:\Advanced Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 7 Module 6: Variables and Expressions

Challenge Test

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

  1. Which of the following is a legal variable name:

    1. VAR_1

    2. VAR-1

    3. VARIABLE#1

    4. VARIABLE_1

    5. VAR 1

    6. 1_VAR

  2. Which of the following system-defined variables have values that can be altered?

    1. HPPROMPT

    2. HPJOBLIMIT

    3. HPSESLIMIT

    4. 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 + 2SHOWVAR VAR_B
    b.INPUT VAR_A;PROMPT="What is the value of variable A?"SETVAR VAR_B, !VAR_A + 2SHOWVAR VAR_B
    c.INPUT VAR_A;PROMPT="What is the value of variable A? "SETVAR VAR_A, !VAR_ASETVAR VAR_B,VAR_A + 2SHOWVAR 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?

     ResponsesCFACFB
    a.JULIOSPAIN  
    b.//  
    c.GINAITALY//  

Feedback to webmaster