Playwright Java – Basic Level – Multiple Choice Questions and Answers – Locators & Actions

HOME


a) page.findButton("Login")

b) page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Login"))

c) page.locateButton("Login")

d) page.getButton("Login")

a)  page.getByText("Welcome")

b) page.getByVisible("Welcome")

c) page.findText("Welcome")

d) page.textLocator("Welcome")


a)  page.getByLabel("Username")

b) page.getByInput("Username")

c) page.findByLabel("Username")

d) page.locatorLabel("Username")

a) page.getByHint("Enter email")

b) page.getByPlaceholder("Enter email")

c) page.getByInputText("Enter email")

d) page.findPlaceholder("Enter email")





a) page.getByRole(
    AriaRole.BUTTON,
    new Page.GetByRoleOptions()
        .setName("Save")
        .setExact(true)
);
b) page.getByRole(AriaRole.BUTTON)
    .exact("Save");
c) page.locator("button")
    .setExactText("Save");
d) page.getByText("Save")
    .setRole(AriaRole.BUTTON);

a) locator.search()

b) locator.where()

c) locator.filter()

d) locator.refine()

a) page.locatorById()

b) page.findTestId()

c) page.getByTestId()

d) page.testId()


<div class="user">
    <span class="name">John</span>
    <button>Edit</button>
</div>
a) page.locator(".user").locator("button").click();

b) page.locator(".user button").click();

a) page.getByRole(AriaRole.LISTITEM)
    .filter(new Locator.FilterOptions()
        .setHas(
            page.getByRole(
                AriaRole.HEADING,
                new Page.GetByRoleOptions().setName("Product 2")
            )
        ));
b) page.getByRole(AriaRole.LISTITEM)
    .getParent("Product 2");
c) page.getByText("Product 2")
    .parent();
d) page.locator("Product 2")
    .closest("listitem");

a) page.getByRole(AriaRole.BUTTON)
    .or(page.getByTitle("Subscribe"));
b) page.getByRole(AriaRole.BUTTON)
    .and(page.getByTitle("Subscribe"));
c) page.getByRole(AriaRole.BUTTON)
    .filter("Subscribe");
d) page.getByTitle("Subscribe")
    .contains(AriaRole.BUTTON);






a) selectOption("Java", "Python");

b) selectOptions("Java", "Python");

c) selectOption(new String[]{"java", "python"});

d) multiSelect("java", "python");


Playwright Java – Basic Level – Multiple Choice Questions and Answers – MCQ1

HOME

























DW Testing – Basic Level – Multiple Choice Questions and Answers – MCQ1

HOME





















CI/CD – Advance Level – Multiple Choice Questions and Answers – MCQ1

HOME





















CI/CD – Intermediate Level – Multiple Choice Questions and Answers – MCQ1

HOME





















CI/CD – Basic Level – Multiple Choice Questions and Answers – MCQ1

HOME





















Test Your Knowledge: 25 SQL Subquery Questions

HOME




SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);
   




SELECT * FROM employees WHERE department_id = (SELECT department_id FROM departments WHERE name = 'Sales');



a) SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);
b) SELECT * FROM employees e WHERE salary > (SELECT AVG(salary) FROM employees WHERE department_id = e.department_id);
c) SELECT * FROM employees WHERE salary IN (SELECT salary FROM employees);
d) SELECT * FROM employees WHERE id IN (SELECT id FROM departments);



SELECT * FROM employees 
   WHERE salary BETWEEN (SELECT max(salary) FROM employees WHERE department_id = 100) AND 
  (SELECT min(salary) FROM employees WHERE department_id = 100);

SELECT department_id FROM departments WHERE department_id = (SELECT MAX(department_id) FROM departments);

a)  UPDATE employees SET salary = salary * 1.1 WHERE department_id = (SELECT department_id FROM departments);
b)	 UPDATE employees SET salary = salary * 1.1 WHERE department_id = (SELECT department_id FROM departments WHERE name = 'HR');
c)  UPDATE employees USING (SELECT department_id FROM departments WHERE name = 'HR');
d)  UPDATE employees SET salary = 1.1 * (SELECT salary FROM employees);

