Tag: programming languages

Questions Related to programming languages

What is the maximum number of DD stmt a step can have?

  1. 100

  2. 15

  3. 300

  4. 255


Correct Option: D
  1. DISP=NEW,CATLG,CATLG

  2. DISP=OLD,DELETE,CATLG

  3. DISP=NEW,CATLG,DELETE

  4. DISP=OLD,CATLG,CATLG


Correct Option: A

What gets printed when the following program is compiled and run. Select the one correct answer. class test { public static void main(String args[]) { int i,j,k,l=0; k = l++; j = ++k; i = j++; System.out.println(i); } }

  1. 0

  2. 1

  3. 2

  4. 3


Correct Option: B

AI Explanation

To answer this question, let's go through each line of code and track the values of the variables:

  • int i,j,k,l=0;: This line declares four variables i, j, k, and l. l is initialized to 0.
  • k = l++;: The value of l is assigned to k first, and then l is incremented by 1. So, k becomes 0, and l becomes 1.
  • j = ++k;: k is incremented by 1 first, and then the value of k is assigned to j. So, k becomes 1, and j becomes 1.
  • i = j++;: The value of j is assigned to i first, and then j is incremented by 1. So, i becomes 1, and j becomes 2.
  • System.out.println(i);: The value of i is printed, which is 1.

Therefore, the correct answer is B) 1.

Which of the following are Java modifiers?

  1. public

  2. private

  3. friendly

  4. transient


Correct Option: A,B,D

AI Explanation

To answer this question, you need to understand Java modifiers.

Java modifiers are keywords that are used to specify the properties or characteristics of classes, methods, variables, and other program elements. They are used to control the visibility, accessibility, and behavior of these elements.

Let's go through each option to understand why it is correct or incorrect:

Option A) public - This option is correct. The "public" modifier is used to specify that a class, method, or variable is accessible to all other classes and code in the program.

Option B) private - This option is correct. The "private" modifier is used to specify that a class, method, or variable is only accessible within the same class.

Option C) friendly - This option is incorrect. There is no "friendly" modifier in Java. It seems like a typo or a misconception.

Option D) transient - This option is correct. The "transient" modifier is used to specify that a variable should not be serialized when an object is serialized.

The correct answer is A, B, and D. These options are correct because they are valid Java modifiers.

  1. to get to access hardware that Java does not know about

  2. to define a new data type such as an unsigned integer

  3. to write optimised code for performance in a language such as C/C++

  4. to overcome the limitation of the private scope of the method


Correct Option: A,C