Playwright *Vibium *Selenium Automation Testing

Welcome to Playwright Automation with Senthil!

Hi, I'm Senthil, an experienced Automation Testing Professional based in Chennai, passionate about helping others learn and grow in the world of test automation.

๐Ÿ“Œ On this channel, youโ€™ll find:

Step-by-step tutorials on the Playwright Automation Tool

Real-world use cases, tips, and best practices

Interview Q&A, MCQs, and hands-on practice scenarios

Shorts for quick learning & test insights

โœ… Donโ€™t forget to subscribe, like, and share this channel with your friends โ€” letโ€™s grow together in the automation journey!


Playwright *Vibium *Selenium Automation Testing

*** Company Playwright Automation Testing Interview Questions:

๐Ÿ”ต Playwright & Automation Basics

1. What is Playwright and why is it used?
2. What are the advantages of Playwright over Selenium?
3. What browsers are supported by Playwright?
4. What is `playwright.config.ts` and why is it important?
5. How do you launch a browser in Playwright?
6. What is the difference between `page.goto()` and `page.reload()`?
7. How do you take screenshots in Playwright?
8. How do you handle multiple pages or tabs in Playwright?
9. What is headless mode?
10. How do you run tests in headed mode?
11. How do you run tests in parallel?
12. What is the role of `beforeEach` and `afterEach` hooks?
13. How do you handle alerts, popups, and dialogs?
14. How do you wait for elements in Playwright?
15. How do you handle file upload and download?
16. What is test isolation in Playwright?
17. How do you capture screenshots on test failure?
18. How do you generate HTML reports in Playwright?
19. What is retry mechanism in Playwright?



๐Ÿ”ตAdvanced Playwright & Framework

1. Explain Playwright architecture.
2. What is Page Object Model (POM) in Playwright?
3. How do you handle dynamic elements in Playwright?
4. How do you manage test data in Playwright?
5. How do you execute tests in different environments (QA, Staging, Prod)?
6. How do you perform API testing using Playwright?
7. How do you validate API responses?
8. What is mocking in Playwright?
9. How do you intercept network requests?
10. How do you handle authentication in Playwright?
11. How do you handle iframe elements?
12. What is the use of fixtures in Playwright?
13. How do you run Playwright tests in CI/CD pipelines?
14. How do you integrate Playwright with GitHub Actions or Jenkins?
15. How do you generate test reports in Playwright?
16. How do you tag or group test cases?
17. How do you debug failing Playwright tests?

๐Ÿ”ต JavaScript / TypeScript

1. What is the difference between `var`, `let`, and `const`?
2. What are arrow functions?
3. What is async/await and why is it used?
4. What are promises?
5. What is the difference between `==` and `===`?
6. What is the spread operator?
7. What is a callback function?
8. What is exception handling in JavaScript?
9. What is the difference between synchronous and asynchronous code?

*** Company Playwright Automation Testing Interview Questions:
=====================================================

๐Ÿ”ต Playwright

1. What are the key components of Playwright architecture?
2. How does Playwright handle auto-waiting?
3. What is the difference between `page.locator()` and `page.getByRole()`?
4. How do you handle authentication using storage state?
5. What are browser contexts and why are they useful?
6. How does Playwright handle flaky tests?
7. What is the difference between `expect().toBeVisible()` and `waitForSelector()`?
8. How do you debug a failing Playwright test?
9. What is trace viewer and when do you use it?
10. How do you simulate mobile devices in Playwright?
11. How do you test file downloads?
12. How do you test file uploads?
13. How does Playwright support cross-browser testing?
14. How do you set viewport size in Playwright?
15. What is the purpose of `test.describe()`?

๐Ÿ”ตJavaScript / TypeScript for Automation

1. What is the difference between `map()`, `filter()`, and `reduce()`?
2. What is hoisting in JavaScript?
3. What is event bubbling and event capturing?
4. What is destructuring in JavaScript?
5. What is the difference between `null` and `undefined`?
6. What are higher-order functions?
7. How does async/await work internally?

*** Company Playwright Automation Testing Interview Questions:
=====================================================

