Computer Science MCQs for 2nd Year (Federal Board)

This page has 542 multiple-choice questions for Computer Science (2nd Year (Federal Board)), arranged in 5 chapters and 5 topics. The chapters include Human–Computer Interaction, Algorithms and Data Structures, Programming in Python, Data Science and Machine Learning and Applications, Cybersecurity and Digital Entrepreneurship. Every question has four options, an instant answer and, where available, a short explanation.

Chapters and topics

  • Human–Computer Interaction 1 topic · 103 MCQs
  • Algorithms and Data Structures 1 topic · 102 MCQs
  • Programming in Python 1 topic · 127 MCQs
  • Data Science and Machine Learning 1 topic · 102 MCQs
  • Applications, Cybersecurity and Digital Entrepreneurship 1 topic · 108 MCQs

Sample Computer Science MCQs

Try these questions, then open the full practice to work through every chapter. Tap “Show the answer” after you choose.

Q1. Designing for transparency means:

  1. removing the privacy policy
  2. clearly telling users what data is collected and why
  3. collecting data secretly
  4. hiding privacy settings
Show the answer

Answer: B. clearly telling users what data is collected and why

The correct answer is “clearly telling users what data is collected and why”. Transparency.

Q2. An in-order traversal of a binary search tree lists keys in:

  1. insertion order
  2. descending order always
  3. ascending (sorted) order
  4. random order
Show the answer

Answer: C. ascending (sorted) order

The correct answer is “ascending (sorted) order”. BST property.

Q3. The SQL statement UPDATE students SET marks = 95 WHERE id = 5:

  1. lists all students from highest to lowest marks
  2. removes the record with id 5
  3. changes the marks of the student with id 5
  4. creates a new table
Show the answer

Answer: C. changes the marks of the student with id 5

UPDATE students SET marks = 95 WHERE id = 5: changes the marks of the student with id 5.

Q4. A test gives p = 0.12 and the significance level is α = 0.01. The conclusion is:

  1. reject the null hypothesis
  2. the test is invalid
  3. accept the alternative hypothesis as proven true
  4. fail to reject the null hypothesis
Show the answer

Answer: D. fail to reject the null hypothesis

The correct answer is “fail to reject the null hypothesis”. p ≥ α ⇒ do not reject H₀.

Q5. Using a Caesar cipher with shift 5, the word KEY is encrypted as:

  1. YEK
  2. FZT
  3. QKE
  4. PJD
Show the answer

Answer: D. PJD

The correct answer is “PJD”. Shift each letter 5 places forward.

Practise all 542 questions

Chapter-wise practice with instant answers, timed tests and (with a free account) your progress saved.

Start practising →