0% found this document useful (0 votes)
1 views13 pages

Database Modeling,Web,Front-End.security,API Questions

The document contains a series of questions and answers related to database modeling, SQL, API design, web development, web security, and general programming concepts. Each section includes multiple-choice questions with correct answers provided. Topics covered include SQL queries, RESTful API methods, JavaScript functionalities, and security measures against various types of attacks.

Uploaded by

Bhakti Pandit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views13 pages

Database Modeling,Web,Front-End.security,API Questions

The document contains a series of questions and answers related to database modeling, SQL, API design, web development, web security, and general programming concepts. Each section includes multiple-choice questions with correct answers provided. Topics covered include SQL queries, RESTful API methods, JavaScript functionalities, and security measures against various types of attacks.

Uploaded by

Bhakti Pandit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Database Modeling & SQL Questions:

1. Advanced SQL Query:


o Q1. Given two tables, Employees (EmployeeID, Name,
DepartmentID) and Departments (DepartmentID, DepartmentName),
which query retrieves the names of employees along with their
department names?
 Options:
1. SELECT e.Name, d.DepartmentName FROM Employees e
JOIN Departments d ON e.DepartmentID =
d.DepartmentID;
2. SELECT e.Name, d.DepartmentName FROM Employees e,
Departments d WHERE e.DepartmentID =
d.DepartmentID;
3. Both options 1 and 2
4. SELECT * FROM Employees, Departments;
 Answer: Both options 1 and 2
2. Subquery:
o Q2. What will the following SQL query return?
SELECT Name FROM Employees WHERE DepartmentID IN (SELECT
DepartmentID FROM Departments WHERE DepartmentName = 'Sales');
 Options:
1. Names of all employees
2. Names of employees in the Sales department
3. Department names
4. All departments
 Answer: Names of employees in the Sales department
3. Aggregate Functions with HAVING:
o Q3. Which SQL query will return the departments with more than 10
employees?
SELECT DepartmentID, COUNT(*) FROM Employees GROUP BY
DepartmentID HAVING COUNT(*) > 10;
 Options:
1. Correct query
2. Incorrect query (needs a WHERE clause)
3. Incorrect query (no GROUP BY)
4. Incorrect query (needs DISTINCT)
 Answer: Correct query
4. Join Types:
o Q4. Which type of join returns all records from the left table and
matched records from the right table, and fills with NULLs when there’s
no match?
 Options:
1. INNER JOIN
2. OUTER JOIN
3. LEFT JOIN
4. CROSS JOIN
 Answer: LEFT JOIN
5. Indexing:
o Q5. What is the primary benefit of using indexes in a database?

 Options:
1. To reduce data redundancy
2. To speed up query performance
3. To enforce data integrity
4. To simplify database design
 Answer: To speed up query performance
API Questions:
6. RESTful API Design:
o Q6. In RESTful API design, which HTTP method is idempotent, meaning
that multiple identical requests have the same effect as a single
request?
 Options:
1. POST
2. PUT
3. DELETE
4. GET
 Answer: PUT
7. API Rate Limiting:
o Q7. What is the purpose of rate limiting in APIs?

 Options:
1. To increase data throughput
2. To prevent abuse and ensure fair usage
3. To improve API documentation
4. To enhance security protocols
 Answer: To prevent abuse and ensure fair usage
Front-end / Web Development Questions:
8. JavaScript Scope:
o Q8. What will be the output of the following code?

o var x = 10;

o function test() {

o var x = 20;

o console.log(x);

o }

o test();

o console.log(x);

 Options:
1. 10, 20
2. 20, 10
3. 20, 20
4. 10, 10
 Answer: 20, 10
9. JavaScript Closure:
o Q9. What is a closure in JavaScript?

 Options:
1. A way to close a function
2. A function that retains access to its lexical scope
3. A method to handle errors
4. A function with no parameters
 Answer: A function that retains access to its lexical scope
10.Promises:
o Q10. What will the output of the following code be?

o let promise = new Promise((resolve, reject) => {

o setTimeout(() => resolve("Done"), 1000);

o });

o promise.then(result => console.log(result));

o console.log("Start");

o Options:

1. “Done”, “Start”

2. “Start”, “Done”

3. “Start”

4. “Done”

o Answer: “Start”, “Done”

Web/Internet Security Questions:


11.SQL Injection Prevention:
o Q11. Which of the following methods is most effective in preventing
SQL Injection attacks?
 Options:
