Write test cases for this below code? class Product { private String name; private double price; public Product(String name, double price) { this.name = name; this.price = price; } public String getName() { return name; } public double getPrice() { return price; } } class ShoppingCart { private List items; public ShoppingCart() { items = new ArrayList<>(); } public void addItem(Product product) { items.add(product); } public List getItems() { return items; } public double calculateTotal() { double total = 0; for (Product item : items) { total += item.getPrice(); } return total; } } class DiscountManager { public double applyDiscount(ShoppingCart cart, double discountRate) { double total = cart.calculateTotal(); return total * (1 - discountRate); } } public class Main { public static void main(String[] args) { Product product1 = new Product("Laptop", 1000); Product product2 = new Product("Mouse", 20); ShoppingCart cart = new ShoppingCart(); cart.addItem(product1); cart.addItem(product2); DiscountManager discountManager = new DiscountManager(); double discountedPrice = discountManager.applyDiscount(cart, 0.1); System.out.println("Discounted price: " + discountedPrice); } }
Senior Software Quality Engineer Interview Questions
537 senior software quality engineer interview questions shared by candidates
What is Transient keyword in Java?
3. Write a program to print the pascal triangle.
Questions ranged from test planning, types of testing, how would I test Amazon website, use cases to basic programming questions on Java and Selenium. Made me write code on an online IDE for Java. Most of the questions were related to my previous experiences and how would I approach a use case for testing. Were interested to understand the types of testing like Security testing, accessibility testing, localization testing and functional testing and their use cases Questions on Java: (Strings) - How to find if a string is a palindrome - Find all substrings of a given string - Find the longest palindrome of a given string - Difference between Assert and Verify - Most common exceptions - How do you pass control to a different page in POM - How do you find elements when IDs are dynamic - How do you handle alerts in selenium
Describe why I wanted a job in QA
How to take the screenshot in selenium?
What are the pros and cons of protractor?
What is "is-a" & "has-a" relationship in java?
About urself, Your skill set
Bla Bla about Dev related stuff, Full Hindi Casual Talk.
Viewing 171 - 180 interview questions