Natural 2006 Practice Exam - Syntax

24 Questions | Total Attempts: 38

SettingsSettingsSettings
Practice Exam Quizzes & Trivia

Practice for software ag test; focuses on programming statements, such as decision structures and commonly used functions


Questions and Answers
  • 1. 
    Given the following code, what replace this read statement with to filter for salaries over 40000?0020 DEFINE DATA0030 LOCAL0040   1 EMPLOYEES-VIEW VIEW OF EMPLOYEES0050     2 NAME (A20)0060     2 JOB-TITLE (A25)0070     2 SALARY (P9/1)0080 0090 END-DEFINE 0100 READ EMPLOYEES-VIEW
  • 2. 
    Which of the following is not correct
    • A. 

      FORMAT CD=YE /* SET COLOR OF FIELDS TO YELLOW

    • B. 

      NEWPAGE /* DOES A PAGE BREAK

    • C. 

      NEWPG /* DOES A PAGE BREAK

    • D. 

      FORMAT CD="YE" /* SET COLOR OF FIELDS TO YELLOW

  • 3. 
    Which of the following is not correct?
    • A. 

      ASSIGN #X = 1

    • B. 

      MOVE (AD=D CD=RE) TO #CV

    • C. 

      ASSIGN #X := 1

    • D. 

      #X := #Y := #Z

    • E. 

      All the above are correct

  • 4. 
    What does this code do?MOVE #X TO #Y #Z
    • A. 

      Combines y and z into x

    • B. 

      Copies x into y and z

    • C. 

      Copies x into y and z and makes x null

    • D. 

      This is an invalid statement

  • 5. 
    Which of the following is correct?
    • A. 

      Reset #x

    • B. 

      Reset initial #x

    • C. 

      Reset #x initial

    • D. 

      Reset initial id-no /* note: id-no is a database field

  • 6. 
    Which of the following is correct?
    • A. 

      #sometext := val(#x) /* note that #x is a number

    • B. 

      #x := val(#sometext) /* note that

    • C. 

      #SOMETEXT := 12

    • D. 

      MOVE 12 TO #SOMETEXT

  • 7. 
    Which of the following is an incorrect usage of the separate function?define datalocal1 #src1 (a) dynamic init<'cat;dog;mouse'>1 #src2 (a) dynamic init <'cat dog mouse'>1 #myarray (a6/3)1 #b 2 #b1 (a6)2 #b2 (a12)end-define
    • A. 

      Separate #src1 into #myarray(*) with delimiter ';'

    • B. 

      Separate #src1 into #myarray

    • C. 

      Separate #src1 into #b1 remainder #b2 with delimiter ';'

    • D. 

      Separate #src2 into #myarray(*)

  • 8. 
    Where can you enter a terminal command, say to change the language of the session during runtime (this is for natural for windows)?
    • A. 

      You enter them into the windows command prompt

    • B. 

      Set control "L=2" /* This is a Natural line of code

    • C. 

      Press * then the terminal command during program runtime

    • D. 

      Press % then the terminal command during program runtime

  • 9. 
    Define datalocal1 #NUM (I4)1 #LEN (I4)end-defineSelect the correct uses of the examine function.
    • A. 

      EXAMINE "ONE;TWO;THREE" FOR ";" REPLACE ","

    • B. 

      EXAMINE "ONE;TWO;THREE" FOR ";" GIVING #NUM

    • C. 

      EXAMINE "ONE;TWO;THREE" FOR ";" GIVING NUMBER #NUM

    • D. 

      EXAMINE "ONE;TWO;THREE" GIVING LENGTH #LEN

  • 10. 
    What does the following code do? define data local 1 #testarray (a/1:3) dynamic init<'dog','cat','hat'>1 #index (i4) end-defineexamine #testarray(*) for "hat" giving index #index
    • A. 

      Seaches #testarray for "hat" and makes #index 3

    • B. 

      It searches testarray for hat at the given index (in #index)

    • C. 

      The syntax is incorrect

  • 11. 
    Which one of these for loop blocks are incorrect given this define data statement?define datalocal1 #i (i4)1 #salary(p6.2/4) init <40000.00,60000.00,25000.00,90000.00>end-define
    • A. 

      For #i = 1 to 4 #salary(#i) := #salary(#i) * 1.1 next

    • B. 

      For #i = 1 to 4 #salary(#i) := #salary(#i) * 1.1 end-for

    • C. 

      For #i 1 to 4 #salary(#i) := #salary(#i) * 1.1 end-for

    • D. 

      For #i = 1 to *OCCURRENCE(#salary) #salary(#i) := #salary(#i) * 1.1 end-for

  • 12. 
    What must PERSONNEL-ID be in order for this block of code work?0020 DEFINE DATA0030 LOCAL0040   1 EMPLOYEES-VIEW VIEW OF EMPLOYEES0050     2 PERSONNEL-ID (A8)0060     2 FIRST-NAME (A20)0070     2 JOB-TITLE (A25)0080 END-DEFINE0090 0100 0110 READ EMPLOYEES-VIEW BY PERSONNEL-ID0120 0130 DISPLAY PERSONNEL-ID FIRST-NAME JOB-TITLE0140 0150 END-READ
  • 13. 
    Which of these read statements are correct given this define data?0020 DEFINE DATA0030 LOCAL0040   1 EMPLOYEES-VIEW VIEW OF EMPLOYEES0050     2 NAME (A20)0060     2 JOB-TITLE (A25)0070     2 SALARY (P9/1)0080 0090 END-DEFINE
    • A. 

      Read employees-view physical

    • B. 

      Read employees-view by isn

    • C. 

      Read employees-view from "jones"

    • D. 

      Read employees-view by starting from "jones" ending at "s"

  • 14. 
    The WHERE clause can be used with FIND and READ statements (t/f).
  • 15. 
    You have to exit a loop; how would you do this? (what statement is it)
  • 16. 
    TYou need to skip an iteration in a loop; what statement is it?
  • 17. 
    This code will accept records that have a job title of "Analyst" or a salary between 10000 and 40000 (true or false)0250 READ EMPLOYEES-VIEW BY JOB-TITLE0260 0270 ACCEPT IF JOB-TITLE = "ANALYST"0280 REJECT IF SALARY(1) < 10000 OR SALARY(1) > 400000290 0300 DISPLAY NAME JOB-TITLE SALARY(1)0310 0320 END-READ
  • 18. 
    Given this line of code, what is needed for it be complete: it is searching the database field NAME with the variable #SEARCH.FIND EMPLOYEES-VIEW __________
  • 19. 
    Which loop type does this block associate with (FIND or READ).IF NO RECORDS FOUNDWRITE "NOTHING FOUND"END-NOREC
  • 20. 
    Name one type of break processing aggregation function (like TOTAL). Choices can be the minimum, maximum, average, and summation functions (not COUNT).
  • 21. 
    For break processing, which function do you use to reference the field value before the value changed?
  • 22. 
    What is this code block missing at line 0220?0110 DECIDE ON FIRST VALUE OF #NUM0120 0130 VALUE 10140 WRITE "IT IS ONE"0150 0160 VALUE 20170 WRITE "IT IS TWO"0180 0190 ANY VALUE0200 WRITE "ONE OR TWO WAS ENTERED"0210 0220 ________0230 WRITE "NOT SURE WHAT IT IS"0240 0250 END-DECIDE
  • 23. 
    The output of this program is (IF #NUM = 2) true or false:VALUE 2 - 50280 DECIDE ON EVERY VALUE OF #NUM0290 0300 VALUE 1 : 40310 WRITE "VALUE 1 - 4"0330 0340 VALUE 2 : 50350 WRITE "VALUE 2 - 5"0360 ALL VALUE0370 0380 WRITE " ALL VALUE 1 - 4"0390 0400 0410 NONE VALUE0420 0430 WRITE "NOT SURE"0440 0450 END-DECIDE
  • 24. 
    Is this a DECIDE FOR or DECIDE ON block?0470 DECIDE ___ FIRST CONDITION0480 0490 WHEN #NUM >= 1 AND #NUM <= 20500 WRITE "1 - 2"0510 0520 WHEN ANY0530 WRITE "ANY ABOVE CONDITIONS ARE TRUE"0540 0560 0570 WHEN NONE0580 IGNORE0590 0600 0610 END-DECIDE