
3CSE2 Lab Day-7
Authored by Sharfuddin Mohammed
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
GK Quiz
Quiz
•
University
10 questions
Lists
Quiz
•
University
10 questions
Files and Directories
Quiz
•
University
14 questions
DSC119_Chap 2: Data Preparation Methodology and Interface Design
Quiz
•
University
10 questions
Java Script. Parte 1.
Quiz
•
University
10 questions
PYTHON BASICS PART 1
Quiz
•
University
11 questions
Recap Chapter 6, 7, 8
Quiz
•
University
10 questions
Quiz - CSE
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
29 questions
Alg. 1 Section 5.1 Coordinate Plane
Quiz
•
9th Grade
22 questions
fractions
Quiz
•
3rd Grade
11 questions
FOREST Effective communication
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
7 questions
Fragments, Run-ons, and Complete Sentences
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
10 questions
DNA Structure and Replication: Crash Course Biology
Interactive video
•
11th Grade - University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
5 questions
Examining Theme
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University