1. How do you structure a scalable Playwright automation framework?
2. What is the role of fixtures in Playwright?
3. How do you manage test execution order?
4. How do you handle environment-based configurations?
5. How do you retry failed tests conditionally?
6. How do you validate API responses inside UI tests?
7. How do you test Shadow DOM elements?
8. How do you implement data-driven testing in Playwright?
9. How do you run Playwright tests?
10. How do you parallelize tests safely?
11. How do you generate and customize HTML reports?
12. How do you integrate Playwright with CI tool like GitHub Actions?
13. How do you use environment variables in Playwright?

*** Company Playwright Automation Testing Interview Questions:
=====================================================

1. Why did you choose Playwright over Selenium or Cypress for your automation strategy?
2. Explain Playwright architecture and how it interacts with browsers internally.
3. How do you design a scalable and maintainable Playwright automation framework from scratch?
4. How do you handle flaky tests in Playwright, especially in CI/CD pipelines?
5. Explain the role of Browser, BrowserContext, and Page with real project usage scenarios.
6. How do you manage parallel execution and shared test data in Playwright?
7. How do you automate and validate API requests and responses using Playwright?
8. How do you debug complex failures using Playwright Trace Viewer?
9. How do you integrate Playwright with CI/CD and optimize execution time?
10. Describe a real-time challenge you faced in Playwright automation and how you solved it.


*** Company Playwright Automation Testing Interview Questions:
=====================================================
1. What is Playwright, and how is it different from Selenium?
2. Explain Browser, BrowserContext, and Page in Playwright with a real example.
3. How do you locate elements in Playwright, and which locator strategy do you prefer?
4. How does auto-waiting work in Playwright, and how does it help reduce flaky tests?
5. How do you handle multiple tabs in Playwright?

Interview Question:
===============
const users = {
admin: { "user name": "adminUser", password: "admin123" },
user: { username: "normalUser", password: "user123" }
};

How do you access the admin username and password from this object in JavaScript?
-------------------------------------------------------------------------------------------------------------------
const config = {
browser: "chromium",
viewport: { width: 1280, height: 720 },
headless: true
};

How will you use object destructuring to extract browser, width, and height into separate variables?


-----------------------------------------------------------------------------------------------------------------
<button data-testid="submit-btn">Submit</button>

Which Playwright locator would you use for this element and why?
Show how you would click this button.
-----------------------------------------------------------------------------------------------------------------
<ul>
<li class="menu">Home</li>
<li class="menu">Products</li>
<li class="menu">Logout</li>
</ul>
Question:
How would you locate and click only the "Logout" option using Playwright?
-------------------------------------------------------------------------------------------------------------------
Given the user logs in as "admin"

How would you write the Playwright step definition for this step so that it can work for multiple user roles?

3 weeks ago (edited) | [YT] | 2

Playwright *Vibium *Selenium Automation Testing

API Interview Answers
==================

**1. REST API:**
Web service architecture; uses HTTP methods (GET, POST, PUT, DELETE); responses in JSON or XML.

**2. SOAP vs REST:**
SOAP: protocol, XML, strict. REST: architecture, JSON/XML, flexible, stateless.
Analogy: SOAP = registered letter; REST = text message.

**3. HTTP Request & Response:**
Request: Method, URL, Headers, Body.
Response: Status code, Headers, Body.

*4. Common HTTP Status Codes:**
100 informational, 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Internal Server Error.

**5. Automate API Testing in Java:**
Use **RestAssured + JUnit/TestNG**; validate status, headers, body, response time.

**6. API Authentication:**
Basic Auth, Bearer Token (OAuth2), API Key, custom headers; set with `.auth()` in RestAssured.

**7. Validate API Response:**
Check status, headers, response time, content type, and body using assertions or JSON schema validation.

**8. JSON & Validation:**
Lightweight key-value format; validate with `.body()` or `jsonPath()` in RestAssured.

**9. Query Parameters:**
Optional key-value pairs in URL: `/users?role=admin`.

**10. Path Parameters:**
Mandatory part of endpoint: `/users/{id}`.

