COBOL, Java, and Perl Programming Quiz
programming languages Online Quiz - 97
Questions
Which module forces you to declare variables in perl program?
- warnings
- strict
- 5.10.1
- constant
How will you dereference a scalar variable
- $$variablename
- @$variablename
- $@variablename
- %$variablename
Which function allows character by character translation?
- tr
- t
- s
- sd
Forward declaration of subroutine in following way
- sub test;
- sub test {};
- sub test[];
- none of the above
Function to delete file in Perl is
- delete
- unlink
- rename
- deletefile
Which of the following is not a program module
- strict
- warning
- switch
- integer
Given: 10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile?
- Direction d = NORTH;
- Nav.Direction d = NORTH;
- Direction d = Direction.NORTH;
- Nav.Direction d = Nav.Direction.NORTH;
Given: 11. public void testIfA() { 12. if (testIfB("True")) { 13. System.out.println("True"); 14. } else { 15. System.out.println("Not true"); 16. } 17. } 18. public Boolean testIfB(String str) { 19. return Boolean.valueOf(str); 20. } What is the result when method testIfA is invoked?
- True
- Not true
- An exception is thrown at runtime.
- An exception is thrown at runtime
public String makinStrings() { 12. String s = “Fred”; 13. s = s + “47”; 14. s = s.substring(2, 5); 15. s = s.toUpperCase(); 16. return s.toString(); 17. } How many String objects will be created when this method is invoked?
- 1
- 2
- 3
- 5
Given: class Polish { public static void main(String[] args) { int x = 4; StringBuffer sb = new StringBuffer("..fedcba"); sb.delete(3,6); sb.insert(3, "az"); if(sb.length() > 6) x = sb.indexOf("b"); sb.delete((x-3), (x-2)); System.out.println(sb); } } What is the result?
- fdg
- dfg
- gf
- gfg
IN a VSAM KSDS Read statement AT END should be specified only during?
- Dynamic
- Random
- Sequential
- Keyed Sequential
The maximum number of dimensions that an array can have in COBOL-85 is
- 7
- 10
- 9
- 15
"Identify the incorrect statement "
- CALL RAF-SUB.
- CALL RAF-SUB ON OVER FLOW GO TO MIS-SUB.
- CALL RAF-SUB USING PARAM-1.
- CALL RAF-SUB USING PARAM-1 UNTIL PARAM-1 >10 (x)
Indicate which of the following, performs the initialization of the sum controls, LINE-COUNTER and PAGE-COUNTER to their initial values.
- RESET
- INITIATE
- VALUE
- GENERATE
" UNSTRING “ABC” INTO FIELD-1. Indicate which one of the following is correct. " " UNSTRING “ABC” INTO FIELD-1. Indicate which one of the following is correct. "
- There will be a syntax error, as the statement does not contain any DELIMITED BY phrase.
- There will be a syntax error, as the sending string must be identifier and not a literal.
- The statement is correct and after the execution of the statement field-1 will contain the three characters “ABC” from the left-most position and the remaining positions of field-1 will remain unchanged
- The statement is correct and after the execution of the statement field-1 will contain the three characters “ABC” from the left-most position and the remaining positions of field-1 will get filled with spaces
"77 A PIC X(10) VALUE IS “AABBCCDDEE”.In PROCEDURE DIVISION contains the statement EXAMINE A REPLACING ALL “ABC” BY “XYZ” .Indicate which one of the following is true "
- The EXAMINE statement is incorrect because A does not contain the character “ABC” in a continuous sequence
- The EXAMINE statement is incorrect as it can be used to replace a numeric literal by another numeric literal.
- The EXAMINE statement is incorrect as it is used to replace a single character by another single character but not a group of characters.
- The EXAMINE statement is incorrect as TALLYING OPTION is missing.
Indicate which of the following is not a PROCEDURE DIVISION verb
- REWRITE
- INSERT
- DELETE
- START
Indicate which one of the following will not have the INVALID KEY Phrase when used in connection with sequentially accessed relative file in a PROCEDURE DIVISION with out any declarative section.
- REWRITE
- WRITE
- START
- READ
"following COBOL definitions and indicate when the statements are valid (True) or invalid (false): 05 LOCATION-CODE PIC 99. 88 NEW-YORK VALUE 10. 88 BOSTON VALUE 20. 88 DETROIT VALUE 30. 88 NORTH-EAST VALUE 10 20."
- True
- False
Indicate in which of the following, the REPORT NAME does not appear
- RD entry
- INITIATE statement
- SELECT clause
- TERMINATE statement