You are on page 1of 16

QUESTION FOR COMPUTER SCIENCE

1.Which of the following data structures is most efficient for storing data that needs to be
accessed in random order?

(a) Linked list

(b) Array

(c) Hash table

(d) Stack

Answer: (c)

2.What is the time complexity of inserting an element into an unsorted linked list?

(a) O(1)

(b) O(log n)

(c) O(n)

(d) O(n^2)

Answer: (a)

3.What is the space complexity of a binary search tree?

(a) O(n)

(b) O(log n)

(c) O(n log n)

(d) O(n^2)

Answer: (b)
4.What is the time complexity of searching for an element in a sorted array using binary
search?

(a) O(1)

(b) O(log n)

(c) O(n)

(d) O(n^2)

Answer: (b)

5.What is the time complexity of sorting an array using heapsort?

(a) O(n)

(b) O(n log n)

(c) O(n^2)

(d) O(n^3)

Answer: (c)

6.Which of the following network topologies is most susceptible to single-point failures?

(a) Bus

(b) Ring

(c) Star

(d) Mesh

Answer: (c)
7.What is the purpose of the TCP protocol?

(a) To provide reliable data transmission

(b) To provide connectionless data transmission

(c) To route data packets across networks

(d) To translate domain names into IP addresses

Answer: (a)

8.What is the purpose of the IP protocol?

(a) To provide reliable data transmission

(b) To provide connectionless data transmission

(c) To route data packets across networks

(d) To translate domain names into IP addresses

Answer: (c)

9.Which scheduling algorithm is designed to reduce the response time for interactive
computing?
(a) First-Come-First-Serve (FCFS)
(b) Shortest Job Next (SJN)
(c) Round Robin (RR)
(d) Priority Scheduling

Answer: (c)

10.What is the main purpose of the Memory Management Unit (MMU) in an operating
system?
(a) Manage file systems
(b) Manage input/output devices
(c) Translate virtual addresses to physical addresses
(d) Schedule processes

Answer: (c)

11.In the context of file systems, what does RAID stand for?
(a) Redundant Array of Independent Disks
(b) Random Access and Integrated Drives
(c) Read And Index Data
(d) Remote Access and Interconnected Devices

Answer: (a)

12.What is the purpose of the 'fork()' system call in Unix/Linux?


(a) Create a new process
(b) Terminate the current process
(c) Allocate memory for a process
(d) Execute a new program

Answer: (a)

13.Which memory allocation strategy involves dividing memory into fixed-size blocks?
(a) Best Fit
(b) Worst Fit
(c) First Fit
(d) Paging

Answer: (d)
14. What is a database?

(a) A collection of organized data

(b) A software application that manages data

(c) A physical storage device for data

(d) All of the above

Answer: (d)

15. What are the three main components of a database management system (DBMS)?

(a) Hardware, software, and data

(b) Data model, schema, and instances

(c) Data definition language (DDL), data manipulation language (DML), and data control
language (DCL)

(d) All of the above

Answer: (b)

16. What is a data model?

(a) A set of rules that defines how data can be organized and stored in a database

(b) A representation of the real world in terms of data structures

(c) A description of the relationships between different types of data

(d) All of the above

Answer: (d)

17. What is a schema?


(a) The physical structure of a database

(b) The logical structure of a database

(c) A description of the tables, columns, and relationships in a database

(d) All of the above

Answer: (c)

18. What is an instance?

(a) The physical storage of a database

(b) The current state of a database

(c) A collection of data that conforms to a schema

(d) All of the above

Answer: (b)

19. What is a primary key?

(a) A unique identifier for each record in a table

(b) A foreign key that references the primary key of another table

(c) A column that contains the most important data in a table

(d) A column that is used to sort the records in a table

Answer: (a)

20. What is a foreign key?

(a) A unique identifier for each record in a table


(b) A column that references the primary key of another table

(c) A column that contains the most important data in a table

(d) A column that is used to sort the records in a table

Answer: (b)

21. What is a normalized database?

(a) A database that is free of redundancy

(b) A database that is easy to maintain

(c) A database that is efficient to query

(d) All of the above

Answer: (d)

22. What is a query?

(a) A request for data from a database

(b) A set of instructions for manipulating data in a database

(c) A statement that defines the structure of a database

(d) All of the above

Answer: (a)

23. What is a database view?

(a) A virtual table that is derived from one or more base tables

(b) A way to restrict access to data in a database


(c) A way to improve the performance of queries

(d) All of the above

Answer: (a)

24. What is the primary purpose of a data structure?

a) To perform arithmetic operations


b) To store and organize data efficiently
c) To execute conditional statements
d) To manage network connections

Answer: b) To store and organize data efficiently

25. Which data structure follows the Last In, First Out (LIFO) principle?

a) Queue
b) Linked List
c) Stack
d) Tree

Answer: c) Stack

26. In a linked list, what is the name of the element that contains data and a reference to the
next node?

a) Leaf
b) Node
c) Root
d) Branch
Answer: b) Node

27. What type of data structure is suitable for modeling hierarchical relationships?

a) Array
b) Linked List
c) Graph
d) Heap

Answer: c) Graph

28. Which data structure uses the "First In, First Out" (FIFO) principle?

a) Stack
b) Queue
c) Heap
d) Tree

Answer: b) Queue

