wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Web Security – Part 1 (MCQ Quiz)

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which of the following best describes HTTP?

a)

A. A stateful protocol that stores user data

b)

B. A stateless request/response protocol

c)

C. A security mechanism for encryption

d)

D. A browser-side programming language

2.

What is the main purpose of cookies in web applications?

a)

To encrypt data

b)

To detect viruses

c)

To store and maintain user state information

d)

To block advertisements

3.

Which of the following cookie fields determines where the cookie is valid?

a)

Path

b)

Domain

c)

Expires

d)

Name

4.

Which attack occurs when a malicious script is injected into a trusted website?

a)

SQL Injection

b)

Session Hijacking

c)

Cross-Site Scripting (XSS)

d)

Man-in-the-middle

5.

Which of the following is NOT an effect of a Cross-Site Scripting (XSS) attack?

a)

Stealing cookies

b)

Manipulating DOM elements

c)

Encrypting user files

d)

Impersonating a user

6.

What does the Same-Origin Policy (SOP) protect?

a)

Protects the server from malware

b)

Allows unrestricted access to all websites

c)

Restricts scripts from accessing data from different origins

d)

Allows cookies to be shared with all domains

7.

In Same-Origin Policy, an origin is defined by which three components?

a)

Country, OS, Browser

b)

Protocol, Domain, Port

c)

User, Password, Token

d)

Server, Client, Network

8.

What is the primary function of a browser sandbox?

a)

Speed up page loading

b)

Store cookies

c)

Restrict access of untrusted scripts to system resources

d)

Convert HTTP to HTTPS

9.

Why is client-side scripting considered dangerous?

a)

It uses too much memory

b)

It can access local resources and steal data

c)

It slows down the internet

d)

It only works in Chrome

10.

Which method in PHP is commonly used to prevent XSS attacks?

a)

mysql_real_escape_string()

b)

strip_tags()

c)

htmlspecialchars()

d)

validateRequest()