Natural 2006 Practice Exam - Syntax

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Nimba
N
Nimba
Community Contributor
Quizzes Created: 2 | Total Attempts: 251
Questions: 24 | Attempts: 59

SettingsSettingsSettings
Natural 2006 Practice Exam - Syntax - Quiz


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


Questions and Answers
  • 1. 

    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

    Correct Answer(s)
    C. NEWPG /* DOES A PAGE BREAK
    D. FORMAT CD="YE" /* SET COLOR OF FIELDS TO YELLOW
    Explanation
    The given answer, "NEWPG /* DOES A PAGE BREAK, FORMAT CD="YE" /* SET COLOR OF FIELDS TO YELLOW," is correct because "NEWPG" is not a valid command for doing a page break in the given context. The correct command for a page break is "NEWPAGE." Additionally, the syntax "FORMAT CD="YE"" is incorrect because it should be "FORMAT CD=YE" to set the color of fields to yellow.

    Rate this question:

  • 2. 

    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

    Correct Answer
    E. All the above are correct
    Explanation
    The given question asks which of the statements is not correct. However, the answer states that all the statements are correct. This implies that there is no statement that is incorrect among the given options.

    Rate this question:

  • 3. 

    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

    Correct Answer
    B. Copies x into y and z
    Explanation
    The given code "MOVE #X TO #Y #Z" copies the value of variable x into variables y and z.

    Rate this question:

  • 4. 

    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

    Correct Answer(s)
    A. Reset #x
    B. Reset initial #x
    Explanation
    The correct answer is "reset #x" and "reset initial #x". These options are correct because they follow the correct syntax for the reset command. The first option "reset #x" simply resets the value of variable x. The second option "reset initial #x" resets the initial value of variable x.

    Rate this question:

  • 5. 

    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

    Correct Answer(s)
    B. #x := val(#sometext) /* note that
    C. #SOMETEXT := 12
    D. MOVE 12 TO #SOMETEXT
    Explanation
    The given answer is correct because it correctly identifies the statements that assign values to variables. The statement "#x := val(#sometext)" assigns the value of #sometext to #x using the "val" function. The statement "#SOMETEXT := 12" assigns the value 12 to the variable #SOMETEXT. The statement "MOVE 12 TO #SOMETEXT" also assigns the value 12 to #SOMETEXT.

    Rate this question:

  • 6. 

    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(*)

    Correct Answer
    B. Separate #src1 into #myarray
    Explanation
    The correct answer is "separate #src1 into #myarray". This is incorrect usage because the "with delimiter" clause is missing, which specifies the delimiter to be used for separating the string.

    Rate this question:

  • 7. 

    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

    Correct Answer(s)
    B. Set control "L=2" /* This is a Natural line of code
    D. Press % then the terminal command during program runtime
  • 8. 

    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

    Correct Answer(s)
    A. EXAMINE "ONE;TWO;THREE" FOR ";" REPLACE ","
    C. EXAMINE "ONE;TWO;THREE" FOR ";" GIVING NUMBER #NUM
    Explanation
    The correct uses of the examine function are to replace a specific character with another character and to count the occurrences of a specific character. In the given options, the first option "EXAMINE "ONE;TWO;THREE" FOR ";" REPLACE ","" correctly replaces the ";" with a ",". The second option "EXAMINE "ONE;TWO;THREE" FOR ";" GIVING #NUM" correctly counts the occurrences of ";" and stores the result in the variable #NUM.

    Rate this question:

  • 9. 

    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

    Correct Answer
    A. Seaches #testarray for "hat" and makes #index 3
    Explanation
    The given code searches for the string "hat" in the array #testarray. If the string is found, it assigns the index of the element in the array to the variable #index. In this case, the string "hat" is found at index 3, so #index is assigned the value 3.

    Rate this question:

  • 10. 

    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

    Correct Answer
    A. For #i = 1 to 4 #salary(#i) := #salary(#i) * 1.1 next
    Explanation
    The correct answer is the first for loop block. It correctly initializes the loop variable #i to 1 and iterates from 1 to 4. Inside the loop, it multiplies the value of #salary(#i) by 1.1, effectively increasing the salary by 10%. The "next" statement indicates the end of the loop.

    Rate this question:

  • 11. 

    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

    Correct Answer
    descriptor
  • 12. 

    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"

    Correct Answer(s)
    A. Read employees-view pHysical
    B. Read employees-view by isn
    D. Read employees-view by starting from "jones" ending at "s"
    Explanation
    The correct statements are read employees-view physical, read employees-view by isn, and read employees-view by starting from "jones" ending at "s". These statements are correct because they use the correct syntax for reading data from the EMPLOYEES-VIEW view. The "physical" keyword is used to read the data physically from the file, "by isn" is used to read the data in ascending order of the ISN (Internal Sequence Number), and "by starting from" and "ending at" are used to specify a range of values for the key field "NAME".

    Rate this question:

  • 13. 

    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

    Correct Answer(s)
  • 14. 

    The WHERE clause can be used with FIND and READ statements (t/f).

    Correct Answer(s)
    t
    true
    Explanation
    The WHERE clause can indeed be used with FIND and READ statements. The WHERE clause is used to specify conditions that must be met in order for the statement to retrieve the desired data. By using the WHERE clause, you can filter the data based on specific criteria, allowing you to retrieve only the records that meet those criteria.

    Rate this question:

  • 15. 

    You have to exit a loop; how would you do this? (what statement is it)

    Correct Answer(s)
    escape bottom
    Explanation
    The correct statement to exit a loop is "break". This statement allows you to terminate the loop prematurely and continue executing the code after the loop. In this case, "escape bottom" is not a valid statement for exiting a loop.

    Rate this question:

  • 16. 

    TYou need to skip an iteration in a loop; what statement is it?

    Correct Answer(s)
    escape top
    Explanation
    The correct answer is "escape top". This statement is used to skip an iteration in a loop. It allows the program to exit the current iteration and move on to the next iteration without executing the remaining code in the current iteration. This can be useful when certain conditions are met and you want to bypass the current iteration and proceed to the next one.

    Rate this question:

  • 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

    Correct Answer(s)
    true
    t
    Explanation
    The given code reads records from the EMPLOYEES-VIEW file. It accepts records if the job title is "Analyst" or if the salary is between 10000 and 40000. The code then displays the name, job title, and salary of the accepted records. The correct answer "true,t" indicates that the code will accept records that meet either of these conditions.

    Rate this question:

  • 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 __________

    Correct Answer(s)
    WITH NAME = #SEARCH
    Explanation
    The line of code is searching the database field NAME with the variable #SEARCH. In order for it to be complete, the code needs to include the keyword "WITH" followed by the field NAME and the value to be searched, which is represented by the variable #SEARCH.

    Rate this question:

  • 19. 

    Which loop type does this block associate with (FIND or READ).IF NO RECORDS FOUNDWRITE "NOTHING FOUND"END-NOREC

    Correct Answer(s)
    FIND
    Explanation
    The given block of code is associated with the FIND loop type. This is because the block is searching for records and if no records are found, it writes "NOTHING FOUND" and ends the loop.

    Rate this question:

  • 20. 

    Name one type of break processing aggregation function (like TOTAL). Choices can be the minimum, maximum, average, and summation functions (not COUNT).

    Correct Answer(s)
    sum
    aver
    min
    max
    Explanation
    The given question asks for one type of break processing aggregation function, and the answer choices provided are sum, average, minimum, and maximum. These are all examples of break processing aggregation functions. The sum function calculates the total sum of a set of values, the average function calculates the mean of a set of values, the minimum function finds the smallest value in a set, and the maximum function finds the largest value in a set.

    Rate this question:

  • 21. 

    For break processing, which function do you use to reference the field value before the value changed?

    Correct Answer(s)
    old
    old()
    Explanation
    To reference the field value before it changed during break processing, the correct function to use is "old" or "old()". This function allows you to access the previous value of a field before any changes were made to it.

    Rate this question:

  • 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

    Correct Answer(s)
    NONE VALUE
    Explanation
    The code block is missing a condition or statement that determines the value of #NUM. Without this condition or statement, the code will not be able to decide on the value of #NUM and will always execute the line 0230, which writes "NOT SURE WHAT IT IS". The correct answer suggests that the missing code should be "NONE VALUE", indicating that #NUM does not have a specific value assigned to it.

    Rate this question:

  • 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

    Correct Answer(s)
    false
    f
    Explanation
    The program first checks if the value of #NUM is equal to 2. If it is true, then the output will be "VALUE 2 - 5". However, if the value of #NUM is not equal to 2, the program will skip the first condition and go to the next line, which is "ALL VALUE". This line will output "ALL VALUE 1 - 4". Therefore, the output of the program will be "VALUE 2 - 5" if #NUM is equal to 2, otherwise it will be "ALL VALUE 1 - 4". Hence, the correct answer is false for the first output and f for the second output.

    Rate this question:

  • 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

    Correct Answer(s)
    for
    decide for
    Explanation
    This is a DECIDE FOR block because it uses the keyword "FOR" after the DECIDE statement. In a DECIDE FOR block, the program will execute the first condition that evaluates to true and then exit the block. In this case, if the value of #NUM is between 1 and 20 (inclusive), the program will write "1 - 2" and then exit the block. If none of the conditions are true, the program will ignore the block and continue with the next line of code.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • May 10, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 01, 2008
    Quiz Created by
    Nimba
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.