
This set covers application and legal aspects of cyber security: OWASP Top 10 risk categories, preventing SQL injection, cross-site scripting and cross-site request forgery, secure session handling, the main malware families including viruses, worms, trojans, rootkits and ransomware, and key provisions of India's Information Technology Act 2000. It is useful for university exams, UGC NET, placement tests and web developer or security interviews.
How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 18 questions.
Topics covered in this set
- OWASP Top 10 risk categories
- SQL injection prevention with parameterised queries
- Stored, reflected and DOM XSS defences
- CSRF tokens and SameSite cookies
- Viruses, worms, trojans, rootkits and ransomware
- IT Act 2000 sections and digital signatures
Cyber Security MCQs with answers and explanations
Q1. What is the most effective primary defence against SQL injection?
a) Parameterised queries (prepared statements) that keep data separate from SQL code
b) Hiding database error messages only
c) Using HTTPS for all requests
d) Encrypting the database files on disk
Q2. A web application builds this query from a login form. Why is it dangerous?
query = "SELECT * FROM users WHERE name = '" + userInput + "'"
a) SELECT * is always slower than naming columns
b) User input is concatenated directly into the SQL statement and can alter its structure
c) String concatenation is not supported in SQL
d) The users table cannot be queried by name
Q3. Which type of XSS occurs when malicious script is saved on the server (for example, in a comment) and later served to every visitor viewing that page?
a) Reflected XSS
b) DOM-based XSS
c) Stored (persistent) XSS
d) Clickjacking
Q4. The most important general defence against cross-site scripting is:
a) Using parameterised SQL queries
b) Blocking port 80
c) Storing passwords with bcrypt
d) Context-aware output encoding of untrusted data before rendering it
Q5. Which HTTP response header can significantly reduce the impact of XSS by restricting the sources from which scripts may load?
a) Strict-Transport-Security
b) Content-Security-Policy
c) Cache-Control
d) Content-Length
Q6. Setting the HttpOnly flag on a session cookie helps because it:
a) Prevents client-side JavaScript from reading the cookie, limiting session theft via XSS
b) Encrypts the cookie value
c) Forces the cookie to be sent only over HTTPS
d) Stops the cookie from being sent on cross-site requests
Q7. CSRF attacks succeed because:
a) Servers fail to hash passwords
b) Attackers can read the victim's cookies directly
c) The victim's browser runs injected server-side code
d) Browsers automatically attach the victim's cookies to requests triggered by another site
Q8. Which measure is a standard defence against CSRF?
a) Escaping HTML output
b) Using a longer database password
c) An unpredictable anti-CSRF token tied to the user's session and verified on state-changing requests
d) Converting all POST requests to GET
Q9. A cookie attribute that instructs the browser not to send the cookie with most cross-site requests, helping mitigate CSRF, is:
a) SameSite=Strict or SameSite=Lax
b) Secure
c) HttpOnly
d) Max-Age
Q10. In the OWASP Top 10 (2021), which category ranked first?
a) Injection
b) Cryptographic Failures
c) Broken Access Control
d) Security Misconfiguration
Q11. A user changes the URL from /account?id=1001 to /account?id=1002 and sees another customer's data. This is an example of:
a) Cross-site scripting
b) Insecure direct object reference, a form of broken access control
c) SQL injection
d) Denial of service
Q12. Which malware type self-replicates across networks without needing to attach itself to a host program or require user action?
a) Virus
b) Trojan horse
c) Logic bomb
d) Worm
Q13. A program presented as a free game that secretly installs a backdoor is best classified as:
a) Worm
b) Boot sector virus
c) Trojan horse
d) Adware
Q14. Malware designed to hide its presence and that of other malicious processes, often by modifying the operating system kernel, is called:
a) A keylogger
b) Ransomware
c) A macro virus
d) A rootkit
Q15. Which control is MOST effective for recovering from a ransomware infection without paying the ransom?
a) Regular, tested, offline or immutable backups
b) Disabling the screen saver
c) Increasing RAM on servers
d) Using longer Wi-Fi passwords
Q16. A polymorphic virus is difficult for signature-based antivirus to detect because it:
a) Only infects BIOS chips
b) Changes its encrypted appearance or decryptor with each infection while keeping the same function
c) Never executes any code
d) Always deletes itself after infection
Q17. Under India's Information Technology Act 2000 (as amended), which section deals with punishment for identity theft, such as fraudulently using another person's password or electronic signature?
a) Section 43
b) Section 67
c) Section 72
d) Section 66C
Q18. Which statement about the IT Act 2000 is correct?
a) It replaced the Indian Penal Code entirely
b) It gives legal recognition to electronic records and digital signatures and provides for Certifying Authorities
c) It applies only to government websites
d) It prohibits the use of encryption in India
Quick revision notes
- SQL injection: use parameterised queries, least-privilege DB accounts, input validation as an extra layer.
- XSS types: stored, reflected, DOM-based; defend with output encoding, CSP and HttpOnly cookies.
- CSRF: anti-CSRF tokens, SameSite cookies, re-authentication for sensitive actions; never change state on GET.
- OWASP Top 10 2021: A01 Broken Access Control, A02 Cryptographic Failures, A03 Injection.
- Virus attaches to host and needs execution; worm self-propagates; trojan disguises itself; rootkit hides.
- Ransomware defence: offline/immutable backups, patching, least privilege, email filtering.
- IT Act 2000: Sec 43 (unauthorised access, civil), Sec 66 (computer offences), 66C (identity theft), 66D (cheating by personation), 67 (obscene content).
Frequently asked questions
What is the difference between XSS and CSRF?
XSS injects attacker-controlled script that runs in the victim's browser within the trusted site, so it can read data and act as the user. CSRF does not run script in the target site; it tricks the browser into sending an authenticated request. XSS is fixed with output encoding and CSP, CSRF with tokens and SameSite cookies.
How is a worm different from a virus?
A virus attaches to a host program or file and spreads when that host is executed, usually needing user action. A worm is standalone and spreads automatically across networks by exploiting vulnerabilities.
What does the IT Act 2000 cover?
It is India's primary law on electronic commerce and cybercrime. It gives legal validity to electronic records and digital signatures, regulates Certifying Authorities, and defines offences such as hacking-related computer damage, identity theft and publishing obscene content electronically.
Comments
Post a Comment