
3CSE2 Lab Day-7

Quiz
•
Computers
•
University
•
Medium
Sharfuddin Mohammed
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary purpose of StringBuffer in Java?
The primary purpose of StringBuffer in Java is to provide a mutable sequence of characters for efficient string manipulation.
To create immutable strings in Java.
To store a fixed number of characters.
To provide a method for string comparison.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does StringBuilder improve performance over StringBuffer?
StringBuilder automatically manages memory allocation, unlike StringBuffer.
StringBuilder is synchronized, making it safer for multi-threaded environments.
StringBuilder improves performance over StringBuffer by being non-synchronized, reducing overhead in single-threaded environments.
StringBuilder uses more memory than StringBuffer, leading to slower performance.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method in StringTokenizer is used to check if there are more tokens?
getTokenCount
hasMoreTokens
nextToken
isTokenAvailable
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between StringBuffer and StringBuilder in terms of thread safety?
Both StringBuffer and StringBuilder are thread-safe.
StringBuffer is faster than StringBuilder.
StringBuffer is thread-safe; StringBuilder is not.
StringBuilder is thread-safe; StringBuffer is not.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you convert a StringTokenizer to an array of strings?
Convert the StringTokenizer to a List using Collections.list().
Use a loop to collect tokens into a List, then convert it to an array with list.toArray(new String[0]).
Use String.split() method directly on the string.
Call the toArray() method on the StringTokenizer instance.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What method would you use to append a string to a StringBuilder?
stringBuilder.insert("yourString");
stringBuilder.addString("yourString");
stringBuilder.concat("yourString");
stringBuilder.append("yourString");
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain how String manipulation can affect performance in Java applications.
String operations are faster than primitive data types.
String manipulation has no impact on performance.
String manipulation can lead to performance issues due to object creation overhead and memory usage.
Using StringBuilder always improves performance.
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Array Java

Quiz
•
University
15 questions
Bcom remedial question _ 15

Quiz
•
University
11 questions
The CPU

Quiz
•
KG - University
10 questions
Java Control Flow statements

Quiz
•
University
15 questions
Computer Science Quiz

Quiz
•
University
6 questions
Strings

Quiz
•
University
15 questions
Mastering Java Interfaces and Strings

Quiz
•
University
12 questions
javaquizvivek

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University