**11. Serialization & Deserialization:**
Java โ†” JSON/XML conversion using Jackson or Gson.

*12. POST Request Example:**
`given().body(payload).when().post("/endpoint");`

**13. PUT vs PATCH:**
PUT: full resource replacement; PATCH: partial update.

**14. File Upload:**
`given().multiPart("file", new

File("path")).when().post("/upload").then().statusCode(200);`

**15. Nested JSON Handling:**
`response.jsonPath().getString("data[0].attributes.name");`

**16. Extract JSON Value:**
`String value = response.jsonPath().getString("data.id");`

**17. Logging Requests/Responses:**
`.log().all()` for request, `.then().log().all()` for response.

**18. CRUD Operations:**
Create = POST, Read = GET, Update = PUT/PATCH, Delete = DELETE.

**19. API Testing Approach:**
Follow **Happy Path (valid)**, **Sad Path (invalid)**, **Bad Path (malicious)**.

**20. Postman Usage:**
Manual validation, environment management; automate tests with RestAssured + Jackson.

**21. Authentication vs Authorization:**
Auth = verify identity; Authorization = control access.
Test both with valid/invalid credentials and role-based access.

**22. HTTP vs HTTPS:**
HTTP = plain text; HTTPS = encrypted (SSL/TLS).
Always check `https://` and padlock icon.

**23. Client-Server Interaction:**
Client sends request; server processes & responds; verify both sides in testing.

**24. Verify HTTPS for Forms:**
Manual: check URL and padlock.
Automation: `assertTrue(driver.getCurrentUrl().startsWith("https://"));`

**25. First Check in API Testing:**
Start with **status codes**; then validate response body & headers.

**26. Testing New Endpoint:**
Validate **Happy Path** (valid), **Sad Path** (invalid), **Bad Path** (malicious inputs).

**27. Object Mapper:**
Converts JSON/XML โ†” Java objects. Example:
`Person p = objectMapper.readValue(json, Person.class);`

28. Jackson vs Gson:
Jackson: faster, more features, enterprise.
Gson: simpler, prototyping.

29. Map JSON field to Java:
`@JsonProperty("user_name") private String username;`

**30. Ignore Null / Unknown Fields:**
`@JsonInclude(Include.NON_NULL)`
`@JsonIgnoreProperties(ignoreUnknown=true)`

**31. Format Date in JSON:**
`@JsonFormat(pattern="yyyy-MM-dd")` or `objectMapper.setDateFormat(...)`

**32. Handle JSON Mismatch:**
Catch `JsonProcessingException`; use `@JsonIgnoreProperties` to skip unexpected fields.


**33. Optimize ObjectMapper:**
Reuse a single static ObjectMapper instance; preconfigure to ignore unknowns.

**34. API Security Testing:**
Test auth, authorization, token expiry, role-based access, invalid/malicious inputs.

**35. Response Time / Performance Check:**
Ensure API response time is acceptable (< 2s or SLA limit).

**36. Headers Validation:**
Check Content-Type, Authorization, Caching, Cookies, Rate-limit headers.

**37. Negative Testing:**
Invalid payloads, missing fields, SQL injection, XSS testing.

**38. Environment Management:**
Different base URLs, credentials, or tokens for dev/staging/prod.

**39. API Chaining / Dynamic Data:**
Capture values (ID/token) from one request โ†’ use in next request.

**40. Best Practices:**
* Reusable methods for requests
* Validate both schema & values
* Handle dynamic tokens/IDs
* Log requests/responses for debugging

3 weeks ago (edited) | [YT] | 0

Playwright *Vibium *Selenium Automation Testing

*** Company Selenium Automation Testing Interview Questions:

