Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

COBOL Module 1

Start here: COBOL today, its standards, compilers and source format interview questions

Interview questions on “Start here: COBOL today, its standards, compilers and source format”.

12 questions: 4 warm-ups and 8 with model answers · Levels: Fresher to staff

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    How does the COBOL standard differ from a COBOL dialect?

    Answered in the lesson COBOL today: where it runs and which compiler to use

  2. Fresher to mid

    How do cobc -x and cobc -m differ?

    Answered in the lesson Install GnuCOBOL, compile with cobc and run programs

  3. Fresher to mid

    Which areas make up a fixed-form COBOL line, and what goes in each?

    Answered in the lesson Reference format: columns, Areas A and B, free-form

  4. Fresher to mid

    How does a COBOL sentence differ from a statement?

    Answered in the lesson Divisions, paragraphs and the period that ends them

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Mid to senior

    A COBOL report program you tested with GnuCOBOL on your laptop prints signed amounts differently, and its records come out a different size, once the team compiles it on z/OS. How do you find the cause, and how would you make local testing trustworthy?

    What it tests
    Knowing that output and storage depend on the compiler's dialect, comparing like with like, and keeping the target compiler as the final check.
    First step
    Write down both builds: compiler, version and options. Rebuild locally with -std=ibm and compare the outputs again. In the lesson's program the default dialect printed +042.50 and the ibm dialect 04250+, and a two-digit binary item took 1 byte against 2, which is the size IBM documents.
    Follow-ups

    From the lesson COBOL today: where it runs and which compiler to use

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  2. Senior to staff

    A manager quotes a page saying that most bank transactions run on COBOL and asks whether your team should start rewriting its COBOL now. How would you check the claim, and what would you measure instead to make the decision?

    What it tests
    Separating a claim from a measurement, and basing a modernisation decision on the team's own code, risk and cost rather than on industry statistics.
    First step
    Ask for the claim's source and look for the original measurement: who counted, what and when. Then set the claim aside and list what decides a rewrite of your own system: the programs you run, how often they change, the defects and incidents they cause, and who can maintain them.
    Follow-ups

    From the lesson COBOL today: where it runs and which compiler to use

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  3. Mid to senior

    A shell script runs three COBOL batch steps in a row. Step two meets bad input and prints an error, yet the script runs step three and reports success. What do you check in the program and in the script, and how do you fix both?

    What it tests
    Knowing that RETURN-CODE becomes the exit status, that a script carries on unless it tests the status, and that a shell sees only 8 bits of an exit status.
    First step
    Run step two alone on the bad input and print its status with echo $?. A 0 means the program's error path never sets RETURN-CODE; anything else means the script never tests it. Check the value too: a code of 300 arrived as 44 in the lesson, and 4096 would arrive as 0.
    Follow-ups

    From the lesson Install GnuCOBOL, compile with cobc and run programs

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  4. Mid to senior

    Your team builds its COBOL with a plain cobc -x. Which compiler flags would you add to development and test builds, which to the builds that go to production, and why might the two differ?

    What it tests
    Knowing what -Wall, -debug and -std do, that run-time checks cost time, and that every build must use the same dialect.
    First step
    Separate two jobs: finding mistakes and fixing behaviour. -Wall and -debug find mistakes; -std decides how the program behaves. In the lesson, -Wall printed nothing for a subscript of 4 in a table of 3, and only the -debug build stopped with out of bounds: 4 and exit status 1.
    Follow-ups

    From the lesson Install GnuCOBOL, compile with cobc and run programs

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  5. Mid to senior

    After a teammate renamed a data item, a credit-limit calculation began giving smaller limits, yet the program compiles without warnings and the changed lines look correct. What do you suspect, how do you prove it, and how do you stop it happening again?

    What it tests
    Recognising the column-72 margin of fixed form as the cause, proving it from the source and with a test, and adding a check that runs on every build.
    First step
    A rename makes lines longer, so measure every changed line and print what lies after column 72. In the lesson, line 9 ended with 00 in columns 73 and 74, so + 1000000 compiled as + 10000 and the limit came out as 260,000 instead of 1,250,000.
    Follow-ups

    From the lesson Reference format: columns, Areas A and B, free-form

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Senior to staff

    Your team wants to move its fixed-form COBOL to free-form source. What would you check before and after converting, and what might make you keep fixed form?

    What it tests
    Knowing what fixed form gives meaning to and free-form reads differently, how to prove a conversion changed nothing, and the limits of target compilers and tools.
    First step
    List what fixed form gives meaning to and free-form does not: the indicator in column 7 (comments, continuations and D lines), tags in columns 73 to 80, and the Area A rules. Then plan the proof: build before and after, run the same tests and compare the outputs byte for byte.
    Follow-ups

    From the lesson Reference format: columns, Areas A and B, free-form

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  7. Fresher to mid

    Customers in credit are being charged an overdraft fee. The fee paragraph has an IF with no END-IF, and its statements end with periods. How do you find the cause, fix it and stop it coming back?

    What it tests
    Knowing that a separator period ends every open statement, reproducing the bug with a test, and the END-IF style that prevents it.
    First step
    Run the paragraph for one account in credit and one overdrawn, and compare the fees with the expected ones: in the lesson, two accounts gave 050.00 instead of 025.00. Then find where the IF really ends: at the first period after it.
    Follow-ups

    From the lesson Divisions, paragraphs and the period that ends them

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  8. Mid to senior

    You are asked to remove every NEXT SENTENCE from a legacy program because the compiler reports it as archaic. Can you replace each one with CONTINUE mechanically? How would you make the change safely?

    What it tests
    Knowing that NEXT SENTENCE jumps past the next period while CONTINUE does nothing, and changing control flow only under tests.
    First step
    Not mechanically: the two differ whenever statements follow in the same sentence. In the lesson, NEXT SENTENCE inside IF ... END-IF skipped two DISPLAY statements that CONTINUE would have run. For each one, list the statements between it and the next period.
    Follow-ups

    From the lesson Divisions, paragraphs and the period that ends them

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 2 minutes

All COBOL interview questions · The COBOL track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.