Explore topic-wise MCQs in Arrays .

This section includes 7 Mcqs, each offering curated multiple-choice questions to sharpen your Arrays knowledge and support exam preparation. Choose a topic below to get started.

1.

If s1 and s2 are references to two strings then which of the following are the correct ways to find whether the contents of the two strings are equal?

A. 1, 2
B. 2, 3
C. 4, 5
D. 3, 5
Answer» C. 4, 5
2.

Which of the following is the correct way to find out the index of the second 's' in the string "She sells sea shells on the sea-shore" ?

A. String str = "She sells sea shells on the sea-shore" ; int i; i = str.SecondIndexOf( "s" );
B. String str = "She sells sea shells on the sea-shore" ; int i, j; i = str.FirstIndexOf( "s" ); j = str.IndexOf( "s" , i + 1 );
C. String str = "She sells sea shells on the sea-shore" ; int i, j; i = str.IndexOf( "s" ); j = str.IndexOf( "s" , i + 1 );
D. String str = "She sells sea shells on the sea-shore" ; int i, j; i = str.LastIndexOf( "s" ); j = str.IndexOf( "s" , i - 1 );
Answer» D. String str = "She sells sea shells on the sea-shore" ; int i, j; i = str.LastIndexOf( "s" ); j = str.IndexOf( "s" , i - 1 );
3.

Which of the following statements are correct about the String Class in C#.NET?

A. 1, 2, 5
B. 2, 4
C. 1, 3, 4
D. 3, 5
Answer» D. 3, 5
4.

Which of the following is correct way to convert a String to an int ?

A. 1, 3, 5
B. 2, 4
C. 3, 5
D. 2, 3, 4
Answer» E.
5.

Which of the following snippets are the correct way to convert a Single into a String ?

A. 1, 2
B. 2, 3
C. 1, 3, 5
D. 2, 4
Answer» C. 1, 3, 5
6.

Which of the following statements are true about the C#.NET code snippet given below?

A. 1, 2, 4
B. 2, 3, 5
C. 3, 4
D. 2, 5
Answer» C. 3, 4
7.

How will you print on the screen?

A. printf(" ");
B. echo "\n";
C. printf(' ');
D. printf("\n");
Answer» E.