SpringBoot – Multiple Choice Questions and Answers – MCQ1

HOME








@Bean 
public MyService myService() {     
  return new MyServiceImpl(); 
}



@RestController
public class ArticleController {
    @GetMapping("/articles")
    public List<Article> getAllArticles() {
        return articleService.findAll();
    }
}

@Value("${my.api.key}")
private String apiKey;

@Bean
@Scope("prototype")
public Article article() {
    return new Article();
}



@Profile("dev")
@Bean
public DataSource dataSource() {
    return new H2DataSource();
}




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





Docker – Advance Level – Multiple Choice Questions and Answers – MCQ1

HOME

























Docker – Basic Level – Multiple Choice Questions and Answers – MCQ1

HOME

























JUnit – Multiple Choice Questions and Answers – MCQ1

HOME

























PyTest Multiple Choice Questions – MCQ2

HOME

























GitHub – Multiple Choice Questions and Answers – MCQ1

HOME

























Robot Framework – Multiple Choice Questions and Answers – MCQ2

HOME

























Pytest Multiple Choice Questions – MCQ1

HOME

















a) @Pytest.xfail
b) @Pytest.mark.xfail
c) @Pytest.expected_failure
d) @Pytest.mark.expected_failure

a) @skip
b) @pytest.mark.skip
c) @pytest.ignore
d) @skipTest

a) @Pytest.skipif
b) @Pytest.mark.skip
c) @Pytest.mark.skipif
d) @Pytest.skip


a) Pytest -m “marker”
b) Pytest -k “expression”
c) Pytest –collect-only
d) Pytest –last-failed

a) pytest --tag=name
b) pytest -k name
c) pytest --only-mark=name
d) pytest -m name



Robot Framework Multiple Choice Questions – MCQ1

HOME

























Advance Selenium Multiple Choice Questions – MCQ2

HOME








WebDriver driver = new ChromeDriver();
driver.get("https://www.example.com");
WebElement element = driver.findElement(By.id("submitButton"));
element.click();

WebDriver driver = new ChromeDriver();
driver.get("https://www.example.com");
List<WebElement> links = driver.findElements(By.tagName("a"));
System.out.println("Number of links: " + links.size());

WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("elementId")));

driver.switchTo().___.accept();

WebElement dropdown = driver.findElement(By.id("dropdown"));
Select select = new Select(dropdown);
select.___("Option 1");

Actions actions = new Actions(driver);
WebElement element = driver.findElement(By.id("elementId"));
actions.contextClick(element).perform();

File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshot, new File("path/to/screenshot.png"));

driver.switchTo().___("frameNameOrId");

WebElement inputField = driver.findElement(By.id("inputField"));
inputField.sendKeys("test data");
inputField.sendKeys(Keys.TAB);

driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

WebElement table = driver.findElement(By.id("tableId"));
List<WebElement> rows = table.findElements(By.tagName("tr"));
WebElement firstCell = rows.get(0).findElements(By.tagName("td")).get(0);
System.out.println(firstCell.getText());

driver.manage().___();

Cookie cookie = new Cookie("name", "value");
driver.manage().___(cookie);

Select dropdown = new Select(driver.findElement(By.id("dropdownId")));
List<WebElement> options = dropdown.___();


try {
    WebElement element = driver.findElement(By.id("submit"));
    element.click();
} catch (NoSuchElementException e) {
    System.out.println("Element not found.");
}