Natural 2006 Practice Exam - Syntax

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Nimba
N
Nimba
Community Contributor
Quizzes Created: 2 | Total Attempts: 255
| Attempts: 61 | Questions: 24
Please wait...
Question 1 / 24
0 %
0/100
Score 0/100
1. What must PERSONNEL-ID be in order for this block of code work?

0020 DEFINE DATA
0030 LOCAL
0040   1 EMPLOYEES-VIEW VIEW OF EMPLOYEES
0050     2 PERSONNEL-ID (A8)
0060     2 FIRST-NAME (A20)
0070     2 JOB-TITLE (A25)
0080 END-DEFINE
0090
0100
0110 READ EMPLOYEES-VIEW BY PERSONNEL-ID
0120
0130 DISPLAY PERSONNEL-ID FIRST-NAME JOB-TITLE
0140
0150 END-READ

Explanation

not-available-via-ai

Submit
Please wait...
About This Quiz
Natural 2006 Practice Exam - Syntax - Quiz


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

2. Given the following code, what replace this read statement with to filter for salaries over 40000?

0020 DEFINE DATA
0030 LOCAL
0040   1 EMPLOYEES-VIEW VIEW OF EMPLOYEES
0050     2 NAME (A20)
0060     2 JOB-TITLE (A25)
0070     2 SALARY (P9/1)
0080
0090 END-DEFINE
0100 READ EMPLOYEES-VIEW

Explanation

not-available-via-ai

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

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.

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

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.

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

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.

Submit
6. 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-TITLE
0260
0270 ACCEPT IF JOB-TITLE = "ANALYST"
0280 REJECT IF SALARY(1) < 10000 OR SALARY(1) > 40000
0290
0300 DISPLAY NAME JOB-TITLE SALARY(1)
0310
0320 END-READ

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.

Submit
7. 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 __________

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.

Submit
8. Which loop type does this block associate with (FIND or READ).

IF NO RECORDS FOUND

WRITE "NOTHING FOUND"

END-NOREC

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.

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

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.

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

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.

Submit
11. What is this code block missing at line 0220?

0110 DECIDE ON FIRST VALUE OF #NUM
0120
0130 VALUE 1
0140 WRITE "IT IS ONE"
0150
0160 VALUE 2
0170 WRITE "IT IS TWO"
0180
0190 ANY VALUE
0200 WRITE "ONE OR TWO WAS ENTERED"
0210
0220 ________
0230 WRITE "NOT SURE WHAT IT IS"
0240
0250 END-DECIDE

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.

Submit
12. The output of this program is (IF #NUM = 2) true or false:
VALUE 2 - 5


0280 DECIDE ON EVERY VALUE OF #NUM
0290
0300 VALUE 1 : 4
0310 WRITE "VALUE 1 - 4"
0330
0340 VALUE 2 : 5
0350 WRITE "VALUE 2 - 5"
0360 ALL VALUE
0370
0380 WRITE " ALL VALUE 1 - 4"
0390
0400
0410 NONE VALUE
0420
0430 WRITE "NOT SURE"
0440
0450 END-DECIDE

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.

Submit
13. Is this a DECIDE FOR or DECIDE ON block?

0470 DECIDE ___ FIRST CONDITION
0480
0490 WHEN #NUM >= 1 AND #NUM <= 2
0500 WRITE "1 - 2"
0510
0520 WHEN ANY
0530 WRITE "ANY ABOVE CONDITIONS ARE TRUE"
0540
0560
0570 WHEN NONE
0580 IGNORE
0590
0600
0610 END-DECIDE

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.

Submit
14. What does this code do?

MOVE #X TO #Y #Z

Explanation

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

Submit
15. What does the following code do? define data local 1 #testarray (a/1:3) dynamic init<'dog','cat','hat'>
1 #index (i4) end-define

examine #testarray(*) for "hat" giving index #index

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.

Submit
16. Which one of these for loop blocks are incorrect given this define data statement?

define data
local
1 #i (i4)
1 #salary(p6.2/4) init <40000.00,60000.00,25000.00,90000.00>
end-define

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.

Submit
17. Which of the following is an incorrect usage of the separate function?

define data
local
1 #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

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.

Submit
18. Which of the following is correct?

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.

Submit
19. Which of the following is correct?

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.

Submit
20. Which of the following is not correct

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.

Submit
21. Which of the following is not 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.

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

Explanation

not-available-via-ai

Submit
23. Define data
local
1 #NUM (I4)
1 #LEN (I4)
end-define

Select the correct uses of the examine function.

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.

Submit
24. Which of these read statements are correct given this define data?

0020 DEFINE DATA
0030 LOCAL
0040   1 EMPLOYEES-VIEW VIEW OF EMPLOYEES
0050     2 NAME (A20)
0060     2 JOB-TITLE (A25)
0070     2 SALARY (P9/1)
0080
0090 END-DEFINE

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".

Submit
View My Results

Quiz Review Timeline (Updated): May 10, 2023 +

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
Cancel
  • All
    All (24)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
What must PERSONNEL-ID be in order for this block of code work?0020...
Given the following code, what replace this read statement with to...
The WHERE clause can be used with FIND and READ statements (t/f).
You have to exit a loop; how would you do this? (what statement is it)
TYou need to skip an iteration in a loop; what statement is it?
This code will accept records that have a job title of "Analyst" or a...
Given this line of code, what is needed for it be complete: it is...
Which loop type does this block associate with (FIND or READ).IF NO...
Name one type of break processing aggregation function (like TOTAL)....
For break processing, which function do you use to reference the field...
What is this code block missing at line 0220?0110 DECIDE ON FIRST...
The output of this program is (IF #NUM = 2) true or false:VALUE 2 -...
Is this a DECIDE FOR or DECIDE ON block?0470 DECIDE ___ FIRST...
What does this code do?MOVE #X TO #Y #Z
What does the following code do? ...
Which one of these for loop blocks are incorrect given this define...
Which of the following is an incorrect usage of the separate...
Which of the following is correct?
Which of the following is correct?
Which of the following is not correct
Which of the following is not correct?
Where can you enter a terminal command, say to change the...
Define datalocal1 #NUM (I4)1 #LEN (I4)end-defineSelect the correct...
Which of these read statements are correct given this define data?0020...
Alert!

Advertisement