1. Using stored procedures
2. Validating user input
3. Escaping special characters
4. All of the above
 Answer: All of the above
12.Cross-Site Request Forgery (CSRF):
o Q12. What is CSRF?

 Options:
1. An attack that tricks the user into executing unwanted
actions
2. An attack that intercepts user credentials
3. An attack that exploits XSS vulnerabilities
4. An attack that floods a service with requests
 Answer: An attack that tricks the user into executing unwanted
actions
13.Data Encryption:
o Q13. What is the main purpose of TLS (Transport Layer Security)?

 Options:
1. To improve website loading speed
2. To encrypt data transmitted over the internet
3. To authenticate users
4. To manage API requests
 Answer: To encrypt data transmitted over the internet
14.Web Application Firewalls (WAF):
o Q14. What does a Web Application Firewall do?

 Options:
1. Scans files for viruses
2. Monitors and filters HTTP traffic to and from a web
application
3. Prevents data loss in databases
4. Increases website loading speed
 Answer: Monitors and filters HTTP traffic to and from a web
application
General Programming Questions:
15.Asynchronous JavaScript:
o Q15. In JavaScript, what does the async keyword do?

 Options:
1. Makes a function synchronous
2. Makes a function return a promise
3. Blocks the main thread
4. Executes a function immediately
 Answer: Makes a function return a promise
16.JavaScript Event Delegation:
o Q16. What is the advantage of event delegation in JavaScript?

 Options:
1. Reduces memory usage by attaching fewer event
handlers
2. Ensures all events are triggered simultaneously
3. Increases the performance of animations
4. Simplifies API calls
 Answer: Reduces memory usage by attaching fewer event
handlers
17.Web Storage:
o Q17. What is the main difference
between localStorage and sessionStorage?
 Options:
1. localStorage is temporary; sessionStorage is permanent
2. localStorage persists even after the browser is
closed; sessionStorage does not
3. sessionStorage can only store numbers; localStorage can
store strings
4. There is no difference
 Answer: localStorage persists even after the browser is
closed; sessionStorage does not
18.HTTP vs. HTTPS:
o Q18. What is the main difference between HTTP and HTTPS?

 Options:
1. HTTP is faster than HTTPS
2. HTTPS encrypts data for secure transmission
3. HTTP is used for web applications, while HTTPS is not
4. HTTPS is only for government websites
 Answer: HTTPS encrypts data for secure transmission
19.Content Security Policy (CSP):
o Q19. What is the purpose of a Content Security Policy (CSP)?

 Options:
1. To manage server load
2. To prevent XSS attacks by controlling resources the user
agent is allowed to load
3. To enhance SEO
4. To compress website files
 Answer: To prevent XSS attacks by controlling resources the
user agent is allowed to load
20.API Documentation:
o Q20. Which tool is commonly used for API documentation and testing?

 Options:
1. Postman
2. Fiddler
3. Wireshark
4. Git
 Answer: Postman

Second set:
Database Modeling & SQL Questions:
1. Advanced SQL: Window Functions:
o Q1. What does the following SQL query do?
SELECT EmployeeID, Salary, RANK() OVER (ORDER BY Salary DESC) AS
SalaryRank FROM Employees;
 Options:
1. Returns a list of employees with their salaries
2. Returns each employee’s rank based on salary in
descending order
3. Returns only the highest salary
4. Returns employees in alphabetical order
 Answer: Returns each employee’s rank based on salary in
descending order
2. Composite Keys:
o Q2. What is a composite key?

 Options:
1. A key made up of multiple columns
2. A key that is unique to a single table
3. A key that includes a foreign key
4. A key that contains NULL values
 Answer: A key made up of multiple columns
3. Self Join:
o Q3. What does a self join do?

 Options:
1. Joins a table to itself
2. Joins multiple tables
3. Joins only related data
4. Joins based on a foreign key
 Answer: Joins a table to itself
4. SQL Injection Example:
o Q4. Which of the following SQL queries is vulnerable to SQL injection?
SELECT * FROM Users WHERE Username = 'user' AND Password =
'pass';
 Options:
1. Vulnerable to SQL injection
2. Not vulnerable due to parameterization
3. Safe if using stored procedures
4. Safe as long as passwords are hashed
 Answer: Vulnerable to SQL injection
5. Data Types:
o Q5. Which SQL data type is best suited for storing a person’s age?

 Options:
1. VARCHAR
2. INT
3. DATE
4. FLOAT
 Answer: INT
API Questions:
6. REST API Status Codes:
o Q6. Which HTTP status code indicates that the request has succeeded
and the server has returned the requested data?
 Options:
1. 200 OK
2. 201 Created
3. 204 No Content
4. 400 Bad Request
 Answer: 200 OK
7. API Versioning:
o Q7. What is a common method for versioning RESTful APIs?

 Options:
1. Including the version in the URL (e.g., /api/v1/resource)
2. Using HTTP headers only
3. Changing the API base URL every year
4. Adding a version parameter in the query string
 Answer: Including the version in the URL (e.g., /api/v1/resource)
8. GraphQL vs. REST:
o Q8. What is a key advantage of using GraphQL over REST?

 Options:
1. GraphQL uses less bandwidth
2. GraphQL allows clients to request only the data they need
3. REST APIs are generally faster
4. GraphQL does not require authentication
 Answer: GraphQL allows clients to request only the data they
need
Front-end / Web Development Questions:
9. JavaScript Hoisting:
o Q9. What will the following code output?

o console.log(x);

o var x = 5;

 Options:
1. 5
2. undefined
3. ReferenceError
4. null
 Answer: undefined
10.CSS Flexbox:
o Q10. What property enables a flex container to wrap its items?

 Options:
1. flex-direction
2. flex-wrap
3. justify-content
4. align-items
 Answer: flex-wrap
11.JavaScript Event Loop:
o Q11. What does the JavaScript event loop allow?

 Options:
1. Execution of multiple threads
2. Non-blocking I/O operations
3. Parallel execution of JavaScript code
4. Immediate execution of synchronous code
 Answer: Non-blocking I/O operations
Web/Internet Security Questions:
12.XSS Vulnerability:
o Q12. What type of attack is Cross-Site Scripting (XSS)?

 Options:
1. Attacking the server directly
2. Injecting malicious scripts into web pages
3. Phishing for user credentials
4. Flooding a web server with requests
 Answer: Injecting malicious scripts into web pages
13.Multi-Factor Authentication:
o Q13. What is the purpose of Multi-Factor Authentication (MFA)?

 Options:
1. To enhance password strength
2. To require multiple verification methods for access
3. To encrypt data in transit
4. To simplify the login process
 Answer: To require multiple verification methods for access
14.Phishing:
o Q14. What is a common tactic used in phishing attacks?

 Options:
1. Sending legitimate emails only
2. Spoofing email addresses to appear authentic
3. Encrypting communication
4. Requesting multi-factor authentication
 Answer: Spoofing email addresses to appear authentic
15.Brute Force Attack:
o Q15. What is a brute force attack?

 Options:
1. Attacking with physical methods
2. Trying all possible combinations to guess a password
3. Exploiting software vulnerabilities
4. Launching denial-of-service attacks
 Answer: Trying all possible combinations to guess a password
General Programming Questions:
16.JavaScript Promises:
o Q16. What will the following code output?

o let promise = new Promise((resolve, reject) => {

o setTimeout(() => resolve("First"), 1000);

o });

o promise.then(result => {

o console.log(result);

o return "Second";

o }).then(result => console.log(result));

o Options:

1. First, Second
2. Second, First
3. First
4. Second
o Answer: First, Second

17.CSS Grid:
o Q17. What is the purpose of the CSS grid-template-areas property?

 Options:
1. To define the size of the grid
2. To specify grid item placements in a visual format
3. To set the background of a grid
4. To control the number of rows and columns
 Answer: To specify grid item placements in a visual format
18.JavaScript Fetch API:
o Q18. What does the Fetch API do in JavaScript?

 Options:
1. Reads files from the local system
2. Makes network requests to servers
3. Parses JSON data
4. Generates random numbers
 Answer: Makes network requests to servers
19.CORS:
o Q19. What does CORS stand for in web security?

 Options:
1. Cross-Origin Resource Sharing
2. Cross-Origin Request Security
3. Client-Origin Resource Sharing
4. Client-Origin Request Security
 Answer: Cross-Origin Resource Sharing
20.Content Security Policy (CSP):
o Q20. What does a Content Security Policy help mitigate?

 Options:
1. SQL Injection attacks
2. XSS attacks
3. CSRF attacks
4. Denial of Service attacks
 Answer: XSS attacks

You might also like