๐Ÿ”ตCore Selenium & Automation
1. Difference between `findElement` vs `findElements`?
2. How to get values from dropdowns?
3. Smoke vs Sanity testing?
4. Bug Life Cycle?
5. Regression vs Retesting?
6. How do priorities work in TestNG?
7. What is the WebDriver interface?
8. Implicit vs Explicit wait?
9. Handling OTPs in automation?
๐Ÿ”ตJava Programming
1. Occurrences of characters in a string
2. Fibonacci series program
3. Print even numbers in an array โ†’ `{2,4,6}`
4. Reverse a string using `StringBuilder`
5. Check if a number is a palindrome
6. Remove duplicate letters from a string
7. Bubble sort algorithm
8. Transform `'My name is so and so'` โ†’ `'{My-name-is-so-and-so}'`
๐Ÿ”ตOOPs & Java Concepts
1. Abstract class vs Abstract method
2. Abstract class vs Interface
3. Instance variables
4. OOP concepts and where you applied them in a framework
๐Ÿ”ตFramework & Tools
1. Explain the structure of an automation framework
2. How to connect files in Cucumber? What are hooks?
3. How to run flaky test cases? (with code)
4. Maven lifecycle?
5. Jenkins โ€“ how to run jobs?
6. Git: merge vs rebase? Handling merge conflicts?
7. Git commands you have used

*** Company Selenium Automation Testing Interview Questions:
====================================================


๐Ÿ”ต 1. Manual Testing Questions
Q1. Explain your SDLC & STLC understanding in brief.
Q2. What is the difference between Severity and Priority? Give real examples.
Q3. How do you ensure a requirement is fully testable?
Q4. Explain the complete defect life cycle with real examples.
Q5. What challenges have you faced during functional testing?

๐ŸŸ  2. Automation Testing (Selenium + Java) Questions
Q6. Explain the Framework you have created or worked on (Hybrid / POM / BDD).
Q7. How do you handle dynamic web elements in Selenium?
Q8. What is your strategy for writing reusable utilities in automation?
Q9. Difference between implicit wait, explicit wait, fluent wait.
Q10. How do you run tests in parallel using TestNG?
Q11. Explain your CI/CD integration (Jenkins, Git).
Q12. How do you handle test data management in automation?

๐ŸŸข 3. API Testing (Rest Assured)
Q13. Explain your end-to-end API automation approach.
Q14. How do you validate response body and schema?
Q15. What types of authentication have you used? (Bearer, OAuth, Basic)
Q16. How do you handle API chaining in Rest Assured?
Q17. How do you debug failing APIs? Steps?

๐Ÿ”ต 4. SQL & Database Testing
Q18. Write SQL to fetch duplicate records.
Q19. How do you validate UI data with backend data?
Q20. Explain joins with real project use case.
Q21. Write SQL to find max salary of each department.

๐ŸŸฃ 5. Scenario-Based Questions (Crestech Focus)
Q22. How will you test a payment flow end-to-end?
Q23. How do you test reports/dashboard data accuracy?
Q24. If API response is delayed, how will you handle it?
Q25. How do you test data pipelines or data migration?
Q26. Explain a real critical bug you found and its business impact.

๐Ÿ”ด 6. Managerial Round Questions
Q27. Tell me about a situation where you handled production issues.
Q28. How do you ensure quality when timelines are tight?
Q29. How do you handle conflicts within the QA/Dev team?
Q30. What is your approach to task estimation?
Q31. What motivates you in QA as a career?

*** Company Selenium Automation Testing Interview Questions:
====================================================
The questions are for Round:2
Round - 1: was a coding test through hackerrank

Questions:

๐Ÿ”ด ๐‰๐š๐ฏ๐š

What is Method Overloading and Method Overriding?
What is the difference between Abstraction and Interface?
What are the this and super keywords? Can we use both in the same method/constructor?
What Collections have you used in your framework?
What is the difference between ArrayList and LinkedList?
Write a Java program to count the occurrence of each character in a String.
Write a Java program to convert a LinkedList to a HashSet.
What is Type Casting in Java? What are its types?

๐Ÿ”ด ๐’๐ž๐ฅ๐ž๐ง๐ข๐ฎ๐ฆ

