Question#1 Which of the following correctly defines a timeout test in TestNG?
a) The time duration for a test to complete execution
b) The time duration for a test suite to complete execution
c) The time duration for a test group to complete execution
d) None of the options
Answer is :- The time duration for a test to complete execution
Question#2 The TestNG framework enables to generate test reports in both HTML and XML formats.
a) True
b) False
Answer is :- True
Question#3 TestNG has a more elegant way of handling parameterized tests, by using the data-provider concept.
a) True
b) False
Answer is :- True
Question#4 Using @DataProvider annotation, the same test method can be run multiple times with different datasets.
a) True
b) False
Answer is :- True
Question#5 Which of the following is not a valid TestNG annotation?
a) @DataSource
b) @BeforeSuite
c) @DataProvider
d) @AfterSuite
Answer is :- @DataSource
Question#6 Which of these is not a valid setUp / tearDown level in the TestNG framework?
a) @Before/AfterClass
b) @Before/AfterSuite
c) @Before/AfterTest
d) @Before/AfterGroup
e) All the above
Answer is :- All the above
Question#7 What is the correct TestNG annotation for a timeout test?
a) @Test(sleep = 5000)
b) @test(sleep = 5000)
c) @Test(TimeOut = 5000)
d) @Test(timeOut = 5000)
Answer is :- @Test(timeOut = 5000)
Question#8 What is the correct method to exclude a test in TestNG?
a) Using @Test(enabled = false) annotation
b) Using @Test(exclude = true) annotation
c) Using @Test(include = false) annotation
d) None of the options
Answer is :- Using @Test(enabled = false) annotation
Question#9 Which of the following is false in the context of a TestNG framework?
a) TestNG permits to define dependent test cases. Each test case is independent of other test cases
b) TestNG need not extend any class, while JUnit must
c) The @DataProvider annotation accepts single string attributes, and returns an array of objects
d) None of the options
Answer is :- None of the options
Question#10 What is the method used to select a value from Listbox?
a) selectByVisibleText(String)
b) selectByIndex(int)
c) selectByValue(String)
d) All the options
Answer is :- All the options
Question#11 Which of the following is not a ‘wait’ command?
a) waitForTitle
b) waitForAlert
c) waitForActive
d) waitForTextPresent
Answer is :- waitForActive
Question#12 @test, @Beforeclass, @Afterclass, @Beforemethod, @Aftermethod are basic annotations in TestNG.
a) True
b) False
Answer is :- False
Question#13 A Hybrid Framework must contain all Selenium concepts.
a) True
b) False
Answer is :- False
Question#14 ResultSet helps to store data retrieved from a database.
a) True
b) False
Answer is :- True
Question#15 A JDBC connection helps to connect with a database.
a) True
b) False
Answer is :- True
Question#16 Which of the following is not unidirectional?
a) select
b) update
c) Insert
d) delete
Answer is :- select
Question#17 What is the method used to change focus from a frame/iframe/window/alert?
a) changeFocus()
b) setFocus()
c) switchTo()
d) redirectTo()
Answer is :- switchTo()
Question#18 Data-driven testing can be implemented by using which of the following?
a) EXCEL
b) JSON
c) JSON
d) All the options
Answer is :- All the options
Question#19 Table-driven testing is also known as?
a) Data-driven Testing Framework
b) Keyword-driven Testing
c) Hybrid Testing Framework
d) Modular Testing Framework
Answer is :- Keyword-driven Testing
Question#20 Which of the following is the recommended method to handle dynamic elements?
a) Using CSS locators
b) Using regular expressionsU
c) Using relative Xpath locators
d) All the options
Answer is :- Using relative Xpath locators
Question#21 A BDD Framework can be used with Selenium.
a) True
b) False
Answer is :- True
Question#22 TestNG covers all testing categories, including unit, functional, end-to-end, integration, and so on.
a) True
b) False
Answer is :- True
Question#23 What does the getWindowHandle() method do?
a) Handles alerts
b) Gets the handle of the page the Webdriver is currently controlling
c) Helps to get the handle of the parent window
d) None of the options
Answer is :- Gets the handle of the page the Webdriver is currently controlling
Question#24 Which of the following is not a valid setUp/tearDown level in TestNG framework?
a) @Before/AfterGroup
b) @Before/AfterSuite
c) @Before/AfterTest
d) @Before/AfterClass
Answer is :- @Before/AfterClass
Question#25 What is the return type of the driver.getTitle() method in Selenium Webdriver?
a) void
b) character
c) null
d) string
Answer is :- string
Question#26 Which of the following features are not supported by TestNG?
a) Support for parameters
b) Support for powerful execution model
c) Support for dependent methods testing
d) None of the options
Answer is :- Support for powerful execution model
Question#27 Which of the following WebDriver is used for Headless browser testing?
a) InternetExplorerDriver
b) FireFoxDriver
c) HeadLessDriver
d) HtmlUnitWebDriver
Answer is :- HtmlUnitWebDriver
Question#28 Which Maven plugin creates a project structure?
a) execution
b) properties
c) archetype
d) dependency
Answer is :- archetype
Question#29 JUnits can be run as part of a Jenkins job.
a) True
b) False
Answer is :- True
Question#30 Hard Assert tests fail and stop executing the moment a failure occurs in the assertion.
a) True
b) False
Answer is :- True
Question#31 Parallel execution of Selenium test cases is possible in TestNG.
a) True
b) False
Answer is :- True
Question#32 How can we check if a check-box is selected or not?
a) driver.findElement(By.id(<>).isSelected()
b) driver.findElement(By.id(<>).isChecked()
c) driver.findElement(By.id(<>).Selected()
d) All the options
Answer is :- driver.findElement(By.id(<>).isSelected()
Question#33 What is contextClick() used for?
a) To left-click
b) To right-click
c) To click a hidden element
d) To open the pop-up menu
Answer is :- To right-click