NEW
Font size
WorksheetsWeb Security – Part 1 (MCQ Quiz)
Total questions: 10
Worksheet time: 5mins
Which of the following best describes HTTP?
A. A stateful protocol that stores user data
B. A stateless request/response protocol
C. A security mechanism for encryption
D. A browser-side programming language
What is the main purpose of cookies in web applications?
To encrypt data
To detect viruses
To store and maintain user state information
To block advertisements
Which of the following cookie fields determines where the cookie is valid?
Path
Domain
Expires
Name
Which attack occurs when a malicious script is injected into a trusted website?
SQL Injection
Session Hijacking
Cross-Site Scripting (XSS)
Man-in-the-middle
Which of the following is NOT an effect of a Cross-Site Scripting (XSS) attack?
Stealing cookies
Manipulating DOM elements
Encrypting user files
Impersonating a user
What does the Same-Origin Policy (SOP) protect?
Protects the server from malware
Allows unrestricted access to all websites
Restricts scripts from accessing data from different origins
Allows cookies to be shared with all domains
In Same-Origin Policy, an origin is defined by which three components?
Country, OS, Browser
Protocol, Domain, Port
User, Password, Token
Server, Client, Network
What is the primary function of a browser sandbox?
Speed up page loading
Store cookies
Restrict access of untrusted scripts to system resources
Convert HTTP to HTTPS
Why is client-side scripting considered dangerous?
It uses too much memory
It can access local resources and steal data
It slows down the internet
It only works in Chrome
Which method in PHP is commonly used to prevent XSS attacks?
mysql_real_escape_string()
strip_tags()
htmlspecialchars()
validateRequest()
