183k views
4 votes
Use the following to answer the following set of questions:

{
public static void main (Sting[] args)
{
("Here");
.printIn("There" + "Everywhere");
.pintIn("But not" + "in my class");
}
}
Q1) The program will print the work "Here" and then print?
A) "There Everywhere" on the line after "Here"
B) "There" on the line after "Here" and "Everywhere" on the line after "There"
C) "There Everywhere" on the same line as "Here"
D) "ThereEverywhere" on the same line as "Here"
Q2)The final printIn command will output
A) "But not in my class"
B) "But notin my class"
C) "But not" on one line and "in my class" on the next line
D) "But not+in my class"
Q3) How many lines of output are provided by this program?
A) 1
B) 4
C) 3
D) 2

1 Answer

2 votes

Final answer:

The program will correctly print 'There Everywhere' on a new line after 'Here', 'But not in my class' on another new line, and in total, there will be three lines of output.

Step-by-step explanation:

The code snippet provided contains a few syntax errors, and assuming the question ignores these errors, the correct answers are:

  1. The program will print "Here" and then on the line after "Here", it will print "There Everywhere". So, the answer is A) "There Everywhere" on the line after "Here".
  2. The final printIn (corrected from 'pintIn') command will output "But not in my class", therefore the answer is A) "But not in my class".
  3. In total, the program provides three lines of output if we assume the syntax errors such as 'Sting' instead of 'String' and 'printIn' instead of 'System.out.println' are ignored. Therefore, the answer is C) 3.
User Muthukrishnan
by
8.5k points