29. What is the purpose of a hash table?

a) Sorting data
b) Efficient search and retrieval
c) Storing elements in a linear order
d) Representing hierarchical relationships

Answer: b) Efficient search and retrieval

30. Which data structure organizes elements in a binary tree with each node having at most
two children?
a) Queue
b) Heap
c) Binary Tree
d) Linked List

Answer: c) Binary Tree

31. What is the primary advantage of a heap data structure?

a) Efficient search operations


b) Constant time for element insertion
c) Ensures that the parent node has a greater value than its children
d) Follows the Last In, First Out (LIFO) principle

Answer: c) Ensures that the parent node has a greater value than its children

32. What is the primary focus of discrete structures in computer science?

a) Continuous data analysis


b) Mathematical structures that are fundamentally discrete rather than continuous
c) Physical structures in computer hardware
d) Object-oriented programming

Answer: b) Mathematical structures that are fundamentally discrete rather than


continuous

33. Which of the following is a fundamental concept in set theory?

a) Derivatives
b) Vectors
c) Sets
d) Integrals

Answer: c) Sets

34. In combinatorics, what does the term "permutation" refer to?

a) Arrangements of objects in a specific order


b) Selection of objects without considering the order
c) Combinations of objects with repetition
d) Probability of events occurring

Answer: a) Arrangements of objects in a specific order

35. What is the purpose of graph theory in discrete structures?

a) Analyzing continuous functions


b) Modeling relationships between objects
c) Solving algebraic equations
d) Designing user interfaces

Answer: b) Modeling relationships between objects

36. Which operation in Boolean algebra corresponds to logical OR?

a) Conjunction
b) Disjunction
c) Negation
d) Implication
Answer: b) Disjunction

37. What is the fundamental principle of the Pigeonhole Principle?

a) Every pigeon has a hole to live in


b) If there are more pigeons than holes, at least one hole must contain more than one pigeon
c) Pigeons and holes have no mathematical correlation
d) Pigeons and holes should be arranged in a specific pattern

Answer: b) If there are more pigeons than holes, at least one hole must contain more
than one pigeon

38. In formal logic, what does a tautology represent?

a) A statement that is always true


b) A statement that is always false
c) A statement that depends on external factors
d) A contradictory statement

Answer: a) A statement that is always true

39. Which branch of discrete structures deals with the study of counting and arrangement of
objects?

a) Set theory
b) Graph theory
c) Combinatorics
d) Number theory

Answer: c) Combinatorics
40. What is the purpose of a loop in programming?

a) To define a new data type


b) To repeat a sequence of statements
c) To perform arithmetic operations
d) To declare variables

Answer: b) To repeat a sequence of statements

41. What does the term "variable scope" refer to in programming?

a) The range of possible values a variable can have


b) The lifetime of a variable
c) The portion of code where a variable can be accessed
d) The data type of a variable

Answer: c) The portion of code where a variable can be accessed

42. In object-oriented programming, what is encapsulation?

a) Binding data and methods into a single unit


b) The process of breaking down a program into functions
c) Storing data in variables
d) Using conditional statements

Answer: a) Binding data and methods into a single unit

43. What is the purpose of a constructor in object-oriented programming?

a) To initialize the value of a variable


b) To create an instance of a class
c) To perform arithmetic operations
d) To define a loop

Answer: b) To create an instance of a class

44. In programming, what is the difference between "stack" and "heap"?

a) They are two different programming languages


b) Stack is used for dynamic memory allocation, while heap is used for function calls
c) Stack is used for function calls and local variables, while heap is used for dynamic
memory allocation
d) They are synonyms and can be used interchangeably

Answer: c) Stack is used for function calls and local variables, while heap is used for
dynamic memory allocation

45. What is polymorphism in object-oriented programming?

a) The ability of a function to call itself


b) The ability of a variable to hold different types of data
c) The ability of a class to have multiple methods with the same name but different
implementations
d) The process of converting a high-level programming language to machine code

Answer: c) The ability of a class to have multiple methods with the same name but
different implementations

46. What is the purpose of the "if-else" statement in programming?

a) To declare variables
b) To perform arithmetic operations
c) To make decisions based on conditions
d) To repeat a sequence of statements

Answer: c) To make decisions based on conditions

47. What does the term "syntax error" refer to in programming?

a) An error that occurs during runtime


b) An error in the logic of the program
c) An error in the structure of the program
d) An error caused by the user

Answer: c) An error in the structure of the program

48. What is the purpose of polymorphism in OOP?

a) To create multiple instances of a class


b) To allow a class to have multiple constructors
c) To enable a class to have multiple methods with the same name but different
implementations
d) To define private methods in a class

Answer: c) To enable a class to have multiple methods with the same name but different
implementations

49. What is a constructor in OOP?

a) A method that is automatically called when an object is created


b) A method used to destruct an object
c) A method that converts an object to a string
d) A method that is used to access private variables
Answer: a) A method that is automatically called when an object is created

50. What is the difference between an abstract class and an interface in OOP?

a) An abstract class can have method implementations, while an interface cannot


b) An interface can have instance variables, while an abstract class cannot
c) An abstract class cannot have constructors, while an interface can
d) An interface can have access modifiers, while an abstract class cannot

Answer: a) An abstract class can have method implementations, while an


interface cannot

You might also like