Sie sind auf Seite 1von 4

ET Campus Coding Stars powered by BridgeLabz

Sample Test

You must complete the test within 15 minutes, so make sure you avoid all sorts of distractions!

Directions:
1. The timer will start ticking once you click 'Start' button. Once time run out, the test will
automatically end.
2. You can toggle between questions using 'Previous' and 'Next' button options.
3. You can end the test any time by clicking 'End Test' button and see results.
4. Avoid refreshing the page or using browser 'back/forward' option you will run out of time.
5. Once you complete the test, you will receive a score which will help you predict how well you
performed.

Questions:
1. What is the output of this program?
public class output {
public static void main(String args[]) {
StringBuffer c = new StringBuffer("Hello");
StringBuffer c1 = new StringBuffer("World");
c.append(c1);
System.out.println(c);
}
}

a. Hello
b. World
c. HelloWorld
d. Hello World
2. Which of these methods of class StringBuffer is used to extract a substring from a String
object?
a. substring()
b. Substring()
c. SubString()
d. None of the mentioned

3. Class String in java is immutable.


a. True
b. False

4. A process that involves recognizing and focusing on the important characteristics of a


situation or object is known as:
a. Encapsulation
b. Polymorphism
c. Abstraction
d. Inheritance

5. In object-oriented programming, new classes can be defined by extending existing classes.


This is an example of:
a. Encapsulation
b. Composition
c. Inheritance
d. Aggregation.

6. What is garbage collection in the context of Java?

a. The operating system periodically deletes all of the java files available on the system.
b. Any package imported in a program and not used is automatically deleted.
c. When all references to an object are gone, the memory used by the object is automatically
reclaimed.
d. The JVM checks the output of any Java program and deletes anything that doesn’t make sense.
e. When all references to an object are gone the memory used by the object is not reclaimed.
7. A package is a collection of

a. Classes
b. Interfaces
c. Editing tools
d. Classes and interfaces
e. Editing tools and interfaces.

8. URL stands for


a. Universal reader locator
b. Universal reform loader
c. Uniform resource loader
d. Uniform resource locator
e. Uniform reader locator.

9. Given a class named Book, which one of these is a valid constructor declaration for the class?
a. Book(Book b) { }
b. Book Book() { }
c. private final Book() { }
d. void Book() { }
e. abstract Book() { }

10. Which one of the following class definitions is a valid definition of a class that cannot be
extended?

a. class Link { }
b. abstract class Link { }
c. native class Link { }
d. static class Link { }
e. final class Link { }.
Answer:
1. HelloWorld
2. substring()
3. True
4. Abstraction
5. Inheritance
6. When all references to an object are gone, the memory used by the object is automatically
reclaimed.
7. Classes and interfaces
8. Uniform resource locator
9. Book(Book b) { }
10. final class Link { }.

Das könnte Ihnen auch gefallen