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)- A4% (1)
- B80% (20)
- C12% (3)
- D4% (1)
Community Discussion
No community discussion yet for this question.