PL/I Interview Questions & Answers

4 avg. rating (80% score) - 1 votes

PL/I Interview Questions & Answers

What to shift your career to PL/I? Then we have provided you with the complete details about the PL/I Interview Question and Answers on our site page. Carking an interview at very first attempt need very hard working and should have a good knowledge on all concepts as well. To be short about the PL/I is a technical, authoritative computer programming language intended for scientific, engineering, business and system programming uses. If you are good at the PL/I then there are various companies that offer job roles like PL1 Mainframe Programmer, Mainframe PLI Developer, Pl-1 Developer, System Analyst – Mainframes many other roles too. For any other further details on PL/I jobs feel free to visit our site PL/I page.

PL/I Interview Questions

PL/I Interview Questions
    1. Question 1. What Is Pl/i?

      Answer :

      PL/I is a third-generation ( 3GL ) programming language developed in the early 1960s as an alternative to assembler language (for low-level computer processing functions), COBOL (for large-scale business applications), and FORTRAN (for scientific and algorithmic applications). PL/I stands for "Programming Language 1".

    2. Question 2. What Are The Language Features Of Pl/1?

      Answer :

      PL/I is Algol-style block-oriented language : Programs can complied separately and consist of exception blocks (stopped co-routines), regular blocks (begin blocks), statements and subroutines. Procedures can be internal or compiled separately. This type of structure allows the programmer to produce highly-modular applications. 

      PL/1 was the first popular language that has build-in preprocessor : This feature was later copied (and abused) in C.  

      A very neat generalization of Fortran's ability to use separately compiled units. Process statement and external memory allocation class.

      It defined data types for an abstract generalized computer without regard for actual hardware.  PL/1 was the first general purpose language with usable string datatype.  It also has variable length bit strings.

      One of the first general purpose language that has pointers as first class language feature and BASED templates for them with arbitrary data structure.

      PL/I contained very powerful set of control structures control structures which in some ways remains unsurpassable and that is far superior to what C language got (despite C being a derivate of PL1). Of mainstream languages only Perl can compete with PL/1 as for richness and flexibility of control structures.

      PL/I supports arrays, structures, unions, arrays of structures or unions, structures or unions of arrays, and combinations thereof.

      PL/1 concept of area and ability to allocate storage in particular area along with multi-entry procedures was the construct that allow OO-style programming without typical for OO overhead.

      PL/1 was used in Multics as a system programming language, one of the first attempt to write OS in high level language (that attempt inspired Unix and C has by-and-large PL/1 semantic and structure).

      PL/1 compilers used to represent to edge of compiler development with IBM optimizing and debugging compliers for many years representing the top of the class. PC/C compiler (which was developed in Cornell and compiled large subset of PL/1) was and remains one of best compiler for educational purposes that I ever saw. They still look amazing even now, half a century s after their initial release, especially in diagnostic messages quality.  

      Multi tasking was implemented by PL/I F, the Optimizer and the newer AIX and Z/OS compilers. It comprised the data types EVENT and TASK,the TASK-option on the CALL-statement (Fork), the WAIT-statement (JOIN), the DELAY(delay-time), EVENT-options on the record I/O statements and the UNLOCK statement to unlock locked records on EXCLUSIVE files. 

    3. Question 3. What Are The Exceptions In Pl/1

      Answer :

      PL/1 was the first mainstream language that introduced exceptions. It is interesting to note that half of extensions of C++ including exceptions was related to features that creators of C removed from PL/1 when they created the language :-).

      It is interesting to note that PL/1 was the first programming language that provides correct handing of such a common problem as detection of the end of the sequential file while reading. In PL/1 endfile condition is raised which activates stopped coroutine (exception handler) within which  programmer can do whatever he wish but typically jump to the statement after the loop. This usage of goto is definitely superior to misguided attempts to make this test in the header of the loop like was done in C and Perl.

        DO WHILE (TRUE); 
         ... ... ...

      It is important to note that PL/1 was used as a system programming language for such an important operating system as  Multics -- the originator of many ideas that later were reimplemented in Unix.  In partially bastardized way, key ideas and most of PL/1 statements and variables semantics can be found in C which should probably be considered to be an indirect derivative and great simplification of PL/1 core.

    4. Question 4. Explain About Multiple Entries In Procedures In Pl/1?

      Answer :

      One of entry points can serve as the constructor. Others as methods. But that's up to programmer. As procedures can be nested that provides sub classing. If all variables were static that constructor was not really necessary. Of course nothing was still formalized, but that was happening in early 60th not in late 80th .

      But there was a beauty in it: this was a very simple and very effective technique of creating your own namespace for the set of procedures; technique that any programmer can easily learn and successfully apply. So successfully that usually he/she did not write in other way since this point.

      Allocation of variable in the stack was also optional as servers at this time were really minuscule even in comparison with modern smartphones; the latter are far suprassing the largest of system 360 servers in capabilities including CPU speed, memory size and the size of the harddrives. 

    5. Question 5. Explain About Language Plus Preprocessor Scheme?

      Answer :

      PL/1 used the scheme that later became fashionable when it was reimplementation  in C and later went in C++: the idea of integrated preprocessor of the language. In PL/1 as far as I know it was not widely used, but was available in all full language implementations, starting with IBM F compiler.

    6. Question 6. Explain Pl/1 Program Structure?

      Answer :

      The power of PL/1 came from a well organized set of statements and types of variables that it supported. It first introduced into language all three major classes of variables that are used in modern languages: static (like in Fortran common), automatic (allocated via stack, destroyed on exit from the procedure, and controlled (heap allocation).

      It also contained some esoteric memory allocation  features like areas of memory in which you can allocate your variables. Visibility was contolled by procedure scoping and there was special class external variable that was exported in linked procedures (each variable was like separate common block in Fortran).

    7. Question 7. Explain The History Of Pl/1?

      Answer :

      PL/1 was developed as an IBM product in the mid 1960's, and was originally named NPL (New Programming Language). The name was changed to PL/1 to avoid confusion of acronym NPL with the National Physical Laboratory in England. The first PL/1 compiler that was shipped with OS/360 was so called F-compiler. In was slow multipass compiler that was designed to operate with tiny memory amount of memory (64K) that was available in first mainframes.

    8. Question 8. Explain About Data Declaration In Pl/1?

      Answer :

      When a PL/I program is executed, it can manipulate many different data items of particular data types. Each data item, except an unnamed arithmetic or string constant, is referred to in the program by a name. Each data name is given attributes and a meaning by a declaration (explicit or implicit).

      A data item is either the value of a variable or a constant. (Note that these terms, as used here, are not exactly the same as in general mathematical usage.) Data items can be single items, called scalars, or they can be a collection of items called data aggregates that are groups of data items that can be referred to either collectively or individually. The types of data aggregates are arrays, structures, and unions.

      A variable has a value or values that might change during execution of a program. A variable is introduced by a declaration, which declares the name and certain attributes of the variable. A name is explicitly declared if it appears in a DECLARE statement that explicitly declares attributes of names.

      A constant has a value that cannot change. Constants for computational data are referred to by stating the value of the constant or naming the constant in a DECLARE statement.

    9. Question 9. Explain About Data Sets?

      Answer :

      In addition to being used as input from and output to your terminal, data sets are stored on a variety of auxiliary storage media, including magnetic tape and direct access storage devices (DASDs). Despite their variety, these media have characteristics that allow common methods of collecting, storing, and transmitting data. The organization of a data set determines how data is recorded in a data set and how the data is subsequently retrieved so that it can be transmitted to the program. Records are stored in and retrieved from a data set either sequentially, on the basis of successive physical or logical positions, or directly, by the use of keys specified in data transmission statements.

      PL/I supports the following types of data set organizations:

      Consecutive : In the consecutive data set organization, records are organized solely on the basis of their successive physical positions. When the data set is created, records are written consecutively in the order in which they are presented. The records can be retrieved only in the order in which they were written.

      Indexed : In the indexed data set organization, records are placed in a logical sequence based on the key of each record. An indexed data set must reside on a direct-access device. A character string key identifies the record and allows direct retrieval, replacement, addition, and deletion of records. Sequential processing is also allowed.

      Relative : In the relative data set organization, numbered records are placed in a position relative to each other. The records are numbered in succession, beginning with one. A relative data set must reside on a direct-access device. A key that specifies the record number identifies the record and allows direct retrieval, replacement, addition, and deletion of records. Sequential processing is also allowed.

      Regional :  The regional data set organization is divided into numbered regions, each of which can contain one record. The regions are numbered in succession, beginning with zero. A region can be accessed by specifying its region number, and perhaps a key, in a data transmission statement. The key specifies the region number and identifies the region to allow optimized direct retrieval, replacement, addition, and deletion of records.

      The data set organizations differ in the way they store data and in the means they use to access data.

    10. Question 10. Explain About Data Transmission In Pl/1?

      Answer :

      PL/I uses two types of data transmission: stream and record.

      In stream-oriented data transmission, the organization of the data in the data set is ignored within the program, and the data is treated as though it were a continuous stream of individual data values in character form. Data is converted from character form to internal form on input, and from internal form to character form on output.

      In record-oriented data transmission, the data set is a collection of discrete records. The record on the external medium is generally an exact copy of the record as it exists in internal storage. No data conversion takes place during record-oriented data transmission. On input, the data is transmitted exactly as it is recorded in the data set, and on output, it is transmitted exactly as it is recorded internally.

    11. Question 11. Explain Pl/i Interfaces To Other Products?

      Answer :

      PL/I can interface with sort programs, C, the Checkpoint/Restart facility, and user exits.

      The Sort program

      The compiler provides an interface called PLISRTx (x = A, B, C, or D) that allows you to make use of the IBM-supplied Sort programs.

      When used from PL/I, the Sort program sorts records of all normal lengths on a large number of sorting fields. Data of most types can be sorted into ascending or descending order. The source of the data to be sorted can be either a data set or a user-written PL/I procedure that the Sort program will call each time a record is required for the sort. Similarly, the destination of the sort can be a data set or a PL/I procedure that handles the sorted records.

      Inter-Language Communication with C

      • Inter-Language Communication (ILC) between PL/I and C allows you to use many of the data types common to both languages and should enable you to write PL/I code that either calls or is called by C.

      The Checkpoint/Restart facility

      • The PL/I Checkpoint/Restart feature provides a convenient method of taking checkpoints during the execution of a long-running program in a batch environment.
      • PL/I Checkpoint/Restart uses the Advanced Checkpoint/Restart Facility of the operating system.

      User exits

      • PL/I provides a number of user exits that allow you to customize the PL/I product to suit your needs. The PL/I products supply default exits and the associated source files.
      • With PL/I, you can write your own user exit or use the exit provided with the product, either "as is" or modified, depending on what you want to do with it.

    12. Question 12. Explain About Preprocessor In Pl/1?

      Answer :

      The PL/I compiler allows you to select one or more of the integrated preprocessors as required for use in your program. You can select the include preprocessor, the macro preprocessor, the SQL preprocessor, or the CICS® preprocessor—and you can select the order in which you would like them to be called.

      Each preprocessor supports a number of options to allow you to tailor the processing to your needs.

      Include preprocessor : This allows you to incorporate external source files into your programs by using include directives other than the PL/I directive %INCLUDE (the %INCLUDE directive is used to incorporate external text into the source program).

      Macro preprocessor : Macros allow you to write commonly used PL/I code in a way that hides implementation details and the data that is manipulated, and exposes only the operations. In contrast to a generalized subroutine, macros allow generation of only the code that is needed for each individual use.

      DB2 precompiler or DB2 coprocessor :In general, the structure of your Pl/I program is the same whether or not you want it to access a DB2 database. However, to retrieve, update, insert, and delete DB2 data, you must:

      • Connect to a data server : Execute SQL statements. SQL statements must begin with EXEC SQL.
      • Disconnect from the data server : To prepare the program for execution, you follow one of these procedures:
      • Preprocess, precompile, compile, link, and bind the program.
      • Preprocess, then compile the program with the SQL option, and then link and bind the program.
      • Before you can take advantage of EXEC SQL support, you must have authority to access a DB2® system.
      • Note that the PL/I SQL Preprocessor currently does not support DBCS.

      CICS preprocessor : You can use EXEC CICS statements in PL/I applications that run as transactions under CICS.

    13. Question 13. Explain About The Sax Parser?

      Answer :

      The PL/I compiler provides an interface called PLISAXx (x = A or B) that provides you with basic XML capability. The support includes a high-speed XML parser, which allows programs to accept inbound XML messages, check them for being well-formed, and transform their contents to PL/I data structures.

      The XML support does not provide XML generation, which must instead be accomplished by PL/I program logic. The XML support has no special environmental requirements. It executes in all the principal runtime environments, including CICS®, IMS™, and MQ Series, as well as z/OS batch and TSO.

    14. Question 14. Explain About Pl/i Input And Output Statements?

      Answer :

      PL/I input and output statements (such as READ, WRITE, GET, PUT) let you transmit data between the main storage and auxiliary storage of a computer.

      A collection of data external to a program is called a data set. Transmission of data from a data set to a program is called input. Transmission of data from a program to a data set is called output. (If you are using a terminal, "data set" can also mean your terminal.)

      PL/I input and output statements are concerned with the logical organization of a data set and not with its physical characteristics. A program can be designed without specific knowledge of the input/output devices that are used when the program is executed. To allow a source program to deal primarily with the logical aspects of data rather than with its physical organization in a data set, PL/I employs models of data sets, called files. A file can be associated with different data sets at different times during the execution of a program.

    15. Question 15. What Are The Data Types In Pl/1?

      Answer :

      Data types : 

      A characteristic of PL/I that contributes to the range of applications for which it can be used is the variety of data types that can be represented and manipulated. Data types include:

      • Real or complex, floating-point or fixed-point, signed or unsigned binary or decimal, and numeric and editable picture data with programmer selected precision.
      • Varying or nonvarying, character or bit or graphic, run-time adjustable or compile-time fixed length strings.
      • Program control data supporting pointer and offset locators, adjustable or fixed size areas for grouping of dynamic allocations, entry data ("function pointers"), and file, label, and format data.

      Areas may be written out to the disk and read back at a later date permitting preservation of linked-lists.

    16. Question 16. Explain About Data Arrays, Structures, And Unions In Pl/1?

      Answer :

      In PL/I, data items can be single data elements or they can be grouped together to form data aggregates that can be referred to either collectively or individually. Data aggregates can be arrays, structures, unions, arrays of structures or unions, structures or unions of arrays, and combinations thereof, providing a very rich foundation for the description and manipulation of any conceivable data.

      For example :  if an array of structures were used to hold meteorological data for each month of the 20th and the 21st centuries, it might be declared as follows:

          Declare 1 Year(1901:2100),

                    3 Month(12),

                      5 Temperature,

                        7 High decimal fixed(4,1),

                        7 Low decimal fixed(4,1),

                      5 Wind&us.velocity,

                        7 High decimal fixed(3),

                        7 Low decimal fixed(3),

                      5 Precipitation,

                        7 Total decimal fixed(3,1),

                        7 Average decimal fixed(3,1),

                    3 * char(0);

      The weather data for July 1991 is contained in the element Year(1991,7) of the array of structures Year. Portions of this data can be referred to by Temperature(1991,7) or Precipitation(1991,7).

    17. Question 17. Explain About Data Manipulation?

      Answer :

      Data may be manipulated as individual items or as an aggregate. For example, one invocation of the SQRT built-in function can take the square root of an entire 15-dimensional array, producing an identical array containing square root values in the corresponding elements.

    18. Question 18. What Are The Storage Classes, Control, And Dynamic Storage Allocation?

      Answer :

      Four different storage classes: AUTOMATIC, STATIC, CONTROLLED, and BASED are provided.. Application objects' data type, representation, nature of use, etc. normally dictates the type of storage class used for each. Programmers can dynamically allocate and free based and controlled storage.

      For all storage classes, data may be automatically initialized when it is allocated.

    19. Question 19. What Are The Built-in Functions In Pl/1?

      Answer :

      Built-in functions:  PL/I provides almost 200 built-in functions, pseudovariables, and subroutines that manipulate scalar and aggregate data. These functions cover:

      • Character, Bit, and Graphic string manipulation (e.g. INDEX, CENTER)
      • Arithmetic computation (e.g. MAX, RANDOM)
      • Mathematical computation (e.g. ATANH, GAMMA)
      • Floating point inquiries (e.g. HUGE, TINY)
      • Floating point manipulation (e.g. SUCC, SCALE)
      • Integer manipulation (e.g. IAND, RAISE2)
      • Precision handling (e.g. BINARY, UNSIGNED)
      • Array manipulation (e.g. HBOUND, SUM)
      • Storage control (e.g. EMPTY, ADDR)
      • Condition handling (e.g. ONCHAR, ONLOC)
      • Input/Output (e.g. COUNT, FILEOPEN)
      • Date/Time manipulation (e.g. DATETIME, DATE)

    20. Question 20. How Do We Handle Conditions In Pl/1?

      Answer :

      Condition handling : PL/I provides facilities to handle a variety of conditions that can arise during PL/I program execution. These conditions may be expected or unexpected and may be detected by the hardware (e.g ZERODIVIDE) or detected by PL/I (e.g. CONVERSION) or the operating system or other software. Using these facilities, you can indeed write applications in PL/I that can provide non-stop operations. No one comes close!

      You can even handle user initiated attention interrupts and normal and abnormal program termination.

    21. Question 21. Explain About Macro Facility?

      Answer :

      The macro facility permits conditional compilation and modification of PL/I source before the compilation. For example, a programmer might include specific code during development and testing, and exclude it from a production program.

    22. Question 22. Explain About Program Checkout?

      Answer :

      Conditions can be enabled in a variety of ways to have your program automatically diagnosed for

      • Array subscripts being out of range.
      • String and substrings being out of range.
      • Data exceeding declared or machine supported precisions.

    23. Question 23. Explain About The Multics Pl/1 Compiler?

      Answer :

      The Multics PL/1 compiler is in many respects a "second generation" PL/1 compiler. It was built at a time when the language was considerably more stable and well defined than it had been when the first compilers were built [1,2]. It has benefited from the experience of the first compilers and avoids some of the difficulties which they encountered. The Multics compiler is the only PL/1 compiler written in PL/1 and is believed to be the first PL/1 compiler to produce high speed object code.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Lisp programming Tutorial