View previous topic :: View next topic
|
Author |
Message |
jos.samuel
New User
Joined: 10 Mar 2005 Posts: 3
|
|
|
|
Hello I am Samuel I have some doubts in cobol questions which i have posted, i need answer urgently reply soon.
1.Observe the following statements concerning READ statement : Identify
the TRUE statement :
a) AT END clause is not applicable to INDEXED files.
b) AT END NEXT SENTENCE is not allowed.
c) File must be open in the OUTPUT or I-O mode at the time READ is
executed.
d) READ NEXT is allowed only for DYNAMIC access.
2. Which of the foll. is an INCORRECT level number for a data-name?
a. 88 b. 13
c. 49 d. 01
3. What is the correct intrepretation of the statement
PERFORM PROCESS-THIS UNTIL MY-CONDITION
where the condition-name is defined as folls:
a. do the para PROCESS-THIS once if MY-VALUE has a value 1
b. keep repeating para PROCESS-THIS as long as MY-VALUE has a
value 1
c. keep repeating para PROCESS-THIS as long as MY-VALUE has a
value other than 1.
d. do the para PROCESS-THIS once if MY-VALUE has a value other
than 1.
4. A COBOL program when compiled gives an error at the Procedure
Division statement
ADD 10 TO COUNT-ITEMS
Which of the foll. situations could have caused the error?
a. COUNT-ITEMS has a PIC 999V9.
b. COUNT-ITEMS has a PIC ZZZ9.
c. COUNT-ITEMS is not initialised to zero anywhere in the
program
d. COUNT-ITEMS is declared in the FILE SECTION and not the
WORKING-STORAGE SECTION.
5. A programmer used the IF clause:
IF RANGE-1 AND NOT RANGE-2
to describe a condition. Another programmer described the same
condition by the IF clause
IF TALLY-GROUP = 6 OR 7 OR 10
If these two condition specifications are identical which of the
foll. declarations applies to the situation?
a.
01 TALLY-GROUP PIC 99.
88 RANGE-1 VALUES 6 THRU 10.
88 RANGE-2 VALUES 1 THRU 5.
b.
10 TALLY-GROUP PIC 99.
88 RANGE-1 VALUES 6, 7, 10.
(Range-2 is any condition-name assiciated with TALLY-GROUP)
c.
10 TALLY-GROUP PIC 99.
88 RANGE-1 VALUES 6 THRU 10.
88 RANGE-2 VALUES 8, 9.
d.
10 TALLY-GROUP PIC 99.
88 RANGE-1-AND-NOT-RANGE-2 VALUES 6, 7, 10.
6. In case of relative files, if RELATIVE KEY phrase is also specified
with ACCESS MODE SEQUENTIAL, what will be the result of READ ?
7 .The use of the INVALID KEY clause helps the programmer in :
a) checking whether the key field has the correct contents.
b) checking for a device error.
c) checking whether a specific file exists.
d) checking whether a specified record exists in a file.
8. Consider the following statements:
MOVE 10 TO XYZ
PERFORM PARA-1 XYZ TIMES.
.................
PARA-1.
.........
MOVE 20 TO XYZ
.........
Which of the following would happen ?
a. PARA-1 would be performed 10 times only.
b. PARA-1 would be performed 20 times.
c. PARA-1 would be performed 21 times.
d. Run-time error occurs and the program aborts.
9. Study the following :
RECORD-II.
DN-1.
0 DN-2 PIC X(12).
0 DN-2A PIC 9(8).
DN-1A REDEFINES DN-1.
0 DN-3A PIC XXXX.
0 DN-3 PIC 9(6).
0 DN-3B PIC X(10).
DN-5 PIC X(5).
DN-6 PIC 9(5).
State which of the following statements is correct
a. 66 DN-8 RENAMES DN-2 THRU DN-3.
b. 66 DN-8 RENAMES DN-2 THRU DN-3A.
c. 66 DN-8 RENAMES DN-5 THRU DN-2A.
d. 66 DN-8 RENAMES DN-2A THRU DN-6.
10. Consider the statement :
IF D-1 = SPACE GO TO PARA-A.
Which of the following is true ?
a. PARA-A will be executed if D-1 contains a blank in the leftmost
position.
b. PARA-A will be executed if D-1 contains a blank in rightmost
position.
c. PARA-A will be executed if D-1 contains all blanks.
d. Syntax is invalid since SPACE cannot be used in a relation
condition statement.
11. Study the following:
A PIC x(7) VALUE "ABC#D".
D PIC X VALUE "#".
E PIC X(5) VALUE "PQ".
F PIC X(15) VALUE "ABCDEFGHIJKLMNO".
P-1 PIC 99 VALUE 3.
STRING A SPACE E DELIMITED BY "#" INTO F WITH POINTER P-1 ON OVERFLOW DISPLAY "Error".
What will be the contents of F and P-1 after execution of the above:
a. ABC#PQGHIJKLMNO and 6 respectively.
b. ABCABCPQbbbLMNO and 11 respectively.
c. ABABCbPQbbbLMNO and 12 respectively.
d. Overflow condition would occur.
Note : "b" denotes blank in the above. |
|
Back to top |
|
|
mcmillan
Site Admin
Joined: 18 May 2003 Posts: 1210 Location: India
|
|
|
|
Quote: |
1.Observe the following statements concerning READ statement : Identify
the TRUE statement :
a) AT END clause is not applicable to INDEXED files.
b) AT END NEXT SENTENCE is not allowed.
c) File must be open in the OUTPUT or I-O mode at the time READ is
executed.
d) READ NEXT is allowed only for DYNAMIC access. |
AT END NEXT SENTENCE is not Allowed.
Reason:
Code: |
By default control will be transfered to the Next sentence only. |
Quote: |
2. Which of the foll. is an INCORRECT level number for a data-name?
a. 88 b. 13
c. 49 d. 01 |
88
Quote: |
3. What is the correct intrepretation of the statement
PERFORM PROCESS-THIS UNTIL MY-CONDITION
where the condition-name is defined as folls:
a. do the para PROCESS-THIS once if MY-VALUE has a value 1
b. keep repeating para PROCESS-THIS as long as MY-VALUE has a
value 1
c. keep repeating para PROCESS-THIS as long as MY-VALUE has a
value other than 1.
d. do the para PROCESS-THIS once if MY-VALUE has a value other
than 1. |
The question is not clear. I assume, MY-CONDITION may be the condition name with value 1.
keep repeating para PROCESS-THIS as long as MY-VALUE has a
value other than 1.
Example:
Code: |
000100 ID DIVISION.
000200 PROGRAM-ID. SAMPLE.
000300 DATA DIVISION.
000310 WORKING-STORAGE SECTION.
000400 01 CNC PIC 9.
000410 88 MY-CONDITION VALUE 1.
000500 PROCEDURE DIVISION.
000600 PRA1.
000700 PERFORM PROCESS-THIS UNTIL MY-CONDITION.
000701 STOP RUN.
000710 PARA2.
000720 DISPLAY "QWERTY".
000730 SET MY-CONDITION TO TRUE. |
Quote: |
4. A COBOL program when compiled gives an error at the Procedure
Division statement
ADD 10 TO COUNT-ITEMS
Which of the foll. situations could have caused the error?
a. COUNT-ITEMS has a PIC 999V9.
b. COUNT-ITEMS has a PIC ZZZ9.
c. COUNT-ITEMS is not initialised to zero anywhere in the
program
d. COUNT-ITEMS is declared in the FILE SECTION and not the
WORKING-STORAGE SECTION. |
COUNT-ITEMS has a PIC ZZZ9
Reason:
Code: |
Alphanumeric items cannot be used in Arithmetic Operations. |
Quote: |
5. A programmer used the IF clause:
IF RANGE-1 AND NOT RANGE-2
to describe a condition. Another programmer described the same
condition by the IF clause
IF TALLY-GROUP = 6 OR 7 OR 10
If these two condition specifications are identical which of the
foll. declarations applies to the situation?
a.
01 TALLY-GROUP PIC 99.
88 RANGE-1 VALUES 6 THRU 10.
88 RANGE-2 VALUES 1 THRU 5.
b.
10 TALLY-GROUP PIC 99.
88 RANGE-1 VALUES 6, 7, 10.
(Range-2 is any condition-name assiciated with TALLY-GROUP)
c.
10 TALLY-GROUP PIC 99.
88 RANGE-1 VALUES 6 THRU 10.
88 RANGE-2 VALUES 8, 9.
d.
10 TALLY-GROUP PIC 99.
88 RANGE-1-AND-NOT-RANGE-2 VALUES 6, 7, 10. |
Choices A, B and C are all correct.
Quote: |
6. In case of relative files, if RELATIVE KEY phrase is also specified
with ACCESS MODE SEQUENTIAL, what will be the result of READ ? |
If the RELATIVE KEY clause is specified for this file, READ statement execution updates the RELATIVE KEY data item to indicate the relative record number of the record being made available.
Quote: |
7 .The use of the INVALID KEY clause helps the programmer in :
a) checking whether the key field has the correct contents.
b) checking for a device error.
c) checking whether a specific file exists.
d) checking whether a specified record exists in a file. |
checking whether a specified record exists in a file
Quote: |
8. Consider the following statements:
MOVE 10 TO XYZ
PERFORM PARA-1 XYZ TIMES.
.................
PARA-1.
.........
MOVE 20 TO XYZ
.........
Which of the following would happen ?
a. PARA-1 would be performed 10 times only.
b. PARA-1 would be performed 20 times.
c. PARA-1 would be performed 21 times.
d. Run-time error occurs and the program aborts. |
PARA-1 would be performed 10 times only
Reason:
Code: |
After the PERFORM statement has been initiated, any change to the identifier has no effect in varying the number of times the procedures are initiated. |
Quote: |
9. Study the following :
RECORD-II.
DN-1.
0 DN-2 PIC X(12).
0 DN-2A PIC 9(8).
DN-1A REDEFINES DN-1.
0 DN-3A PIC XXXX.
0 DN-3 PIC 9(6).
0 DN-3B PIC X(10).
DN-5 PIC X(5).
DN-6 PIC 9(5).
State which of the following statements is correct
a. 66 DN-8 RENAMES DN-2 THRU DN-3.
b. 66 DN-8 RENAMES DN-2 THRU DN-3A.
c. 66 DN-8 RENAMES DN-5 THRU DN-2A.
d. 66 DN-8 RENAMES DN-2A THRU DN-6. |
Question is not clear. I assume like:
01 RECORD-II.
02 DN-1.
05 DN-2 PIC X(12).
05 DN-2A PIC 9(8).
02 DN-1A REDEFINES DN-1.
05 DN-3A PIC XXXX.
05 DN-3 PIC 9(6).
05 DN-3B PIC X(10).
02 DN-5 PIC X(5).
02 DN-6 PIC 9(5).
66 DN-8 RENAMES DN-2A THRU DN-6
Reason:
Code: |
The leftmost character in data-name-3 must not precede the leftmost character in data-name-2; the rightmost character in data-name-3 must not precede the rightmost character in data-name-2. This means that data-name-3 cannot be totally subordinate to data-name-2. |
Quote: |
10. Consider the statement :
IF D-1 = SPACE GO TO PARA-A.
Which of the following is true ?
a. PARA-A will be executed if D-1 contains a blank in the leftmost
position.
b. PARA-A will be executed if D-1 contains a blank in rightmost
position.
c. PARA-A will be executed if D-1 contains all blanks.
d. Syntax is invalid since SPACE cannot be used in a relation
condition statement. |
PARA-A will be executed if D-1 contains all blanks
Reason: SPACE and SPACES have the same meaning.
Quote: |
11. Study the following:
A PIC x(7) VALUE "ABC#D".
D PIC X VALUE "#".
E PIC X(5) VALUE "PQ".
F PIC X(15) VALUE "ABCDEFGHIJKLMNO".
P-1 PIC 99 VALUE 3.
STRING A SPACE E DELIMITED BY "#" INTO F WITH POINTER P-1 ON OVERFLOW DISPLAY "Error".
What will be the contents of F and P-1 after execution of the above:
a. ABC#PQGHIJKLMNO and 6 respectively.
b. ABCABCPQbbbLMNO and 11 respectively.
c. ABABCbPQbbbLMNO and 12 respectively.
d. Overflow condition would occur.
Note : "b" denotes blank in the above. |
ABABCbPQbbbLMNO and 12 respectively
Reason: Starting Position: 3 (Pointer)
Initial Value: ABCDEFGHIJKLMNO"
Strings to be added:
A: ABC#Dbb (7 bytes)
Space: b
E: PQbbb (5 bytes)
So resultant string: ABCbPQbbb (Total 9 Characters)
Added to A from 3 rd postition: ABABCbPQbbbLMNO
Pointer Value : 3 + 9 = 12. |
|
Back to top |
|
|
manoj_madhavan Warnings : 1 New User
Joined: 07 Mar 2005 Posts: 12
|
|
|
|
i think there is an error over tht answer.....
a declration of pic zzz9 is not alphanumeric....it is numeric 9(4) where 3 of the positions are put up for zero suppression.... |
|
Back to top |
|
|
jos.samuel
New User
Joined: 10 Mar 2005 Posts: 3
|
|
|
|
Thank you very much for the answers.
Regards
Samuel |
|
Back to top |
|
|
therasith
New User
Joined: 02 Jan 2004 Posts: 52 Location: chennai
|
|
|
|
Question no 4
A COBOL program when compiled gives an error at the Procedure
Division statement
ADD 10 TO COUNT-ITEMS
Which of the foll. situations could have caused the error?
a. COUNT-ITEMS has a PIC 999V9.
b. COUNT-ITEMS has a PIC ZZZ9.
c. COUNT-ITEMS is not initialised to zero anywhere in the
program
d. COUNT-ITEMS is declared in the FILE SECTION and not the
WORKING-STORAGE SECTION.
Answer:
b. COUNT-ITEMS has a PIC ZZZ9.
The pic clause pic zzz9 [pictue edited]is used for only display purpose we cant use in arithematic functions.
ref
cobol 85 mk roy. |
|
Back to top |
|
|
UNIVERSE
New User
Joined: 15 Mar 2005 Posts: 11 Location: Mumbai
|
|
|
|
If the answer is 13, then it also suitable for 49.
If u cant declare a data name in Level number 13, then u cant do it in 49 also.
I hope the answer should be 88.
Plzzz go for cross-checking.....
Regards
Universe |
|
Back to top |
|
|
UNIVERSE
New User
Joined: 15 Mar 2005 Posts: 11 Location: Mumbai
|
|
|
|
If u dont Initialise the working storage variable, it takes a garbage value by default. To my Knowledge, answer for this Question is C.
Plzz Cross-Check...... |
|
Back to top |
|
|
mcmillan
Site Admin
Joined: 18 May 2003 Posts: 1210 Location: India
|
|
|
|
Dear Universe,
Quote: |
If the answer is 13, then it also suitable for 49.
If u cant declare a data name in Level number 13, then u cant do it in 49 also.
I hope the answer should be 88.
Plzzz go for cross-checking..... |
Yes, you are right Universe... Thanks for the correction. I have changed my Post.
Dear manoj_madhavan,
Quote: |
If u don't Initialise the working storage variable, it takes a garbage value by default. To my Knowledge, answer for this Question is C.
Plzz Cross-Check...... |
Please don't turn around! Why don't you check it at the system? |
|
Back to top |
|
|
therasith
New User
Joined: 02 Jan 2004 Posts: 52 Location: chennai
|
|
|
|
Dears,
How we can declare these are invalid for data name.
we can declare in group memer followed by group level no 01.
if we want to declare (13,88 and 49) these values are must be come under group then right are wrong based on coding what have given.
if give like this
77 a pic 99.
13 b pic 99.
49 c pic xxx.
88 a pic x.
then now we can decide and clarify wrong data name.
So we cant tell about answers without coding.
This is My opinon. |
|
Back to top |
|
|
priya
Moderator
Joined: 24 Jul 2003 Posts: 568 Location: Bangalore
|
|
|
|
Quote: |
COUNT-ITEMS has a PIC ZZZ9
Reason:
Code:
Alphanumeric items cannot be used in Arithmetic Operations. |
You are wrong Mcmillan. PIC ZZZ9 is not alphanumeric. It is numeric-Edited. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hi,
Once I read...'whenever we can ..we should fix errors..'. Good one, at least, I got one point to 'scold' McMillian... , doesn't matter even if it comes in a thread 'dead' since last 3-years.. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
No, it's not an A/N field, but it can contain A/N data (not always, but sometimes).
BTW, a numed field can appear in an arith stmt if it is the final receiving field in a COMPUTE. Not sure about a GIVING field - never tried it. |
|
Back to top |
|
|
|