nerdexam
GIAC

GSSP-NET · Question #224

Maria works as a Software Developer for ABC Inc. She develops a Console application using Visual Studio .NET 2005. She writes the following code in the application: String st="Hello World"; int…

The correct answer is B. The application will compile successfully and display "ell" as the output. See the full explanation below for the reasoning.

Question

Maria works as a Software Developer for ABC Inc. She develops a Console application using Visual Studio .NET 2005. She writes the following code in the application:

String st="Hello World"; int MyBegin=1; int MyEnd=3; Console.WriteLine(st.Substring(MyBegin, MyEnd)); What will happen when she tries to compile and execute the application?

Options

  • AThe application will compile successfully and display "el" as the output.
  • BThe application will compile successfully and display "ell" as the output.
  • CA compile-time error will occur stating "No method matching substring(int, char) exists".
  • DThe application will compile successfully and display "Hel" as the output.

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    80% (20)
  • C
    12% (3)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full GSSP-NET Practice