Question

In: Computer Science

Which of the following is not an acceptable symbol for the IF statement: <> > <...

Which of the following is not an acceptable symbol for the IF statement:

<>

>

<

>=

<=

Question 2 2 pts

What paragraph can be used in COBOL to define a unique collating sequence or unique addressable character sets?

Mainline

Collate

Sequence

Class

Special-Names

Question 3 2 pts

What is wrong with the following code setup:

01 CARTYPES PIC 99 VALUE ZEROES.

   88 FORD PIC 99 VALUE 01.

   88 DODGE PIC 99 VALUE 02.

   88 MAZDA VALUE 03.

   88 HONDA PIC 99 VALUE 04.

Syntax is correct, code would compile

MAZDA does not have a PICTURE clause

PIC should not be on 88 levels

VALUE should be SPACES

VALUE clause should not be on 88 Levels

Question 4 2 pts

Evaluate the following code what would the response be:

01 VALIDCLASSCODES PIC 99 VALUE ZEROES.

   88 CISCLASSES VALUE 10.

88 LITCLASSES VALUE 20.

   88 MATCLASSES VALUE 30.

88 PHYCLASSES VALUE 40.

(Input VALIDCLASSES = 20)

CISCLASSES

PHYCLASSES

LITCLASSES

MATCLASSES

Question 5 2 pts

What type of control structure is the IF statement?

Selection Structure

Sequence Structure

Definition

Iteration Structure

Control Break

Question 6 4 pts

For an IF statemment, SELECT ALL choices which are required syntax of the IF statement:

(.) Period or END-IF

ELSE

IF

THEN

NEXT SENTENCE

Question 7 2 pts

What is the limit of IF statements in a NESTED IF Statement?

Unlimited if END-IF used

Unlimited

6

3

24

Question 8 2 pts

Given this code, what value will be displayed?

WORKING-STORAGE SECTION.
01  WS-COUNTER      PIC 9(01) VALUE 0.
01  WS-STATUS       PIC 9(01) VALUE 0.

PROCEDURE DIVISION.

ADD 1 TO WS-COUNTER.
IF WS-COUNTER = 1
  MOVE 5 TO WS-STATUS
ELSE
  MOVE 2 TO WS-STATUS

ADD 3 TO WS-STATUS.
DISPLAY WS-STATUS.

3

8

5

0

4

Question 9 2 pts

Given this code, what value will be displayed?

WORKING-STORAGE SECTION.
01 WS-COUNTER PIC 9(01) VALUE 0.
01 WS-STATUS  PIC 9(01) VALUE 0.

PROCEDURE DIVISION.

ADD 1 TO WS-COUNTER.
IF WS-COUNTER > 1
  MOVE 5 TO WS-STATUS
  IF WS-COUNTER = 2 
    ADD 1 TO WS-STATUS
ELSE
  MOVE 2 TO WS-STATUS

ADD 3 TO WS-STATUS.
DISPLAY WS-STATUS.

5

8

2

1

0

Flag this Question

Question 10 5 pts

Assuming this code is correct, which IF statement will result in a TRUE test.  Select ALL that apply.
WORKING-STORAGE SECTION.

01 FILE-STATUS-FIELDS.
   05 INPUT-FILE-01     PIC X(02).
      88 GOOD-FILE-01              VALUE '00' '10'.
      88 END-OF-FILE-01            VALUE '10'.
  05 INPUT-FILE-02      PIC X(02).
     88 GOOD-FILE-02               VALUE '00' '23'
     88 END-OF-FILE-02             VALUE '10'.

PROCEDURE DIVISION.

MOVE 00 TO INPUT-FILE-01.
MOVE 10 TO INPUT-FILE-02.
   
1.IF true   or   true   ß true result

2.IF true   or   false  ß true result

3.IF false or   true  ß true result

4.IF false or   false  ß false result

5.IF true   and true  ß true result

6.IF true   and false  ß false result

7.IF false and true  ß false result

8.IF false and false  ß false result

IF GOOD-FILE-01 AND NOT GOOD-FILE-02

IF GOOD-FILE-01 OR GOOD-FILE-02

IF NOT GOOD-FILE-01 AND NOT-GOOD-FILE-02

IF GOOD-FILE-01 AND GOOD-FILE-02

IF GOOD-FILE-01 AND END-OF-FILE-01

Solutions

Expert Solution

Answer:

All the symbols we can use in Cobol.

Special-Names paragraph can be used to define a unique collating sequence.

PIC should not be on 88 levels. 88 level number always associated with any other level number 01-49. No PICTURE clause should be in 88 level numbers.

IF statement is the selection structure. We use IF statement to select statement if true this then this. We are selecting statement in this. That’s why it is called Selection Structure.

For an IF statement syntax we need- (.) Period or END-IF, ELSE, IF-THEN, NEXT SENTENCE

There is no limit for IF statements in a NESTED IF Statement.

