quiz selfmade (3)

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 51

Lesson 1: Introduction to Computer Science

1. Which of the following is considered computer hardware?

a) Operating System

b) Mouse

c) Database Management System

d) Word Processing Software

Answer: b) Mouse

2. What is the primary purpose of computer networks?

a) To display graphics

b) To connect computers for resource sharing

c) To perform calculations

d) To control robots

Answer: b) To connect computers for resource sharing

Lesson 2: Breadth-First Learning

3. **What is Breadth-First Learning?3. What is Breadth-First Learning?

a) Studying a single topic in-depth before moving to the next

b) Learning all topics at once without a plan

c) Gaining a basic understanding of all topics before exploring details

d) Avoiding challenging topics in a course

Answer: c) Gaining a basic understanding of all topics before exploring details

4. Which of the following is NOT a focus area in Breadth-First Learning?

a) Understanding the importance of each course

b) Studying each topic in great detail initially

c) Building a clear picture of the program


d) Exploring major courses in Computer Science

Answer: b) Studying each topic in great detail initially

Lesson 3: Search Engines

5. What does a search engine primarily do?

a) Creates websites

b) Indexes web pages for efficient retrieval

c) Acts as a database management system

d) Runs operating systems

Answer: b) Indexes web pages for efficient retrieval

6. Which search engine is discussed in detail in the handouts?

a) Yahoo

b) MSN

c) Google

d) Bing

Answer: c) Google

Lesson 4: Searching Tricks

7. How can you find the weather of a specific location on Google?

a) Type “weather”

b) Type “location weather”

c) Use Boolean operators

d) Use the intitle operator

Answer: b) Type “location weather”

8. What query should you use to convert 100 euros to Pakistani rupees on Google?
a) Currency conversion: 100 euros to PKR

b) 100 euros in PKR

c) Convert euros

d) Euros to PKR rates

Answer: b) 100 euros in PKR

Lesson 5: Search Operators (1)

9. What is the function of the “@” symbol in Google searches?

a) To search for prices

b) To focus a search on social media platforms

c) To exclude certain results

d) To find images

Answer: b) To focus a search on social media platforms

10. What does adding a hyphen (-) before a word in a Google query do?

a) Includes synonyms of the word

b) Excludes the word from search results

c) Highlights the word

d) Finds exact matches only

Answer: b) Excludes the word from search results

Lesson 6: Search Operators (2)

11. How do you search for a price range on Google?

a) Use the “price” keyword

b) Use two dots between amounts

c) Use the “~” symbol


d) Enclose the range in quotation marks

Answer: b) Use two dots between amounts

12. What does the Boolean operator “OR” do in a search query?

a) Displays results containing all terms

b) Displays results containing at least one term

c) Excludes specific results

d) Finds exact matches

Answer: b) Displays results containing at least one term

Lesson 7: Search Operators (3)

13. Which operator is used to search for stocks on Google?

a) $

b) @

c) #

d) :

Answer: a) $

14. What query would you use to define a term on Google?

a) “Meaning of [term]”

b) “Define: [term]”

c) “[term] definition”

d) “[term] glossary”

Answer: b) “Define: [term]”

Lesson 8: Advanced Search Operators

15. What does the “intitle” operator do?


a) Searches in the URL of a webpage

b) Searches in the titles of webpages

c) Searches for related websites

d) Searches within cached pages

Answer: b) Searches in the titles of webpages

16. How can you perform a proximity search on Google?

a) Use quotation marks around the search terms

b) Use “AROUND(n)” between two terms

c) Use a hyphen between terms

d) Use two dots between numbers

Answer: b) Use “AROUND(n)” between two terms

Lesson 9: What We Should Not Search on the Internet

17. What kind of searches should you avoid on the internet?

a) Searches for academic information

b) Queries about sensitive or dangerous content

c) Searches using Boolean operators

d) Weather and calculation searches

Answer: b) Queries about sensitive or dangerous content

18. What is a potential consequence of unsafe internet searches?

a) Faster search results

b) Cybersecurity attacks

c) Better understanding of algorithms

d) Enhanced data privacy

Answer: b) Cybersecurity attacks


Lesson 10: Roots of Computing

19. What was the first known computing device?

a) Punch card

b) ENIAC

c) Abacus

d) Vacuum tube

Answer: c) Abacus

20. Which of the following statements about ENIAC is correct?

a) It was the first mechanical computer

b) It used gears for computation

c) It was the first electronic general-purpose computer

d) It was used primarily for word processing

Answer: c) It was the first electronic general-purpose computer

1. What is a “bit”?

a) The smallest unit of data in a computer

b) A programming language

c) A type of hardware

d) A storage device

Answer: a) The smallest unit of data in a computer

2. What can bits represent?

a) Only numbers

b) Only characters

c) Numbers, characters, and more

