0

programming languages Online Quiz - 97

Description: programming languages Online Quiz - 97
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Which module forces you to declare variables in perl program?

  1. warnings

  2. strict

  3. 5.10.1

  4. constant


Correct Option: C

How will you dereference a scalar variable

  1. $$variablename

  2. @$variablename

  3. $@variablename

  4. %$variablename


Correct Option: A

Which function allows character by character translation?

  1. tr

  2. t

  3. s

  4. sd


Correct Option: A

Forward declaration of subroutine in following way

  1. sub test;

  2. sub test {};

  3. sub test[];

  4. none of the above


Correct Option: A

Function to delete file in Perl is

  1. delete

  2. unlink

  3. rename

  4. deletefile


Correct Option: B

Which of the following is not a program module

  1. strict

  2. warning

  3. switch

  4. integer


Correct Option: C

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?

  1. Direction d = NORTH;

  2. Nav.Direction d = NORTH;

  3. Direction d = Direction.NORTH;

  4. Nav.Direction d = Nav.Direction.NORTH;


Correct Option: D

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?

  1. True

  2. Not true

  3. An exception is thrown at runtime.

  4. An exception is thrown at runtime


Correct Option: A

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. 1

  2. 2

  3. 3

  4. 5


Correct Option: D

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?

  1. fdg

  2. dfg

  3. gf

  4. gfg


Correct Option: C

IN a VSAM KSDS Read statement AT END should be specified only during?

  1. Dynamic

  2. Random

  3. Sequential

  4. Keyed Sequential


Correct Option: D

The maximum number of dimensions that an array can have in COBOL-85 is

  1. 7

  2. 10

  3. 9

  4. 15


Correct Option: A

"Identify the incorrect statement "

  1. CALL RAF-SUB.

  2. CALL RAF-SUB ON OVER FLOW GO TO MIS-SUB.

  3. CALL RAF-SUB USING PARAM-1.

  4. CALL RAF-SUB USING PARAM-1 UNTIL PARAM-1 >10 (x)


Correct Option: D

AI Explanation

To answer this question, we need to understand the syntax and usage of the CALL statement in programming.

Option A) CALL RAF-SUB - This option is correct because it simply calls the subroutine RAF-SUB without any additional parameters or conditions.

Option B) CALL RAF-SUB ON OVERFLOW GO TO MIS-SUB - This option is correct because it calls the subroutine RAF-SUB and specifies that if an overflow occurs during the execution of RAF-SUB, the program should transfer control to the subroutine MIS-SUB.

Option C) CALL RAF-SUB USING PARAM-1 - This option is correct because it calls the subroutine RAF-SUB and passes the value of PARAM-1 as an argument to the subroutine.

Option D) CALL RAF-SUB USING PARAM-1 UNTIL PARAM-1 >10 - This option is incorrect because the syntax is not valid. The "UNTIL" keyword is not a valid keyword in the CALL statement. It seems to be a mix-up with the syntax of a looping statement.

Therefore, the correct answer is D) CALL RAF-SUB USING PARAM-1 UNTIL PARAM-1 >10.

Indicate which of the following, performs the initialization of the sum controls, LINE-COUNTER and PAGE-COUNTER to their initial values.

  1. RESET

  2. INITIATE

  3. VALUE

  4. GENERATE


Correct Option: B

" 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. "

  1. There will be a syntax error, as the statement does not contain any DELIMITED BY phrase.

  2. There will be a syntax error, as the sending string must be identifier and not a literal.

  3. 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

  4. 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


Correct Option: B

"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 "

  1. The EXAMINE statement is incorrect because A does not contain the character “ABC” in a continuous sequence

  2. The EXAMINE statement is incorrect as it can be used to replace a numeric literal by another numeric literal.

  3. The EXAMINE statement is incorrect as it is used to replace a single character by another single character but not a group of characters.

  4. The EXAMINE statement is incorrect as TALLYING OPTION is missing.


Correct Option: C

Indicate which of the following is not a PROCEDURE DIVISION verb

  1. REWRITE

  2. INSERT

  3. DELETE

  4. START


Correct Option: B

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.

  1. REWRITE

  2. WRITE

  3. START

  4. READ


Correct Option: A

Indicate in which of the following, the REPORT NAME does not appear

  1. RD entry

  2. INITIATE statement

  3. SELECT clause

  4. TERMINATE statement


Correct Option: C

AI Explanation

To answer this question, we need to understand the different parts of a program or statement that may include a REPORT NAME.

Option A) RD entry - This option is incorrect because a Report Definition (RD) entry is a statement that defines the properties and attributes of a report, including the report name.

Option B) INITIATE statement - This option is incorrect because the INITIATE statement is used to start the execution of a report program. It typically includes the report name to specify which report program to execute.

Option C) SELECT clause - This option is correct because the SELECT clause is used to specify the fields to be included in the report output. It does not typically include the report name.

Option D) TERMINATE statement - This option is incorrect because the TERMINATE statement is used to end the execution of a report program. It does not typically include the report name.

The correct answer is C) SELECT clause. This option is correct because the SELECT clause does not typically include the report name.

- Hide questions