Testdome Java Questions And Answers
Bistone Software
>>> Home  |   Product  |   FAQ  |   Feedback  |   Buy Now  |   Download  |   About BistoneSoft
Download |  Buy Now |  PAD XML |  Product FAQ

Testdome Java Questions And Answers

import java.util.*;
import java.time.*;

// Step 1: Create an interface interface AlertDAO UUID addAlert(LocalDateTime time); LocalDateTime getAlert(UUID id);

// Step 2: Implement the interface class MapAlertDAO implements AlertDAO private final Map<UUID, LocalDateTime> alerts = new HashMap<>();

public UUID addAlert(LocalDateTime time) 
    UUID id = UUID.randomUUID();
    alerts.put(id, time);
    return id;
public LocalDateTime getAlert(UUID id) 
    return alerts.get(id);

// Step 3: Inject via constructor class AlertService private final AlertDAO storage; testdome java questions and answers

public AlertService(AlertDAO dao)  // Dependency injection
    this.storage = dao;
public UUID raiseAlert() 
    return storage.addAlert(LocalDateTime.now());
public LocalDateTime getAlertTime(UUID id) 
    return storage.getAlert(id);

The "Aha!" moment: TestDome's grader will run unit tests that mock AlertDAO. The original version fails because you cannot mock MapAlertDAO. The refactored version passes all hidden OOP tests. import java


Sample Question:
Write a thread-safe singleton DatabaseConnection class using double-checked locking.

Prompt: A TrainComposition is built by attaching and detaching wagons from the left and right sides. Implement attachWagonFromLeft, attachWagonFromRight, detachWagonFromLeft, and detachWagonFromRight.

This tests your knowledge of Deque (double-ended queue). Using an ArrayList here fails the performance test for 1 million operations. // Step 2: Implement the interface class MapAlertDAO

Prompt: Implement the uniqueNames method. Given two arrays of strings, return a sorted array containing all unique names.

This is the "Hello World" of TestDome Java. It tests collections, sorting, and null-awareness.

Task:
Write a method that returns true if a string is a palindrome (case-insensitive, ignoring non-alphanumeric characters).

Example:
"A man, a plan, a canal: Panama"true

Bistone Software
© 2004 - 2017 Bistone Software Ltd
E-mail: support@bistonesoft.com
BistoneSoft - Hotel Management Expert | Bistone HRS | Highest Performance to Price Ratio | Hotel Management | Reservation Management | BistoneSoft.com | Contact Us | Download