InfyTQ Arrays and String Quiz 1

Question 1

Time: 00:00:00
 What is the length of the following array: byte[] data = { 12, 34, 9, 0, -62, 88 };

1

1

5

5

6

6

12

12

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Which of these class is   superclass of String and StringBuffer class?

 java.util

 java.util

ArrayList

ArrayList

java.lang

java.lang

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
  What is the output of the following code fragment:

  int[] arr = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 }

    for ( int index= 0 ; index < 5 ; index++  )

      System.out.print(  arr[ index ] + "  "  );

2 4 6 8

2 4 6 8

 2 4 6 8 10

 2 4 6 8 10

 2 4 6 8 10 1

 2 4 6 8 10 1

 2 4 6 8 10 1 3 5 7 9

 2 4 6 8 10 1 3 5 7 9

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What is the output of the following code fragment:

   int[] arr = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };

    for ( int index= 0 ; index < egArray.length ; index++  )

      System.out.print(  arr[ index ] + "  "  );

 2 4 6 8

 2 4 6 8

2 4 6 8 10

2 4 6 8 10

 2 4 6 8 10 1

 2 4 6 8 10 1

  2 4 6 8 10 1 3 5 7 9

  2 4 6 8 10 1 3 5 7 9

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
 Which of these operators can be used to concatenate two or more String objects?

+

+

+=

+=

&

&

||

||

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Which of these method of class String is used to extract a single character from a String object?

CHARAT()

CHARAT()

charat()

charat()

charAt()

charAt()

ChatAt()

ChatAt()

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Which of these constructors is used to create an empty String object?

string()

string()

String(void)

String(void)

 String(0)

 String(0)

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What is the output of the following code fragment:

   
int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };
   for ( int index= 0 ; index < egArray.length ; index = index + 2  )
      System.out.print(  egArray[ index ] + "  "  );

2 4 6 8 10 1 3 5 7 9

2 4 6 8 10 1 3 5 7 9

4 8 1 5 9

4 8 1 5 9

2 6 10 3 7

2 6 10 3 7

2 6 10 3 7 0

2 6 10 3 7 0

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
 Does a programmer always know how long an array will be when the program is being written?

Yes---the program will not compile without the length being declared.

Yes---the program will not compile without the length being declared.

No---the array object is created when the program is running, and the length might change from run to run.

No---the array object is created when the program is running, and the length might change from run to run.

Yes---otherwise the program will not run correctly.

Yes---otherwise the program will not run correctly.

 No---arrays can grow to whatever length is needed.

 No---arrays can grow to whatever length is needed.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Fill in the blanks of the following code fragment so that the elements of the array are printed in reverse order starting with the last element.

 int[] egArray = { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 };

    for ( int index= ________ ; _____________ ; ______________ )

      System.out.print(  egArray[ index ] + "  "  );

index = 0; index < egArray.length; index--

index = 0; index < egArray.length; index--

 index = length; index < 0; index--

 index = length; index < 0; index--

 index = egArray.length-1; index >= 0; index--

 index = egArray.length-1; index >= 0; index--

index = length-1; index > 0; index--

index = length-1; index > 0; index--

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects