0

programming languages Online Quiz - 102

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

What does the zeroth element of the string array passed to the public static void main method contain?

  1. The name of the program

  2. The number of arguments

  3. The first argument if one is present

  4. All the arguments


Correct Option: C
  1. Under all circumstances

  2. Unless A is abstract

  3. A class that implements an interface cannot be abstract

  4. none of the above


Correct Option: B

An abstract class can have non abstract methods

  1. True

  2. False


Correct Option: A

Is Super a keyword or a method?

  1. keyword

  2. method

  3. both

  4. none of the above


Correct Option: A

It is legal to access a static method using an instance of the class

  1. True

  2. False


Correct Option: B

If a constructor is defined with arguments, a default constructor is still provided automatically

  1. True

  2. False


Correct Option: B

Assuming all variables are declared and initialized properly, for(i=1,j-2; i< 3 ; i++, j++) {}; This class will not compile

  1. True

  2. False


Correct Option: B

Select correct answers

  1. Interfaces can implement multiple interfaces

  2. Interfaces can extend any number of other interfaces.

  3. Members of an interface are never static.

  4. class can extend multiple classes


Correct Option: C
  1. The conditional expression in an if statement can have method calls.

  2. If a and b are of type boolean, the expression (a = b) can be the conditional expression of an if statement.

  3. The conditional expression in an if statement cannot have method calls.

  4. The statement if (false) ; else ; is illegal.

  5. Only expressions which evaluate to a boolean value can be used as the condition in an if statement.


Correct Option: A,B,E

Select a correct answer

  1. Private methods cannot be overridden in subclasses

  2. A subclass can override any method in a superclass.

  3. An overriding method can declare that it throws more exceptions than the method it is overriding.

  4. The parameter list of an overriding method must be a subset of the parameter list of the method that it is overriding.

  5. The overriding method can have a different return type than the overridden method.


Correct Option: A

What is the result?

  1. Data Exception Error

  2. ABCDE ABCDE

  3. ABCDE bbbbb

  4. Compilation error


Correct Option: B

Can we declare a variable with PIC S9(9)V9(9)?.How many bytes will it occupy?

  1. No .It occupies 20 bytes

  2. No.It occupies 19 bytes

  3. Yes.It occupies 18 bytes.

  4. None of these


Correct Option: C
  1. Program C compilation and linkedit is enough

  2. Program A ,Program B and Program C should be compiled

  3. Program A and Program C should be compiled

  4. Program B will have to be relinked with Program C


Correct Option: D
  1. It must be opened in INPUT mode

  2. It must be opened in OUTPUT mode

  3. It must be opened in I-O mode

  4. As in the case of SORT statement, the file must be closed before the use of this statement


Correct Option: C

SORT RAFFLES_FILE ON ASCENDING KEY IBM-MAIN Y2K-MAINUSING INPUT-FILE GIVING OUTPUT-FILE.Which one the following is true?

  1. The sorted file will contain all Raffles records in ascending order of Y2K-MAIN.

  2. IBM-MAIN is the major key and Y2K-MAIN is the minor key

  3. The statement is wrong as there should be only one key since the clause ascending key appears only once.

  4. Both INPUT-FILE and OUTPUT-FILE must be described in the DATA DIVISION with SD entries.


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) The sorted file will contain all Raffles records in ascending order of Y2K-MAIN. This option is incorrect. The SORT statement in the question specifies that the file should be sorted in ascending order of the key "IBM-MAIN," not "Y2K-MAIN."

Option B) IBM-MAIN is the major key and Y2K-MAIN is the minor key. This option is correct. In the SORT statement, "IBM-MAIN" is specified as the ascending key, which means it is the major key. "Y2K-MAIN" is not mentioned in the ascending key clause, so it is the minor key.

Option C) The statement is wrong as there should be only one key since the clause ascending key appears only once. This option is incorrect. It is possible to have multiple ascending keys in a SORT statement. In this case, "IBM-MAIN" is specified as the ascending key, and "Y2K-MAIN" is not mentioned in the ascending key clause.

Option D) Both INPUT-FILE and OUTPUT-FILE must be described in the DATA DIVISION with SD entries. This option is incorrect. The INPUT-FILE and OUTPUT-FILE mentioned in the SORT statement are not required to be described in the DATA DIVISION with SD entries. The SORT statement is used to sort data from the input file and write the sorted data to the output file, but it does not require explicit description in the DATA DIVISION.

The correct answer is B) IBM-MAIN is the major key and Y2K-MAIN is the minor key. This option is correct because the SORT statement specifies "IBM-MAIN" as the ascending key, making it the major key, and "Y2K-MAIN" is not mentioned in the ascending key clause, making it the minor key.

About the MERGE verb,which one of the following is true?

  1. Can merge a maximum of three files.

  2. Does not require that the input file to be merged be sorted on the merge keys.

  3. Requires that all files mentioned in the statement must have records of same size

  4. Does not require that the position of the merge keys with in the records descriptions of each of the files must be same.


Correct Option: C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Can merge a maximum of three files. - This option is incorrect. The MERGE verb in most programming languages does not have a maximum limit on the number of files that can be merged. It can merge any number of files as long as the system resources allow it.

Option B) Does not require that the input file to be merged be sorted on the merge keys. - This option is incorrect. The MERGE verb typically requires that the input files to be merged are sorted on the merge keys. This ensures that the merging process can efficiently compare and merge the records based on the specified keys.

Option C) Requires that all files mentioned in the statement must have records of the same size. - This option is correct. The MERGE verb usually requires that all the files mentioned in the statement must have records of the same size. This is because the merging process relies on aligning and comparing records at corresponding positions, and having different record sizes would lead to alignment issues and incorrect merging.

Option D) Does not require that the position of the merge keys within the record descriptions of each of the files must be the same. - This option is incorrect. The MERGE verb typically requires that the position of the merge keys within the record descriptions of each file must be the same. This allows the merging process to correctly identify and compare the merge keys in each record.

The correct answer is C) Requires that all files mentioned in the statement must have records of the same size. This option is correct because the MERGE verb requires the input files to have records of the same size for proper merging.

- Hide questions