Explain Selenium architecture.
What is JavaScriptExecutor? When do we use it? Write its syntax.
What is the difference between get() and navigate.to()?
Write the syntax for taking a screenshot in Selenium (mention the type casting used).
Write the syntax for performing a "Control + A" operation in Selenium.
What is the difference between build() and perform() methods in Actions class?
How do you perform a right-click operation in Selenium?
How do you scroll down to a particular section on a webpage? (Write syntax)
What is the difference between Verification and Validation?
What is the difference between Authentication and Authorization?

๐Ÿ”ด ๐“๐ž๐ฌ๐ญ๐๐†

How do you perform parallel testing in TestNG?
What are the annotations youโ€™ve used in TestNG? Explain each.

๐Ÿ”ด ๐‚๐ฎ๐œ๐ฎ๐ฆ๐›๐ž๐ซ (๐๐ƒ๐ƒ)

What is BDD? How does it work?
Why do we use the Background keyword in Cucumber?
What is the difference between Scenario and Scenario Outline?
Why do we use the Examples keyword in Cucumber?

๐Ÿ”ด ๐’๐๐‹

Write a query to get each artistโ€™s name with the count of songs.
Tables: Artist(id, name), Songs(song_id, song_name, artist_id)
Write a query to get the second highest salary of an employee.
What is a Self Join? Write syntax for manager-employee relationship.
What are Aggregate Functions in SQL? Give examples.

*** Company Selenium Automation Testing Interview Questions:
====================================================
๐Ÿ”ต Round 1:
1. Tell me something about yourself?
2. What is the difference between regression and sanity?
3. What is defect Lifecycle ?
4. What is traceability matrix ?
5. How may test cases you can write in a day?
6. How can you define regression testing and when it's used ?
7. Difference between relative XPath and absolute XPath ?
8. Which framework are you using and explain it ?
9. How to take screenshot in Selenium and can can you write code for it?
10. What are the different types of agile meeting?
11. What are benefits of using TestNG framework?
12. Can you explain POM.XML & where you use it ?
13. Write a code to swap two numbers without using third variable?
14. What is the difference between List and Set?
15. In a webpage how would you ensure that page has been loaded completely?
16. What is constructor and when you will use it and what is super in constructor?
17. What is the difference between private and protected?
18. How will you achieve dynamic polymorphism?
19. Can you override static methods?
20. Can the main method be overloaded?

๐Ÿ”ต Round 2:
1. Can you explain your project with your role and responsibility?
2. How do you perform API testing, explain in detail ?
3. What are common api errors that are often found?
4. What are the major changes you faced while performing API testing ?
5. What is mocking in API testing?
6. What is the difference between Post and Put in API ?
7. What is singleton design pattern?
8. What is constructor, if you want to call constructor
from parent class, what you will do?
9. What is the difference between final, finally and finalize?
10. How will handle alerts in Selenium ?
11. How will you handle dynamic elements using X-path?
12. How to refresh page in Selenium and ots command ?
13. Can you explain Page Factory?
14. What is the use of maven?
15. What are the primary key and unique keys?
16. How many joins are there and any differences?
17. Select the top 3 max salary employees by dept?
18. What do you achieve by git?
19. Are you aware of CI/CD pipeline ?

๐Ÿ”ต Round 3:
1. Why you are looking for a change?
2. Tell us 3 best thing you alike about your previous organization?
3. Tell 2 points you don't like about your previous manager?
4. Where do see yourself in next 5 years?
5. Salary expectation

*** Company Selenium Automation Testing Interview Questions:
====================================================

๐Ÿ”ตRound 1: Technical Interview (1 Hour)

1. Detailed discussion on Selenium framework architecture
2. Usage of OOPS concepts in the automation framework
3. How to run Selenium scripts on an already opened browser
4. Selenium topics:

1. Handling multiple windows
2. Handling dynamic dropdowns
3. Handling Shadow DOM elements
5. Printing all customer salary values from a given graph using Selenium
6. Java topics:

1. Functional Interface
2. Basics of Multithreading
7. Writing Java code to generate all permutations of a given string


๐Ÿ”ต Round 2: Technical Interview (1 Hour)

1. Bug life cycle explanation
2. Difference between bug severity and priority
3. Writing code for database connection
4. Parallel execution using TestNG
5. Use of `IRetryAnalyzer` (asked to write and explain the code)
6. Writing and explaining the Singleton Design Pattern
7. Git commands:

1. git fetch
2. git pull
3. git clone
8. Finding the Kth largest and Kth smallest element in an array
9. Linux basic commands
10. One logical puzzle was given and asked to provide the best possible solution


๐Ÿ”ตRound 3: Technical Interview (1 Hour)

1. Sorting an array of 0, 1, and 2 in O(n) time
2. Palindromic substrings problem (LeetCode)
3. Writing XPath for disappearing elements in Selenium
4. JavaScript basics
5. Setting up Selenium automation framework with Jenkins

3 weeks ago (edited) | [YT] | 2

Playwright *Vibium *Selenium Automation Testing

JavaScript Interview Questions and Answers (Basics)
===========================================
1. What is JavaScript?

Answer:
JavaScript is a lightweight, interpreted scripting language used to make web pages interactive and dynamic.


2. Who developed JavaScript?

Answer:
JavaScript was developed by Brendan Eich at Netscape in 1995.


3. Is JavaScript the same as Java?

Answer:
No. JavaScript and Java are completely different languages with different syntax, purposes, and use cases.


4. Where is JavaScript used?

Answer:
JavaScript is used in:

Web development

Server-side development (Node.js)

Games

Mobile and desktop applications

5. What is the file extension of JavaScript?

Answer:
.js


6. Can JavaScript run outside the browser?

Answer:
Yes. JavaScript can run outside the browser using environments like Node.js.


7. What are the two main types of comments in JavaScript?

Answer:

Single-line comment: //

Multi-line comment: /* */


8. What is the output of console.log("Hello" + " World")?

Answer:
Hello World


9. What is a variable?

Answer:
A variable is a container used to store data values.


10. What keywords are used to declare variables in JavaScript?

Answer:
var, let, and const.


11. What is the difference between let and const?

Answer:
let allows reassignment

const does not allow reassignment


12. Is JavaScript case-sensitive?

Answer:
Yes. JavaScript is case-sensitive.


13. What is a keyword in JavaScript?

Answer:
A keyword is a reserved word that has a special meaning in JavaScript and cannot be used as a variable name.


14. How do you write to the browser console?

Answer:
Using console.log("message").


15. What is a data type?

Answer:
A data type defines the type of value a variable can hold.


16. Name some primitive data types in JavaScript.

Answer:

String

Number

Boolean

Null

Undefined

Symbol

BigInt


17. What is the typeof operator used for?

Answer:
It is used to check the data type of a variable.


18. What is the output of typeof null?

Answer:
"object" (This is a well-known JavaScript quirk.)


19. What is the output of typeof NaN?

Answer:
"number"


20. What is hoisting in JavaScript?

Answer:
Hoisting is JavaScript behavior where variable and function declarations are moved to the top of their scope during compilation.


21. Can you declare a variable without var, let, or const?

Answer:
Yes, but it becomes a global variable, which is not recommended.


22. What is the difference between == and ===?

Answer:

== compares only values

=== compares both value and data type


23. What is the output of 10 + "5"?

Answer:
"105"
(Number + String results in string concatenation.)


24. What is the output of "5" - 2?

Answer:
3
(JavaScript converts the string to a number during subtraction.)


25. What does NaN stand for?

Answer:
NaN stands for Not a Number.


26. How do you check if a value is NaN?

Answer:
Using isNaN(value).


27. What is a Boolean in JavaScript?

Answer:
A Boolean is a logical data type that has two values: true and false.


28. What is the output of Boolean(0)?

Answer:
false


29. What is the output of Boolean("0")?

Answer:
true
(Any non-empty string is considered truthy.)


30. What values are considered falsy in JavaScript?

Answer:
false, 0, "", null, undefined, NaN


31. How do you write a single-line comment in JavaScript?

Answer:
Using // comment


32. How do you write a multi-line comment in JavaScript?

Answer:
Using /* comment */


33. Can a JavaScript variable name start with a number?

Answer:
No, variable names cannot start with a number.


34. Can JavaScript variable names contain $ or _?