DELETE FROM employees WHERE manager_id IN (SELECT employee_id FROM employees WHERE department_id = 3);

SELECT first_name, last_name, salary FROM employees WHERE salary ANY 
(SELECT salary FROM employees);


a) SELECT * FROM (SELECT column1 FROM table1) AS subquery;
b) SELECT * FROM table1 WHERE column1 = (SELECT column2 FROM table2);
c) SELECT * FROM table1 INNER JOIN (SELECT column2 FROM table2) AS subquery;
d) SELECT column1 FROM table1 WHERE column2 = (SELECT column2 FROM table2) AND column3 = (SELECT column3 FROM table3);

SELECT first_name, last_name FROM employees WHERE emp_id  NOT IN 
(SELECT manager_id, hire_date FROM employees WHERE manager_id IS NOT NULL);





SQL Multiple Choice Questions & Answers – JOINS

HOME


SELECT products.product_name, orders.order_date
FROM products
INNER JOIN orders ON products.product_id = orders.product_id;


SELECT students.student_name, grades.grade
FROM students
__________ JOIN grades ON students.student_id = grades.student_id;
   


SELECT a.name, b.address
FROM customers a
FULL OUTER JOIN orders b ON a.customer_id = b.customer_id;


SELECT e.employee_id, e.name, d.department_name
FROM employees e
CROSS JOIN departments d;











What will be the result of inner join between these tables?



a) Select * FROM Table1 T1 CROSS JOIN Table1 T2;
b) Select * FROM Table1 T1 ALL CROSS JOIN Table1 T2;
c) Select * FROM Table1 T1,Table1 T2;
d) Select * FROM Table1 T1 CROSS Table1 T2;



SELECT * FROM students NATURAL JOIN enrollments;

SpringBoot – Multiple Choice Questions and Answers – MCQ2

HOME


@ConfigurationProperties(prefix = "app")
public class AppConfig {
      private String name;
      private String version;
     // Getters and setters
}


@Service
public class ArticleService {
    @Autowired
    private ArticleRepository articleRepository;
}


@RestController
public class MyController {

    @GetMapping("/hello")
    public String hello() {
        return "Hello, World!";
    }
}
@Controller
@RequestMapping("/api")
public class MyController {

    @GetMapping("/hello")
    public String hello() {
        return "Hello, World!";
    }
}
@RestController
@RequestMapping("/api")
public class MyController {

    @RequestMapping("/hello")
    public String hello() {
        return "Hello, World!";
    }
}
@Controller
public class MyController {

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    @ResponseBody
    public String hello() {
        return "Hello, World!";
    }
}

@Configuration
public class MyApp {
    public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
    }
}
@SpringBootApplication
public class MyApp {
    public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
    }
}
@RestController
public class MyApp {
    public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
    }
}
@Component
public class MyApp {
    public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
    }
}

@Cacheable("articles")
public Article getArticleById(Long id) {
    return articleRepository.findById(id).orElse(null);
}



@PostMapping("/articles")
public ResponseEntity<Article> createArticle(@RequestBody Article article) {
    // Save article logic
    return ResponseEntity.status(HttpStatus.CREATED).body(savedArticle);
}




@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .csrf().disable()
            .authorizeRequests()
                .antMatchers("/api/**").hasRole("ADMIN")
                .anyRequest().permitAll()
                .and()
            .httpBasic();
    }
}
@SpringBootApplication
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers("/api/**").authenticated()
                .anyRequest().permitAll()
                .and()
            .httpBasic();
    }
}
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers("/api/**").authenticated()
                .anyRequest().permitAll()
                .and()
            .httpBasic()
                .and()
            .csrf().disable();
  
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .antMatchers("/api/**").permitAll()
                .anyRequest().authenticated()
                .and()
            .httpBasic();
    }
}

@Bean
@ConditionalOnProperty(name = "app.feature.enabled", havingValue = "true")
public MyFeature myFeature() {
    return new MyFeature();
}




@Scheduled(fixedRate = 2000)
public void reportCurrentTime() {
    System.out.println("Current time: " + new Date());
}





Performance Testing – Multiple Choice Questions and Answers – MCQ1

HOME