Programming Languages: Java, JCL, and Perl

Test your knowledge of fundamental concepts in Java, IBM Mainframe JCL, and Perl programming including data types, array operations, object-oriented features, and language-specific syntax.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Assume @list contains (“1”, “2”, “3”, “4”, “5” ). What is the content of @list after the following statement splice (@list, -1, 1, “test1”. “test2”);

  1. (“1”, “2”, “3”, “4”, “test1”, “test2”)
  2. ( “2”, “3”, “4”, “test1”, “test2”)
  3. (“1”, “3”, “4”, “test1”, “test2”)
  4. (“1”, “test1”, test2”, “2”, “3”, “4” )
Question 2 Multiple Choice (Single Answer)

What argument to splice is equivalent to push (@array, @sublist) function call?

  1. splice (@array,0.0.@sublist);
  2. splice (@array, scalar(@array),0, @sublist);
  3. splice (@array, 1, 0, @sublist);
  4. None
Question 3 Multiple Choice (Single Answer)

If $string contains abcdefgh , what will the following call return? substr($string, -2, 2);

  1. abc
  2. efgh
  3. gh
  4. None
Question 4 Multiple Choice (Single Answer)

If $string contains abcdabcd , what will the following call return? index ($string, “cd”, 3);

  1. 6
  2. 4
  3. -1
  4. 3
Question 5 Multiple Choice (Single Answer)

Which operator can be used to access the first item in an array?

  1. shift
  2. start
  3. right$
  4. left$
Question 6 Multiple Choice (Single Answer)

Which statement will print the capital attribute of the $kansas object?

  1. print ("capital"=>$kansas);
  2. print {$kansas}=>(capital);
  3. print (capital)<={$kansas};
  4. print $kansas->{"capital"};
Question 7 Multiple Choice (Single Answer)

Which function can be used to make sure your program exits with a nonzero status even if there a standard error?

  1. hash
  2. noexit
  3. nozero
  4. die
Question 8 Multiple Choice (Single Answer)

Syntax of OBJECT Parameter

  1. //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INFILE(DD1) OUTDATASET(USERID.TEST.VSAM) /*
  2. //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INFILE(DD1) OUTFILE(USERID.TEST.VSAM) /*
  3. //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INDATASET(DD1) OUTDATASET(USERID.TEST.VSAM) /*
  4. //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INDATASET(DD1) OUTFILE(USERID.TEST.VSAM) /*
Question 9 Multiple Choice (Single Answer)

Correct Syntax for RESTORE Statement

  1. //JOB1 JOB accounting information //STEP1 EXEC PGM=ADRDSSU //SYSPRINT DD SYSOUT=A //TAPE DD UNIT=3480,VOL=SER=(TAPE01,TAPE02), // LABEL=(1,SL),DISP=(OLD,
  2. //JOB1 JOB accounting information //STEP1 EXEC PGM=ADRDSSU //SYSPRINT DD SYSOUT=A //TAPE DD UNIT=3480,VOL=SER=(TAPE01,TAPE02), // LABEL=(1,SL),DISP=(OLD,
  3. //JOB1 JOB accounting information //STEP1 EXEC PGM=ADRDSSU //SYSPRINT DD SYSOUT=A //TAPE DD UNIT=3480,VOL=SER=(TAPE01,TAPE02), // LABEL=(1,SL),DISP=(OLD,
  4. //JOB1 JOB accounting information //STEP1 EXEC PGM=ADRDSSU //SYSPRINT DD SYSOUT=A //TAPE DD UNIT=3480,VOL=SER=(TAPE01,TAPE02), // LABEL=(1,SL),DISP=(OLD,
Question 10 Multiple Choice (Single Answer)

Which of the following is not applicable in LIKE parameter?

  1. //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG(+1), //SAMPLE DDDSN=M
  2. //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG(+1), //SAMPLE DDDSN=M
  3. //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG(+1), //SAMPLE DDDSN=M
  4. //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG, //SAMPLE DDDSN=MYLIB
Question 11 Multiple Choice (Single Answer)

Which of the following syntax is not correct?

  1. //STEP40 EXEC PGM=IDCAMS,REGION=2048K //SYSPRINT DD SYSOUT=* DEFINE CLUSTER (NAME(USERID.TEST.VSAM)- VOL(*)- TRK(1,2)- INDEXED- SPEED-
  2. //JSTY0020 EXEC PGM=IDCAMS,COND=(0,NE) //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD *
  3. //STEP20 EXEC PGM=IDCAMS,REGION=2048K //SYSPRINT DD SYSOUT=* DELETE USERID.TEST.VSAM' SET MAXCC = 0
  4. None of the above
Question 12 Multiple Choice (Single Answer)

Which is the correct syntax of DUMP Statement?

  1. DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre | SHR} } {SPHERE} {OUTDDname | ODD} (ddn {,ddn,...)
  2. DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre ¦ SHR} } {SPHERE} {OUTDDname ¦ ODD} (ddn {,ddn,...)
  3. DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre | SHR} } {SPHERE} {OUTDDname | EVEN} (ddn {,ddn,...)
  4. DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre ¦ SHR} } {SPHERE} {OUTDDname ¦ EVEN} (ddn {,ddn,...)
Question 13 Multiple Choice (Single Answer)

The correct Syntax of a Bind Statement

  1. DSN SYSTEM(SSID) BIND PLAN(PLAN1) - MEMBER (PROGRAM1) - QUALIFIER(DB1) - ISOLATION(CS)
  2. DSN SYSTEM(SSID) - BIND PLAN(PLAN1) - MEMBER (PROGRAM1) - QUALIFIER(DB1) - ISOLATION(CS) -
  3. DSN SYSTEM(SSID) BIND PLAN(PLAN1) - MEMBER (PROGRAM1) - QUALIFIER(DB1) - ISOLATION(CS) -
  4. None of the above
Question 14 True/False

A signed data type has an equal number of non-zero positive and negative values available.

  1. True
  2. False
Question 15 Multiple Choice (Multiple Answers)

Choose the valid identifiers from those listed below.

  1. BigOlLongStringWithMeaninglessName
  2. $int
  3. bytes
  4. $1
  5. finalist
Question 16 Multiple Choice (Multiple Answers)

Which of the following signatures are valid for the main() method entry point of an application?

  1. public static void main()
  2. public static void main(String arg[])
  3. public void main(String [] arg))
  4. public static void main(String[] args))
  5. public static int main(String [] arg))
Question 17 Multiple Choice (Single Answer)

If all three top-level elements occur in a source file, they must appear in which order?

  1. Imports, package declaration, classes
  2. Classes, imports, package declarations
  3. Package declaration must come first; order for imports and class definitions is not
  4. Package declaration, imports, classes
  5. Imports must come first; order for package declaration and class definitions is not
Question 18 Multiple Choice (Multiple Answers)

Consider the following line of code: int x[] == new int[25]; After execution, which statement or statements are true?

  1. x[24] is 0
  2. x[24] is undefined
  3. x[25] is 0
  4. x[0] is null
  5. x.length is 25
Question 19 Multiple Choice (Single Answer)

How can you force garbage collection of an object in Java?

  1. Garbage collection cannot be forced
  2. Call System.gc()
  3. Call System.gc(), passing in a reference to the object to be garbage-collected
  4. Call Runtime.gc()
  5. Set all references to the object to new values (null, for example)
Question 20 Multiple Choice (Single Answer)

What is the range of values that can be assigned to a variable of type byte?

  1. It depends on the underlying hardware
  2. 0 through 28–1
  3. 0 through 216–1
  4. –27 through 27–1
  5. –215 through 215–1