Answer:
Yes, variable names can contain $ and _.


35. What is the difference between null and undefined?

Answer:

null is an assigned value that represents no value

undefined means a variable has been declared but not assigned a value


36. What does parseInt("10px") return?

Answer:
10


37. What does parseFloat("10.5kg") return?

Answer:
10.5


38. What is the output of typeof undefined?

Answer:
"undefined"


39. What is the output of typeof function() {}?

Answer:
"function"


40. What is the output of typeof []?

Answer:
"object"


41. What is the output of typeof {}?

Answer:
"object"


42. How do you create an array in JavaScript?

Answer:
Using square brackets:
let arr = [1, 2, 3];


43. How do you create an object in JavaScript?

Answer:
Using curly braces:
let obj = { name: "John", age: 30 };


44. How do you check the length of a string?

Answer:
Using the .length property, for example:
"hello".length


45. How do you convert a string to a number in JavaScript?

Answer:
Using Number("123") or parseInt("123").


46. What is a template literal?

Answer:
A template literal is a string that allows embedded expressions using backticks.
Example:

`Hello ${name}`


47. How do you create a function in JavaScript?

Answer:

function greet() {
console.log("Hello");
}


48. What is an anonymous function?

Answer:
A function that does not have a name.


49. What is a callback function?

Answer:
A callback function is a function passed as an argument to another function and executed later.


50. What is the use of return in a function?

Answer:
It returns a value from the function to where it was called.


51. Can a function return multiple values?

Answer:
Not directly, but it can return multiple values using an array or an object.


52. What are function parameters?

Answer:
Parameters are inputs declared in the function definition.


53. What are function arguments?

Answer:
Arguments are values passed to the function when it is called.


54. What is the default return value of a function?

Answer:
undefined (if no return statement is specified).


55. What is an arrow function?

Answer:
An arrow function is a shorter syntax for writing functions.
Example:

const add = (a, b) => a + b;


56. What is the purpose of console.log()?

Answer:
It is used to display messages or values in the browser console for debugging.


57. What is the output of "5" == 5?

Answer:
true
(Type coercion occurs.)


58. What is the output of "5" === 5?

Answer:
false
(Strict comparison checks both value and type.)


59. What is type coercion?

Answer:
Type coercion is the automatic conversion of one data type into another by JavaScript.


60. What is a ternary operator?

Answer:
A shorthand for an if-else statement.
Syntax:

condition ? expr1 : expr2;


61. What is the use of break in loops?

Answer:
It is used to exit the loop immediately.


62. What is the use of continue in loops?

Answer:
It skips the current iteration and continues with the next iteration.


63. What is the difference between for and while loop?

Answer:
The for loop is used when the number of iterations is known in advance.
The while loop is used when the number of iterations is not known, and the loop runs as long as the condition remains true.


64. What is !! in JavaScript?

Answer:
!! is known as the Double Bang operator (also called the Double NOT operator).
It is used to convert any value into its Boolean equivalent (true or false).

Explanation:
The first ! converts a value to its opposite Boolean value
The second ! reverses it again, giving the actual Boolean form of the value


65. What does Math.random() return?

Answer:
It returns a random number between 0 (inclusive) and 1 (exclusive).


66. What does Math.floor(4.9) return?

Answer:
4
(Rounds down to the nearest integer.)


67. What does Math.ceil(4.1) return?

Answer:
5
(Rounds up to the nearest integer.)


68. What does Math.round(4.5) return?

Answer:
5
(Rounds to the nearest integer.)


69. What does Math.max(2, 5, 1) return?

Answer:
5
(Returns the largest value.)


70. What does Math.min(2, 5, 1) return?

Answer:
1
(Returns the smallest value.)


71. How do you generate a random integer from 1 to 10 in JavaScript?

Answer:

Math.floor(Math.random() * 10) + 1;

1 month ago (edited) | [YT] | 17

Playwright *Vibium *Selenium Automation Testing

var value1="Javascript"
var value2="Playwright"
console.log(`Value is ${value1,value2}`)

11 months ago | [YT] | 17