Test Paper
Test Paper
How would you retrieve all records of customers along with their corresponding orders
from the customers and orders tables based on customer IDs?
Q2. How would you insert a new record into the employees table with a name and age?
Ans . INSERT INTO employees (name, age) VALUES ('John Doe', 25);
Q3. How would you update the salary of an employee with employee ID 101 in the employees
table?
Q4. How can you retrieve all records from the products table and sort them by price in
descending order?
Q5. How can you retrieve the names of employees who earn more than the average salary in
their department?
Q6. How can you define a function in PHP and return a value from it?
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo "Connected successfully!";
}
Q8. How can you perform a SELECT query and fetch results in PHP?
Q10. What are the advantages of using external CSS stylesheets over inline styles?
● Answer: The DOM (Document Object Model) is a programming interface for web
documents that represents the structure of a document as a tree of objects. JavaScript
interacts with the DOM by manipulating elements, attributes, and styles, allowing
developers to dynamically change the content and structure of a webpage in response to
user actions.
● Answer: Errors in JavaScript can be handled using try, catch, and finally blocks.
Code that may throw an error is placed inside the try block. If an error occurs, control is
transferred to the catch block, where the error can be handled. The finally block
executes regardless of whether an error occurred, making it useful for cleanup
operations.
Q13. What are HTTP methods, and what are their typical uses in RESTful APIs?
● Answer: JSON (JavaScript Object Notation) is a lightweight data interchange format that
is easy for humans to read and write and easy for machines to parse and generate. It is
commonly used in APIs because it is language-agnostic, supports hierarchical data
structures, and has a smaller footprint compared to XML, making data transmission
more efficient.