Exam 1z0-808 All QuestionsBrowse all questions from this exam
Question 113

Given:

And given the commands:

What is the result?

    Correct Answer: A

    Given the code and the provided commands, the program will print 'Java SE'. This is because when the program is run with `java Test 1`, the length of the `args` array will be 1 because the command line argument '1' is passed to the program. Hence, `x` will be 1. The `checkLimit` method will be called with `x` equal to 1, and since `x` (1) is greater than or equal to `MIN` (1), the condition will evaluate to true, resulting in the output 'Java SE'.

Discussion
iSnoverOption: A

The right answer is the letter A, because in the command line passed the argument 1, that is, the String "1" is in the 0 place of the list with the indexing, but the list has size 1, so it is True printing " Java SE". If you take the raw code and play it in the IDE, it will print the letter B, but remembering that the args array is a list with no arguments and the argument "1" was passed to the console.

akbiyikOption: A

public class Test { public static final int MIN = 1; public static void main(String[] args) { int x = args.length; if (checkLimit(x)) { System.out.println("Java SE"); } else { System.out.println("Java EE"); } } private static boolean checkLimit(int x) { return (x >= MIN) ? true : false; } } Tested in compiler and command line https://www.programiz.com/java-programming/online-compiler/ java -cp /tmp/EB79LfiRf0 Test Java EE java -cp /tmp/EB79LfiRf0 Test 1 Java SE

amit_lad88Option: A

Java SE

fvelazqueznavaOption: A

Java SE

somrita90Option: A

Answer A

Sreeni_AOption: A

Answer : A

carlosworkOption: A

Answer is A. Args[ ] is receiving parameter from the command line. Therefore, its length will be greater than or equal to 1.