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.
Questions
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”, “2”, “3”, “4”, “test1”, “test2”)
- ( “2”, “3”, “4”, “test1”, “test2”)
- (“1”, “3”, “4”, “test1”, “test2”)
- (“1”, “test1”, test2”, “2”, “3”, “4” )
What argument to splice is equivalent to push (@array, @sublist) function call?
- splice (@array,0.0.@sublist);
- splice (@array, scalar(@array),0, @sublist);
- splice (@array, 1, 0, @sublist);
- None
If $string contains abcdefgh , what will the following call return? substr($string, -2, 2);
- abc
- efgh
- gh
- None
If $string contains abcdabcd , what will the following call return? index ($string, “cd”, 3);
- 6
- 4
- -1
- 3
Which operator can be used to access the first item in an array?
- shift
- start
- right$
- left$
Which statement will print the capital attribute of the $kansas object?
- print ("capital"=>$kansas);
- print {$kansas}=>(capital);
- print (capital)<={$kansas};
- print $kansas->{"capital"};
Which function can be used to make sure your program exits with a nonzero status even if there a standard error?
- hash
- noexit
- nozero
- die
Syntax of OBJECT Parameter
- //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INFILE(DD1) OUTDATASET(USERID.TEST.VSAM) /*
- //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INFILE(DD1) OUTFILE(USERID.TEST.VSAM) /*
- //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INDATASET(DD1) OUTDATASET(USERID.TEST.VSAM) /*
- //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //DD1 DD DSN=USERID.KSDS.BACKUP,DISP=SHR //SYSIN DD * IMPORT INDATASET(DD1) OUTFILE(USERID.TEST.VSAM) /*
Correct Syntax for RESTORE Statement
- //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,
- //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,
- //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,
- //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,
Which of the following is not applicable in LIKE parameter?
- //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG(+1), //SAMPLE DDDSN=M
- //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG(+1), //SAMPLE DDDSN=M
- //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG(+1), //SAMPLE DDDSN=M
- //TESTJOB JOB (ER456),‘XXXXX‘ //STEP1 EXEC PGM=IEFBR14 //SYSOUT DD SYSOUT=* //OUTPU1 DD DSN=MYLIB.TEST.GDG, //SAMPLE DDDSN=MYLIB
Which of the following syntax is not correct?
- //STEP40 EXEC PGM=IDCAMS,REGION=2048K //SYSPRINT DD SYSOUT=* DEFINE CLUSTER (NAME(USERID.TEST.VSAM)- VOL(*)- TRK(1,2)- INDEXED- SPEED-
- //JSTY0020 EXEC PGM=IDCAMS,COND=(0,NE) //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD *
- //STEP20 EXEC PGM=IDCAMS,REGION=2048K //SYSPRINT DD SYSOUT=* DELETE USERID.TEST.VSAM' SET MAXCC = 0
- None of the above
Which is the correct syntax of DUMP Statement?
- DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre | SHR} } {SPHERE} {OUTDDname | ODD} (ddn {,ddn,...)
- DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre ¦ SHR} } {SPHERE} {OUTDDname ¦ ODD} (ddn {,ddn,...)
- DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre | SHR} } {SPHERE} {OUTDDname | EVEN} (ddn {,ddn,...)
- DUMP DATASET | DS (INCLUDE(dsn,…) ALLData(dsn | (*)) ALLExcp | ALLX { {SHAre ¦ SHR} } {SPHERE} {OUTDDname ¦ EVEN} (ddn {,ddn,...)
The correct Syntax of a Bind Statement
- DSN SYSTEM(SSID) BIND PLAN(PLAN1) - MEMBER (PROGRAM1) - QUALIFIER(DB1) - ISOLATION(CS)
- DSN SYSTEM(SSID) - BIND PLAN(PLAN1) - MEMBER (PROGRAM1) - QUALIFIER(DB1) - ISOLATION(CS) -
- DSN SYSTEM(SSID) BIND PLAN(PLAN1) - MEMBER (PROGRAM1) - QUALIFIER(DB1) - ISOLATION(CS) -
- None of the above
A signed data type has an equal number of non-zero positive and negative values available.
- True
- False
Choose the valid identifiers from those listed below.
- BigOlLongStringWithMeaninglessName
- $int
- bytes
- $1
- finalist
Which of the following signatures are valid for the main() method entry point of an application?
- public static void main()
- public static void main(String arg[])
- public void main(String [] arg))
- public static void main(String[] args))
- public static int main(String [] arg))
If all three top-level elements occur in a source file, they must appear in which order?
- Imports, package declaration, classes
- Classes, imports, package declarations
- Package declaration must come first; order for imports and class definitions is not
- Package declaration, imports, classes
- Imports must come first; order for package declaration and class definitions is not
Consider the following line of code: int x[] == new int[25]; After execution, which statement or statements are true?
- x[24] is 0
- x[24] is undefined
- x[25] is 0
- x[0] is null
- x.length is 25
How can you force garbage collection of an object in Java?
- Garbage collection cannot be forced
- Call System.gc()
- Call System.gc(), passing in a reference to the object to be garbage-collected
- Call Runtime.gc()
- Set all references to the object to new values (null, for example)
What is the range of values that can be assigned to a variable of type byte?
- It depends on the underlying hardware
- 0 through 28–1
- 0 through 216–1
- –27 through 27–1
- –215 through 215–1