d) Only graphical data


Answer: c) Numbers, characters, and more

Lesson 12: Boolean Operations

3. What does the AND Boolean operation do?

a) Returns true if either operand is true

b) Returns true if both operands are true

c) Negates the operand

d) Combines multiple operands without conditions

Answer: b) Returns true if both operands are true

4. Which Boolean operation inverts the value of an operand?

a) AND

b) OR

c) NOT

d) XOR

Answer: c) NOT

Lesson 13: Hexadecimal Notation

5. Why is hexadecimal notation used in computing?

a) It simplifies representation of binary data

b) It replaces ASCII codes

c) It is easier to calculate with

d) It is used only for graphics

Answer: a) It simplifies representation of binary data

6. What is the base of the hexadecimal system?

a) 2
b) 10

c) 16

d) 8

Answer: c) 16

Lesson 14: Storing a Bit

7. What is the main purpose of RAM in a computer system?

a) To store permanent data

b) To execute binary operations

c) To store data temporarily for quick access

d) To perform logical operations

Answer: c) To store data temporarily for quick access

8. What type of memory is volatile?

a) ROM

b) RAM

c) Flash memory

d) Hard disk

Answer: b) RAM

Lesson 15: Magnetic Systems

9. What does “seek time” refer to in magnetic storage systems?

a) The time taken to read data

b) The time taken to find data

c) The time to write data

d) The time to delete data


Answer: b) The time taken to find data

10. What is the primary medium of storage in magnetic systems?

a) Transistors

b) Magnetic disks

c) Optical layers

d) Silicon chips

Answer: b) Magnetic disks

Lesson 16: Optical Systems

11. What does DVD stand for?

a) Digital Video Disk

b) Dynamic Versatile Disk

c) Digital Versatile Disk

d) Data Visual Disk

Answer: c) Digital Versatile Disk

12. What is a characteristic feature of Blu-ray disks?

a) Uses magnetic storage

b) Higher data storage capacity

c) Made of silicon

d) Only used for sound data

Answer: b) Higher data storage capacity

Lesson 17: Flash Drives

13. What is an advantage of flash drives over magnetic drives?

a) Higher seek time


b) Faster data access and reliability

c) Larger physical size

d) Lower durability

Answer: b) Faster data access and reliability

14. Which technology is commonly used in SSDs?

a) Optical technology

b) Flash memory

c) Magnetic disks

d) ROM chips

Answer: b) Flash memory

Lesson 18: Representing Text

15. What does ASCII stand for?

a) American Standard Code for Information Interchange

b) Automated System for Code Integration

c) Advanced Security Code for Information

d) American Secure Coding for Internet

Answer: a) American Standard Code for Information Interchange

16. What is the limitation of ASCII?

a) Cannot represent English characters

b) Limited to 7-bit encoding

c) Incompatible with computers

d) Can only represent colors

Answer: b) Limited to 7-bit encoding


Lesson 19: Representing Numeric Values

17. What is binary notation?

a) Representation using hexadecimal digits

b) Representation using two states, 0 and 1

c) A method to store text values

d) A graphical representation

Answer: b) Representation using two states, 0 and 1

18. Which method is used for binary representation of numbers?

a) Power method

b) ASCII encoding

c) Optical recording

d) Magnetic storage

Answer: a) Power method

Lesson 20: Representing Images

19. What is a “pixel” in an image?

a) A unit of binary data

b) A tiny dot of color representing part of an image

c) A mathematical formula for images

d) A hardware component of displays

Answer: b) A tiny dot of color representing part of an image

20. What does image scaling involve?

a) Adjusting the size of the image

b) Converting an image to binary form

c) Encoding sound with the image


d) Changing the color profile

Answer: a) Adjusting the size of the image

Lesson 31: Data Compression - Compressing Audio and Video

1. What is the primary goal of compressing audio and video data?

a) To enhance quality

b) To reduce file size for storage and transmission

c) To change the file format

d) To remove all metadata

Answer: b) To reduce file size for storage and transmission

2. Which compression method is commonly used for audio and video?

a) ASCII encoding

b) Huffman coding

c) MP3 and MP4 codecs

d) Proximity search

Answer: c) MP3 and MP4 codecs

Lesson 32: Data Manipulation - CPU Basics

3. What connects the CPU and main memory in a computer?

a) Cache

b) Bus

c) Hard disk

d) RAM

Answer: b) Bus

4. What is the primary function of the CPU?

a) Displaying data on the screen


b) Storing data permanently

c) Performing calculations and executing instructions

d) Managing the network

Answer: c) Performing calculations and executing instructions

Lesson 33: Stored Program

5. What does the term “stored program” refer to?

a) Programs stored on external devices

b) Programs stored in RAM and executed by the CPU

c) Programs permanently stored in ROM

d) Programs used for graphical design

Answer: b) Programs stored in RAM and executed by the CPU

6. Where are machine instructions typically stored during execution?

a) Hard drive

b) Main memory

c) Cache memory

d) Network server

Answer: b) Main memory

Lesson 34: CPU Architecture Philosophies

7. What are the two primary CPU architecture philosophies?

a) RISC and CISC

b) ASCII and Unicode

c) SSD and HDD

d) Linear and Parallel


Answer: a) RISC and CISC

8. What is the focus of RISC architecture?

a) Complex instruction sets

b) Simplicity and efficiency

c) High storage capacity

d) Networking capabilities

Answer: b) Simplicity and efficiency

Lesson 35: Machine Instruction Categories

9. Which of the following is NOT a machine instruction category?

a) Data transfer

b) Arithmetic/Logic

c) Control group

d) File management

Answer: d) File management

10. What is the function of the control group in machine instructions?

a) To store data

b) To manage program flow

c) To perform mathematical operations

d) To compress data

Answer: b) To manage program flow

Lesson 36: Program Execution

11. What is the basic unit of execution in a program?

a) Bit
b) Instruction

c) Byte

d) Algorithm

Answer: b) Instruction

12. What does the machine cycle include?

a) Storage and networking

b) Fetch, decode, execute, and store

c) Compression and encoding

d) Query and response

Answer: b) Fetch, decode, execute, and store

Lesson 37: Program Execution Example

13. What happens during the “fetch” phase of the machine cycle?

a) Data is saved to the disk

b) Instructions are retrieved from memory

c) The CPU stops executing

d) Instructions are compressed

Answer: b) Instructions are retrieved from memory

14. Which step follows “decode” in the machine cycle?

a) Fetch

b) Store

c) Execute

d) Compress

Answer: c) Execute
Lesson 38: Logic Operators

15. Which logic operator returns true only if both operands are false?

a) AND

b) OR

c) XOR

d) NOR

Answer: d) NOR

16. Which logic operator is used to compare two values for inequality?

a) AND

b) XOR

c) NOT

d) NAND

Answer: b) XOR

Lesson 39: Rotation and Shift

17. What does the “rotate” operation do?

a) Moves all bits in a sequence to the left or right, cycling them

b) Deletes bits from the sequence

c) Changes bits to their complements

d) Reverses the order of bits

Answer: a) Moves all bits in a sequence to the left or right, cycling them

18. Which operation inserts zeroes into the shifted positions?

a) Logical shift

b) Arithmetic shift

c) Rotate
d) XOR

Answer: a) Logical shift

Lesson 40: Arithmetic Operators

19. What is the primary function of arithmetic operators in computing?

a) Managing networks

b) Performing calculations

c) Accessing memory

d) Sending data to storage

Answer: b) Performing calculations

20. Which of the following is NOT an arithmetic operator?

a) Addition (+)

b) Subtraction (-)

c) Multiplication (*)

d) Comparison (=)

Answer: d) Comparison (=)

Lesson 41-50: Operating Systems

21. What is the primary role of an operating system?

a) Managing hardware and software resources

b) Designing graphical interfaces

c) Writing algorithms

d) Compressing data

Answer: a) Managing hardware and software resources

22. Which of the following is NOT a component of an operating system?


a) Kernel

b) Device drivers

c) Database management system

d) User interface

Answer: c) Database management system

23. What does the process of “booting” involve?

a) Deleting unnecessary files

b) Loading the operating system into memory

c) Compressing all data files

d) Installing new software

Answer: b) Loading the operating system into memory

24. What is “time-sharing” in operating systems?

a) Allocating processor time to multiple tasks

b) Storing data on external drives

c) Compressing large files

d) Managing hardware connections

Answer: a) Allocating processor time to multiple tasks

25. What is a semaphore used for in an operating system?

a) Compressing data

b) Managing process synchronization

c) Handling external devices

d) Designing user interfaces

Answer: b) Managing process synchronization

Lesson 51: Operating Systems – Process of Booting

1. What is the purpose of the booting process?


a) To execute user programs directly

b) To load the operating system into memory

c) To shut down the computer

d) To initialize the CPU registers

Answer: b) To load the operating system into memory

2. Which type of program is loaded first during the booting process?

a) Operating System Kernel

b) Device drivers

c) Application software

d) Database systems

Answer: a) Operating System Kernel

Lesson 52: Operating Systems – Process Administration

3. What is a process in the context of operating systems?

a) A piece of hardware

b) An active program in execution

c) A user account

d) A storage device

Answer: b) An active program in execution

4. Which component is responsible for process scheduling?

a) RAM

b) CPU

c) Operating System

d) Hard Disk

Answer: c) Operating System


Lesson 53: Operating Systems – Handling Competition

5. What is “deadlock” in operating systems?

a) A temporary halt in a single process

b) A situation where processes wait indefinitely for resources

c) A crash in the operating system

d) A scheduling method

Answer: b) A situation where processes wait indefinitely for resources

6. What technique can be used to avoid deadlocks?

a) Memory partitioning

b) Semaphore mechanism

c) Resource allocation graph

d) Disk defragmentation

Answer: b) Semaphore mechanism

Lesson 54: Operating Systems – Security Attacks

7. Which of the following is an example of an external security attack?

a) Unauthorized database access

b) Malware installation

c) Phishing emails

d) All of the above

Answer: d) All of the above

8. How can internal security attacks be prevented?

a) Firewalls

b) User authentication and permissions


c) Antivirus software

d) Encrypting all external communications

Answer: b) User authentication and permissions

Lesson 55: Networking – Network Classification

9. Which of the following is a feature of a Wide Area Network (WAN)?

a) Limited to a small office

b) Covers large geographical areas

c) Requires no external hardware

d) Does not use internet connections

Answer: b) Covers large geographical areas

10. What type of network is limited to a single building?

a) WAN

b) LAN

c) MAN

d) VPN

Answer: b) LAN

Lesson 56: Networking – Protocols

11. What is the primary function of a protocol in networking?

a) Managing hardware resources

b) Defining rules for data communication

c) Formatting hard drives

d) Running user applications

Answer: b) Defining rules for data communication


12. Which protocol is used to send emails?

a) HTTP

b) SMTP

c) FTP

d) DNS

Answer: b) SMTP

Lesson 57: Networking – Combining Networks

13. What is the role of a router in networking?

a) Storing data

b) Connecting and directing traffic between networks

c) Encrypting network data

d) Hosting web applications

Answer: b) Connecting and directing traffic between networks

14. What does the term “Internet” represent?

a) A single network

b) A collection of interconnected networks

c) A private server

d) A protocol for data transfer

Answer: b) A collection of interconnected networks

Lesson 58: Networking – Process Communication

15. Which model describes the communication process in a network?

a) Peer-to-peer

b) Client-server
c) OSI model

d) FTP model

Answer: c) OSI model

16. What does the application layer in the OSI model handle?

a) Physical connections

b) Data encryption

c) User interface and application services

d) Network routing

Answer: c) User interface and application services

Lesson 59: Networking – Distributed Systems

17. What is a distributed system?

a) A single machine running multiple programs

b) A collection of independent computers appearing as a single system

c) A hardware device for internet access

d) A database management software

Answer: b) A collection of independent computers appearing as a single system

18. What is an advantage of distributed systems?

a) High dependency on a single server

b) Increased scalability and reliability

c) Slower processing speeds

d) Centralized storage of data

Answer: b) Increased scalability and reliability

Lesson 60: Networking – Internet Architecture


19. What is the backbone of the internet?

a) Routers and switches

b) High-capacity data transmission lines

c) Personal computers

d) Web browsers

Answer: b) High-capacity data transmission lines

20. Which layer of internet architecture manages data transmission?

a) Application layer

b) Transport layer

c) Network layer

d) Physical layer

Answer: b) Transport layer

Lesson 61: Internet Applications – Email

21. Which protocol is commonly used to receive emails?

a) SMTP

b) POP3

c) HTTP

d) IP

Answer: b) POP3

22. What does “CC” stand for in emails?

a) Central Copy

b) Carbon Copy

c) Common Contact

d) Communication Channel
Answer: b) Carbon Copy

Lesson 62: Internet Applications – VoIP

23. What does VoIP stand for?

a) Voice over Internet Protocol

b) Video over IP

c) Virtual Internet Processing

d) Voice-operated Input Protocol

Answer: a) Voice over Internet Protocol

24. Which is a key feature of VoIP?

a) High storage capacity

b) Transmitting voice data over the internet

c) Managing email communications

d) Data compression algorithms

Answer: b) Transmitting voice data over the internet

Lesson 63: Internet Multimedia Streaming

25. What is required for multimedia streaming over the internet?

a) High bandwidth connections

b) Low storage devices

c) Advanced programming skills

d) Dedicated servers

Answer: a) High bandwidth connections

26. What type of multimedia can be streamed online?

a) Only audio
b) Only video

c) Both audio and video

d) Text data only

Answer: c) Both audio and video

Lesson 64: World Wide Web

27. What is the primary protocol used for accessing the World Wide Web?

a) FTP

b) SMTP

c) HTTP

d) TCP

Answer: c) HTTP

28. What does a URL represent?

a) A web browser

b) A web page address

c) An internet protocol

d) A software application

Answer: b) A web page address

Lesson 71: Web Implementations

1. What is the primary purpose of HTML in web development?

a) To design databases

b) To create the structure of web pages

c) To process user input

d) To manage server configurations

Answer: b) To create the structure of web pages


2. Which tag in HTML is used to create a hyperlink?

a) <img>

b) <a>

c) <link>

d) <href>

Answer: b) <a>

Lesson 72: HTML Basics

3. What does HTML stand for?

a) HyperText Markup Language

b) HighText Machine Language

c) HyperText Management Language

d) HyperTag Markup Language

Answer: a) HyperText Markup Language

4. Which attribute in an <img> tag specifies the image’s source?

a) src

b) alt

c) href

d) path

Answer: a) src

Lesson 73: More on HTML

5. Which HTML tag is used for bold text?

a) <i>

b) <b>
c) <u>

d) <strong>

Answer: b) <b>

6. What is the function of the <title> tag in HTML?

a) Defines the title of a table

b) Sets the title of a webpage displayed in the browser tab

c) Highlights a section of the webpage

d) Adds subtitles to an image

Answer: b) Sets the title of a webpage displayed in the browser tab

Lesson 74: XML Basics

7. What does XML stand for?

a) Extra Markup Language

b) Extensible Markup Language

c) Extended Machine Language

d) External Markup Language

Answer: b) Extensible Markup Language

8. What is the primary use of XML?

a) Defining data presentation

b) Storing and transporting data

c) Compressing images

d) Managing server resources

Answer: b) Storing and transporting data

Lesson 75: Client-Side and Server-Side Programming


9. Which of the following is an example of client-side programming?

a) JavaScript

b) PHP

c) SQL

d) Python

Answer: a) JavaScript

10. What is the main purpose of server-side programming?

a) To manage databases

b) To process user requests and interact with servers

c) To create animations

d) To structure web pages

Answer: b) To process user requests and interact with servers

Lesson 76: Layered Internet Software

11. Which protocol operates at the transport layer of the internet?

a) HTTP

b) FTP

c) TCP

d) DNS

Answer: c) TCP

12. What is the purpose of the application layer in internet software?

a) Encrypting data

b) Managing physical connections

c) Providing user-specific services

d) Routing packets
Answer: c) Providing user-specific services

Lesson 77: TCP/IP Protocol Suite

13. What does TCP stand for?

a) Transfer Control Protocol

b) Transmission Control Protocol

c) Transport Configuration Protocol

d) Terminal Communication Protocol

Answer: b) Transmission Control Protocol

14. Which layer of the TCP/IP model is responsible for IP addressing?

a) Transport layer

b) Internet layer

c) Network access layer

d) Application layer

Answer: b) Internet layer

Lesson 78: Network Security

15. Which of the following is NOT a type of network attack?

a) Phishing

b) Malware injection

c) Data encryption

d) Denial-of-service (DoS)

Answer: c) Data encryption

16. What is the purpose of encryption in networking?

a) To speed up data transmission


b) To prevent unauthorized access to data

c) To compress files

d) To manage network traffic

Answer: b) To prevent unauthorized access to data

Lesson 79: Legal Approaches to Network Security

17. What is a key element of network security laws?

a) Protection against hardware failure

b) Legal frameworks for handling cybercrimes

c) Guidelines for designing websites

d) Optimization of internet speed

Answer: b) Legal frameworks for handling cybercrimes

18. Which of the following is NOT a part of network security measures?

a) Firewalls

b) Anti-virus software

c) Intellectual property theft

d) User authentication

Answer: c) Intellectual property theft

Lesson 80: Algorithms – Informal Review

19. What is an algorithm?

a) A programming language

b) A set of steps to solve a specific problem

c) A hardware component

d) A database design method


Answer: b) A set of steps to solve a specific problem

20. Which of the following is NOT a characteristic of a good algorithm?

a) Clear instructions

b) Ambiguity

c) Efficiency

d) Input and output

Answer: b) Ambiguity

Lesson 91: Algorithm Representation (Primitives)

1. What is a primitive in algorithms?

a) A basic operation used in algorithms

b) A complete software package

c) A type of hardware component

d) An advanced mathematical model

Answer: a) A basic operation used in algorithms

2. Which of the following is an example of an algorithmic primitive?

a) Reading input

b) Data encryption

c) Debugging software

d) Compiling a program

Answer: a) Reading input

Lesson 92: Algorithm Representation (Pseudocode)

3. What is pseudocode?

a) A programming language

b) An informal way to describe an algorithm


c) A hardware simulation tool

d) A graphical representation of data

Answer: b) An informal way to describe an algorithm

4. What is the main purpose of pseudocode?

a) To write computer code directly

b) To represent algorithms in a simple, language-independent manner

c) To manage databases

d) To test software efficiency

Answer: b) To represent algorithms in a simple, language-independent manner

Lesson 93: Algorithm Discovery

5. What is the first step in algorithm discovery?

a) Coding the algorithm

b) Understanding the problem

c) Debugging the solution

d) Implementing the algorithm

Answer: b) Understanding the problem

6. What is the main objective of algorithm discovery?

a) To find a solution to a problem

b) To identify errors in code

c) To optimize software performance

d) To design hardware components

Answer: a) To find a solution to a problem

Lesson 94: Algorithm Discovery Strategies (I)


7. What is “divide and conquer” in algorithm discovery?

a) Solving a problem by dividing it into smaller sub-problems

b) Combining all data into a single structure

c) Avoiding complex problems

d) Ignoring unrelated aspects of the problem

Answer: a) Solving a problem by dividing it into smaller sub-problems

8. Which of the following is NOT a divide-and-conquer step?

a) Divide

b) Combine

c) Solve directly

d) Ignore sub-problems

Answer: d) Ignore sub-problems

Lesson 95: Algorithm Discovery Strategies (II)

9. What is backtracking in algorithms?

a) A method to explore all possibilities until a solution is found

b) A strategy to avoid solving the problem

c) A process of debugging algorithms

d) A way to identify irrelevant data

Answer: a) A method to explore all possibilities until a solution is found

10. Which strategy works by making decisions and then revising them as needed?

a) Divide and conquer

b) Backtracking

c) Brute force

d) Recursion
Answer: b) Backtracking

Lesson 96: Iterative Structures (Sequential Search Algorithm)

11. What is a sequential search algorithm?

a) A method to search data by checking each element in order

b) A technique to search data using a binary approach

c) A process to sort data in memory

d) A way to encrypt search queries

Answer: a) A method to search data by checking each element in order

12. What is the time complexity of sequential search in the worst case?

a) O(1)

b) O(n)

c) O(log n)

d) O(n^2)

Answer: b) O(n)

Lesson 97: Iterative Structures (Loop Control)

13. Which of the following is NOT a component of loop control?

a) Initialization

b) Condition check

c) Iteration

d) Compilation

Answer: d) Compilation

14. What is the primary purpose of loop control structures?

a) To ensure repeated execution of code blocks under specific conditions


b) To manage memory allocation

c) To execute code sequentially without repetition

d) To debug errors in programs

Answer: a) To ensure repeated execution of code blocks under specific conditions

Lesson 98: Components of Repetitive Control

15. What is an iteration in the context of a loop?

a) A single execution of the loop body

b) A condition that terminates the loop

c) A function call within the loop

d) A syntax error in the loop

Answer: a) A single execution of the loop body

16. Which of the following can terminate a loop prematurely?

a) A logical error

b) A break statement

c) A syntax warning

d) An increment operation

Answer: b) A break statement

Lesson 99: Loop Execution Examples (I)

17. What is a “for” loop commonly used for?

a) Repeated execution when the number of iterations is known

b) Infinite loops

c) Conditional execution without iteration

d) Debugging software
Answer: a) Repeated execution when the number of iterations is known

18. Which statement in a loop changes the flow to the next iteration?

a) Continue

b) Break

c) Return

d) Exit

Answer: a) Continue

Lesson 100: Loop Execution Examples (II)

19. What happens if a “while” loop condition is always true?

a) The loop executes once

b) The loop never executes

c) The loop executes indefinitely

d) The loop throws a runtime error

Answer: c) The loop executes indefinitely

20. What must be ensured in a loop to prevent infinite execution?

a) A valid exit condition

b) A large dataset

c) Proper memory allocation

d) Random iteration values

Answer: a) A valid exit condition

Lesson 101: Pretest and Posttest Loops

21. In a pretest loop, when is the condition checked?

a) After the loop body executes


b) Before the loop body executes

c) During the loop execution

d) Randomly during iterations

Answer: b) Before the loop body executes

22. Which type of loop always executes at least once?

a) Pretest loop

b) Posttest loop

c) Infinite loop

d) Nested loop

Answer: b) Posttest loop

Lesson 102: Insertion Sort Algorithm

23. What is the basic idea of insertion sort?

a) Dividing the dataset into halves

b) Sorting elements by comparing and inserting them in their correct position

c) Using a binary tree for sorting

d) Removing duplicates before sorting

Answer: b) Sorting elements by comparing and inserting them in their correct position

24. What is the time complexity of insertion sort in the worst case?

a) O(log n)

b) O(n)

c) O(n^2)

d) O(n log n)

Answer: c) O(n^2)
Lesson 103: Insertion Sort Algorithm Example

25. How does insertion sort handle unsorted elements?

a) Places them at the end of the list

b) Compares and inserts them into the sorted portion

c) Swaps them with all sorted elements

d) Ignores them

Answer: b) Compares and inserts them into the sorted portion

26. Which dataset would require the most iterations for insertion sort?

a) An already sorted list

b) A list sorted in reverse order

c) A list with identical elements

d) A list with random order

Answer: b) A list sorted in reverse order

Lesson 104: Recursive Structure (Binary Search Algorithm)

27. What is the key requirement for binary search?

a) The dataset must be sorted

b) The dataset must have unique elements

c) The dataset must be small

d) The dataset must be stored in a tree

Answer: a) The dataset must be sorted

28. What is the time complexity of binary search?

a) O(n)

b) O(log n)

c) O(n^2)
d) O(n log n)

Answer: b) O(log n)

Lesson 105: Recursive Control

29. What defines a recursive function?

a) A function that calls itself

b) A function with no parameters

c) A loop-based function

d) A mathematical equation

Answer: a) A function that calls itself

[10:15 pm, 08/12/2024] Noor fatima: Lesson 106: Algorithm Efficiency

1. What does algorithm efficiency measure?

a) The accuracy of the output

b) The time and resources an algorithm uses

c) The programming language used

d) The complexity of the algorithm’s code

Answer: b) The time and resources an algorithm uses

2. Which notation is used to describe the efficiency of an algorithm?

a) ASCII notation

b) Hexadecimal notation

c) Big-O notation

d) Boolean notation

Answer: c) Big-O notation

3. What does O(n) represent in Big-O notation?

a) Constant time complexity


b) Linear time complexity

c) Exponential time complexity

d) Quadratic time complexity

Answer: b) Linear time complexity

4. Which algorithm is considered more efficient?

a) An algorithm with O(n^2) complexity

b) An algorithm with O(log n) complexity

c) An algorithm with O(2^n) complexity

d) An algorithm with O(n!) complexity

Answer: b) An algorithm with O(log n) complexity

Lesson 107: Software Verification

5. What is software verification?

a) Ensuring software meets user requirements

b) Checking the hardware compatibility of software

c) Analyzing the source code of a program

d) Developing software documentation

Answer: a) Ensuring software meets user requirements

6. Which of the following is NOT a part of software verification?

a) Testing

b) Debugging

c) Validating user interfaces

d) Writing program code

Answer: d) Writing program code

7. What is black-box testing?


a) Testing the internal structure of a program

b) Testing without knowledge of the internal structure

c) Verifying the source code manually

d) Checking hardware functionality

Answer: b) Testing without knowledge of the internal structure

Lesson 108: Software Verification Examples

8. What is an example of white-box testing?

a) Testing the output against input without analyzing code

b) Testing internal code paths and logic

c) Testing user interfaces only

d) Testing network connectivity

Answer: b) Testing internal code paths and logic

9. What is the primary purpose of integration testing?

a) Verifying individual modules

b) Checking the interaction between modules

c) Testing the entire system

d) Debugging runtime errors

Answer: b) Checking the interaction between modules

10. Which type of testing is performed after all components are integrated?

a) Unit testing

b) Regression testing

c) System testing

d) Static testing

Answer: c) System testing


Would you like to proceed with the next set of lessons?

[10:15 pm, 08/12/2024] Noor fatima: Here are MCQs for Lessons 91 to 108:

Lesson 91: Algorithm Representation (Primitives)

1. What is a primitive in algorithms?

a) A basic operation used in algorithms

b) A complete software package

c) A type of hardware component

d) An advanced mathematical model

Answer: a) A basic operation used in algorithms

2. Which of the following is an example of an algorithmic primitive?

a) Reading input

b) Data encryption

c) Debugging software

d) Compiling a program

Answer: a) Reading input

Lesson 92: Algorithm Representation (Pseudocode)

3. What is pseudocode?

a) A programming language

b) An informal way to describe an algorithm

c) A hardware simulation tool

d) A graphical representation of data

Answer: b) An informal way to describe an algorithm


4. What is the main purpose of pseudocode?

a) To write computer code directly

b) To represent algorithms in a simple, language-independent manner

c) To manage databases

d) To test software efficiency

Answer: b) To represent algorithms in a simple, language-independent manner

Lesson 93: Algorithm Discovery

5. What is the first step in algorithm discovery?

a) Coding the algorithm

b) Understanding the problem

c) Debugging the solution

d) Implementing the algorithm

Answer: b) Understanding the problem

6. What is the main objective of algorithm discovery?

a) To find a solution to a problem

b) To identify errors in code

c) To optimize software performance

d) To design hardware components

Answer: a) To find a solution to a problem

Lesson 94: Algorithm Discovery Strategies (I)

7. What is “divide and conquer” in algorithm discovery?

a) Solving a problem by dividing it into smaller sub-problems

b) Combining all data into a single structure


c) Avoiding complex problems

d) Ignoring unrelated aspects of the problem

Answer: a) Solving a problem by dividing it into smaller sub-problems

8. Which of the following is NOT a divide-and-conquer step?

a) Divide

b) Combine

c) Solve directly

d) Ignore sub-problems

Answer: d) Ignore sub-problems

Lesson 95: Algorithm Discovery Strategies (II)

9. What is backtracking in algorithms?

a) A method to explore all possibilities until a solution is found

b) A strategy to avoid solving the problem

c) A process of debugging algorithms

d) A way to identify irrelevant data

Answer: a) A method to explore all possibilities until a solution is found

10. Which strategy works by making decisions and then revising them as needed?

a) Divide and conquer

b) Backtracking

c) Brute force

d) Recursion

Answer: b) Backtracking

Lesson 96: Iterative Structures (Sequential Search Algorithm)


11. What is a sequential search algorithm?

a) A method to search data by checking each element in order

b) A technique to search data using a binary approach

c) A process to sort data in memory

d) A way to encrypt search queries

Answer: a) A method to search data by checking each element in order

12. What is the time complexity of sequential search in the worst case?

a) O(1)

b) O(n)

c) O(log n)

d) O(n^2)

Answer: b) O(n)

Lesson 97: Iterative Structures (Loop Control)

13. Which of the following is NOT a component of loop control?

a) Initialization

b) Condition check

c) Iteration

d) Compilation

Answer: d) Compilation

14. What is the primary purpose of loop control structures?

a) To ensure repeated execution of code blocks under specific conditions

b) To manage memory allocation

c) To execute code sequentially without repetition

d) To debug errors in programs


Answer: a) To ensure repeated execution of code blocks under specific conditions

Lesson 98: Components of Repetitive Control

15. What is an iteration in the context of a loop?

a) A single execution of the loop body

b) A condition that terminates the loop

c) A function call within the loop

d) A syntax error in the loop

Answer: a) A single execution of the loop body

16. Which of the following can terminate a loop prematurely?

a) A logical error

b) A break statement

c) A syntax warning

d) An increment operation

Answer: b) A break statement

Lesson 99: Loop Execution Examples (I)

17. What is a “for” loop commonly used for?

a) Repeated execution when the number of iterations is known

b) Infinite loops

c) Conditional execution without iteration

d) Debugging software

Answer: a) Repeated execution when the number of iterations is known

18. Which statement in a loop changes the flow to the next iteration?

a) Continue
b) Break

c) Return

d) Exit

Answer: a) Continue

Lesson 100: Loop Execution Examples (II)

19. What happens if a “while” loop condition is always true?

a) The loop executes once

b) The loop never executes

c) The loop executes indefinitely

d) The loop throws a runtime error

Answer: c) The loop executes indefinitely

20. What must be ensured in a loop to prevent infinite execution?

a) A valid exit condition

b) A large dataset

c) Proper memory allocation

d) Random iteration values

Answer: a) A valid exit condition

Lesson 101: Pretest and Posttest Loops

21. In a pretest loop, when is the condition checked?

a) After the loop body executes

b) Before the loop body executes

c) During the loop execution

d) Randomly during iterations


Answer: b) Before the loop body executes

22. Which type of loop always executes at least once?

a) Pretest loop

b) Posttest loop

c) Infinite loop

d) Nested loop

Answer: b) Posttest loop

Lesson 102: Insertion Sort Algorithm

23. What is the basic idea of insertion sort?

a) Dividing the dataset into halves

b) Sorting elements by comparing and inserting them in their correct position

c) Using a binary tree for sorting

d) Removing duplicates before sorting

Answer: b) Sorting elements by comparing and inserting them in their correct position

24. What is the time complexity of insertion sort in the worst case?

a) O(log n)

b) O(n)

c) O(n^2)

d) O(n log n)

Answer: c) O(n^2)

Lesson 103: Insertion Sort Algorithm Example

25. How does insertion sort handle unsorted elements?

a) Places them at the end of the list


b) Compares and inserts them into the sorted portion

c) Swaps them with all sorted elements

d) Ignores them

Answer: b) Compares and inserts them into the sorted portion

26. Which dataset would require the most iterations for insertion sort?

a) An already sorted list

b) A list sorted in reverse order

c) A list with identical elements

d) A list with random order

Answer: b) A list sorted in reverse order

Lesson 104: Recursive Structure (Binary Search Algorithm)

27. What is the key requirement for binary search?

a) The dataset must be sorted

b) The dataset must have unique elements

c) The dataset must be small

d) The dataset must be stored in a tree

Answer: a) The dataset must be sorted

28. What is the time complexity of binary search?

a) O(n)

b) O(log n)

c) O(n^2)

d) O(n log n)

Answer: b) O(log n)
Lesson 105: Recursive Control

29. What defines a recursive function?

a) A function that calls itself

b) A function with no parameters

c) A loop-based function

d) A mathematical equation

Answer: a) A function that calls itself

30. **What is necessary for recursion

You might also like