This code will display 5. Because there is one condition IF WS-COUNTER =1 and in a program, we are adding value 1 to WS-COUNTER, it has value 1 condition is true then the next statement is MOVE 5 TO WS-STATUS. It stores 5 in WS-STATUS and displays this.

This code will display 0. Because WS-COUNTER is not greater than 1 or not equal to 2 then it will nothing store in WS-STATUS. There are two conditions and they are false so it will not proceed next statements.

In last question. I am not understanding that what you want to execute in IF statements, I am answering here the only basis of IF statement, I am telling you when IF statement will give result TRUE. With AND IF both conditions true then it will return TRUE. IF one of them is false it will return FALSE. With OR only one should be TRUE to return TRUE. If both false then it will return FALSE.

1.IF true   or   true   ß true result (This statement will give TRUE).

2.IF true   or   false  ß true result  (This statement will give TRUE).

3.IF false or   true  ß true result     (This statement will give TRUE).

4.IF false or   false  ß false result    FALSE

5.IF true   and true  ß true result     (This statement will give TRUE).

6.IF true   and false  ß false result     FALSE

7.IF false and true  ß false result       FALSE

8.IF false and false  ß false result      FALSE

Related Solutions

Which of the followings are an acceptable and which of thefollowings are not an acceptable...
Which of the followings are an acceptable and which of the followings are not an acceptable variable name? In case of unacceptable justify your answer, i.e., why not acceptable?M1_Name#_NameMy FriendnameWe_Are_All_Friends
Which of the following would NOT be an acceptable method to account for bad debts if...
Which of the following would NOT be an acceptable method to account for bad debts if accounts receivable is a material aspect of a company’s operations? wait until the account becomes uncollectible, and then recognize bad debt expense estimate a percent of future uncollectible accounts at the time of each credit sale, and assign this amount to an allowance for uncollectible accounts periodically conduct an aging of accounts receivable to determine the size of the allowance for uncollectible accounts.
Which of the following shows what would be acceptable to list at the top of an...
Which of the following shows what would be acceptable to list at the top of an income statement, and why? For the Year Ended 20XX; it is measured over a span of time As of January 31, 20XX; it is measured at a point in time As of January 31, 20XX; it is measured over a span of time For the Year Ended 20XX; it is measured at a point in time The SEC's Release 1 (FRR-1) officially recognizes accounting...
Which of the following would be an acceptable measure of activity for a material handling activity...
Which of the following would be an acceptable measure of activity for a material handling activity cost pool? Options       Number of material moves Weight of material moved A Yes Yes B No Yes C Yes No D No No   A. Option A B. Option B C. Option C D. Option D EMD Corporation manufactures two products, Product S and Product W. Product W is of fairly recent origin, having been developed as an attempt to enter a market closely...
Which of the following is an acceptable description of diastolic pressure? Group of answer choices It...
Which of the following is an acceptable description of diastolic pressure? Group of answer choices It is the same as the cardiac output None of the listed options is a description of diastolic pressure The pressure in a blood pressure cuff at which the first heartbeat sound is heard through a stethoscope as the pressure in the cuff is slowly relieved The pressure in a blood pressure cuff just before pressure in the cuff is relieved The pressure in a...
In a hypothesis test involving the population proportion, which of the following would be an acceptable...
In a hypothesis test involving the population proportion, which of the following would be an acceptable formulation? Ho: p=0.25 Ha: vs p not equal0.25 none of these Ho: p = 0.25 Vs Ha: p< 0.25 Ho: p = 0.25 vs Ha: p>0.25 please what is the answer?
Which of the following is a true statement? Which of the following is a true statement?...
Which of the following is a true statement? Which of the following is a true statement? a. The electric potential energy depends on both the electric field and the amount of charge moving through that field. b. The electric potential depends on both the electric field and the amount of charge moving through that field. c. The electric potential energy and the electric potential depend on both the electric field and the amount of charge moving through that field. d....
Which of the following is a positive statement and which of the following is a normative statement?
Which of the following is a positive statement and which of the following is a normative statement?  Increasing the minimum wage increases the unemployment rate. The minimum wage should be increased. The number of tariffs ought to bel reduced. This country should seek to maximize the rate of employment above all other goals.
which of the following does NOT define an element? A.) elemental symbol B.) number of protons...
which of the following does NOT define an element? A.) elemental symbol B.) number of protons C.) mass number D.) atomic number
QUESTION 1 Which of the following is the Greek symbol chi? a. X b. ? c....
QUESTION 1 Which of the following is the Greek symbol chi? a. X b. ? c. ? d. ? 1 points    QUESTION 2 Researchers wanted to know whether it is better to give the diphtheria, tetanus and pertussis (DTaP) vaccine in the thigh or the arm, so they collected data on severe reactions to this vaccine in children aged 3 to 6 years old. What would be the best statistical test for them to utilize? a. One-sample chi-square b....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT