IDC-1 Sample QP
IDC-1 Sample QP
Note: These are sample questions which can help you to prepare well for your examinations. Do not
expect to get exactly the same questions in your final examination.
What is an algorithm?
a) Finiteness
b) Correctness
c) Efficiency
d) Complexity
Answer: d) Complexity
Explanation: A good algorithm should be finite, correct, and efficient. Complexity is often considered
undesirable because it increases time and space requirements.
a) The algorithm produces the correct output for all possible inputs
b) The algorithm works in the minimum time
c) The algorithm has the smallest possible memory usage
d) The algorithm produces a reasonable output for most inputs
Answer: a) The algorithm produces the correct output for all possible inputs
Explanation: Correctness means that the algorithm gives the expected result for all
possible valid inputs.
Explanation: Linear Search works on both sorted and unsorted data, as it checks each element one by
one.
Explanation: Binary Search is preferred for sorted data, especially when the array is large
Which of the following searching algorithms is best suited for a large dataset that is
sorted?
a) Linear Search
b) Binary Search
c) Jump Search
d) Exponential Search
Explanation: Binary Search is optimal for large, sorted datasets because it works by
halving the search space with each comparison
Which of the following searching algorithms is best suited for finding an element in
a sorted array where the element might be present at any position?
a) Linear Search
b) Binary Search
c) Jump Search
d) Interpolation Search
Explanation: Binary Search is best for sorted arrays as it efficiently finds elements by repeatedly
dividing the search range in half.
After the first pass of Bubble Sort, what happens to the largest element?
Consider the array [5, 2, 9, 1, 5, 6]. What will the array look like after the first pass
of Bubble Sort?
a) [2, 1, 5, 5, 6, 9]
b) [1, 2, 5, 5, 6, 9]
c) [5, 2, 9, 1, 6, 5]
d) [2, 5, 9, 1, 5, 6]
Answer: a) [2, 1, 5, 5, 6, 9]
Explanation: After the first pass, Bubble Sort compares adjacent elements and swaps them if they are in
the wrong order. The largest element (9) is moved to the last position.
In the worst case, how many passes does Bubble Sort take to sort an array of size n?
a) 1
b) n
c) n-1
d) n/2
Answer: c) n-1
Explanation: In the worst case, where the array is in reverse order, Bubble Sort requires n-1 passes to
sort the array.
Explanation: Space complexity refers to the amount of memory required by an algorithm to solve a
problem as a function of the size of the input.
Explanation: Algorithm analysis aims to evaluate an algorithm's efficiency in terms of time (time
complexity) and space (space complexity).
What is a stack?
Answer: b) A linear data structure that follows LIFO (Last In First Out)
Explanation: A stack follows the LIFO principle, where the last element added is the first one to be
removed.
Answer: c) The element that is currently at the highest position in the stack.
Explanation: The "top" element is the one that is most recently added to the stack, and it is the one that
will be removed next.
a) To maintain elements in a specific order and access the first element first.
b) To store elements and access them randomly.
c) To store elements and retrieve them in reverse order.
d) To store elements with a specific priority.
Explanation: The peek operation allows us to view the top element of the stack without modifying the
stack.
What is the result of calling the push operation on a stack with a full capacity?
Explanation: If a stack has a fixed capacity and is already full, calling the push operation will result in a
stack overflow condition.
If a stack is implemented using an array, what happens to the top index after a pop
operation?
a) It increases by 1.
b) It stays the same.
c) It decreases by 1.
d) It is reset to 0.
Answer: c) It decreases by 1.
Explanation: After a pop operation, the top index is decreased by 1, pointing to the next
element in the stack.
a) Push
b) Pop
c) Peek
d) Both a and b
What will happen if you call pop on a stack where the top value is the only element
left?
Explanation: Calling pop on the last element will remove the last element, making the stack empty. The
top will be null or undefined depending on the implementation.
What would the top element of the stack be after the following operations?
● Push(1)
● Push(2)
● Pop()
● Push(3)
● Pop()
a) 1
b) 2
c) 3
d) None of the above
Answer: a) 1
Explanation: After pushing 1 and 2, popping 2, pushing 3, and then popping 3, the top element will be 1,
the first element pushed into the stack.
What would the top element of the stack be after the following operations?
● Push(3)
● Push(6)
● Push(9)
● Pop()
● Push(12)
● Push(15)
● Pop()
● Pop()
a) 3
b) 6
c) 9
d) 15
Answer: b) 6
Explanation:
What would the top element of the stack be after the following operations?
● Push(8)
● Push(16)
● Pop()
● Push(24)
● Push(32)
● Pop()
● Pop()
a) 8
b) 16
c) 24
d) 32
Answer: a) 8
Explanation:
a) Machine Learning
b) Data Science
c) Quantum Computing
d) All of the above
Explanation: Machine Learning is a core branch of AI, focused on algorithms that allow computers to
learn from data and improve performance over time.
a) Neural Networks
b) Genetic Algorithms
c) Decision Trees
d) Differential Equations
Explanation: While differential equations are important in many fields, they are not specific to AI, unlike
neural networks, genetic algorithms, and decision trees.
a) Google Search
b) Self-driving cars
c) Voice assistants (like Siri or Alexa)
d) All of the above
Explanation: Google Search, self-driving cars, and voice assistants all use AI technologies to function.
a) Weak AI can perform general human tasks, while Strong AI focuses on a single task
b) Weak AI is a hypothetical concept, while Strong AI exists in the real world
c) Weak AI is designed to perform specific tasks, while Strong AI can understand and perform any
intellectual task a human can do
d) There is no difference between Weak and Strong AI
Answer: c) Weak AI is designed to perform specific tasks, while Strong AI can understand and perform
any intellectual task a human can do
Explanation: Weak AI is narrow and focused on specific tasks (like a recommendation system), while
Strong AI would possess general intelligence capable of performing any cognitive task.
Which of the following is NOT an application of AI?
a) Autonomous vehicles
b) Handwriting recognition
c) Playing chess
d) Running a washing machine
Explanation: While a washing machine may have some automated functions, it does not typically
involve AI. The other options involve AI applications.
a) Automated Intelligence
b) Artificial Intelligence
c) Algorithmic Intelligence
d) Applied Intelligence
a) Microwave oven
b) Email spam filter
c) Manual car transmission
d) Electric fan
Explanation: An email spam filter uses AI techniques to classify emails as spam or not based on patterns
in the data.
a) Calculating a sum
b) Predicting future stock prices
c) Telling time
d) Adding two numbers
Explanation: AI can perform a wide range of tasks, such as understanding language, recognizing images,
and playing games like chess.
Explanation: AI is used in agriculture for a variety of tasks, including predicting soil moisture levels,
sorting produce, and detecting pests and diseases in crops.
a) Smart notebooks
b) Virtual assistants
c) AI-powered educational robots
d) AI-based student portals
Answer: b) Virtual assistants
Explanation: AI-powered virtual assistants can provide one-on-one tutoring or mentorship, offering
personalized assistance and answering student queries in real-time.
Explanation: AI can help teachers automate the grading of assignments, including multiple-choice
questions and essays, saving time and providing instant feedback.
How can AI help in identifying students who may need additional support?
Explanation: AI can analyze students' academic performance data to identify those who may be
struggling and need additional support or intervention
a) Data that is too large and complex to be processed by traditional data processing tools
b) Data that can be easily stored and retrieved from any database
c) Data that is structured and fits neatly into relational databases
d) Data that only exists in physical form
Answer: a) Data that is too large and complex to be processed by traditional data processing tools
Explanation: Big Data refers to data sets that are so large and complex that they require advanced tools
and technologies to process, store, and analyze.
a) Volume
b) Variety
c) Velocity
d) All of the above
Explanation: The key characteristics of Big Data are the Volume (amount of data), Variety (types of
data), and Velocity (speed at which data is generated and processed).
a) Emails
b) Customer names and addresses in a relational database
c) Social media posts
d) Video files
Explanation: Structured data is highly organized and typically stored in relational databases. It fits neatly
into tables with rows and columns.
Explanation: Unstructured data does not follow a specific format or structure, such as social media posts,
images, and videos, which can be challenging to analyze using traditional methods.
What is a common use case for Big Data in the healthcare industry?
Explanation: Big Data is widely used in healthcare to analyze large datasets, including patient records,
genetic data, and treatment outcomes, to provide personalized care and improve patient outcomes.
Which of the following is the best definition of the "Volume" characteristic in Big
Data?
Explanation: "Volume" refers to the vast amount of data generated by organizations, which can range
from terabytes to petabytes of data.
Answer: c) The various forms and types of data, such as structured, semi-structured, and unstructured
Explanation: "Variety" in Big Data refers to the diversity of data types, including structured,
semi-structured, and unstructured data from various sources like social media, videos, and sensor data.
Explanation: "Velocity" refers to the rate at which data is generated, collected, and processed. It involves
real-time or near real-time data processing.
Which of the following Big Data characteristics helps organizations to gain insights
from both structured and unstructured data?
a) Volume
b) Variety
c) Velocity
d) Veracity
Answer: b) Variety
Explanation: Variety refers to the different forms of data, such as text, images, videos, and sensor data,
which can all be analyzed for insights.
a) It has a fixed and inflexible structure, requiring manual updates to adapt to new data
b) It is highly flexible and can easily accommodate different types of data formats
c) It has no structure and cannot be processed by traditional tools
d) It is highly structured and can only store one type of data format
Answer: b) It is highly flexible and can easily accommodate different types of data formats
Explanation: Semi-structured data is flexible because it does not follow a rigid schema and can handle a
variety of formats
Answer: c) Structured data has a fixed schema, while semi-structured data does not have a rigid schema
Explanation: Structured data follows a strict schema (like relational databases), while semi-structured
data lacks a rigid schema but may contain organizational elements like tags
Explanation: Semi-structured data includes elements such as tags or key-value pairs, which help to
organize the data, though it does not strictly conform to a relational schema.
Answer: c) Data that does not conform to a strict schema but contains tags or markers to separate
elements
Explanation: Semi-structured data is flexible and can accommodate different data formats, making it
easier to integrate diverse types of data, unlike structured data that requires consistency in format.
a) var = 10
b) variable := 10
c) int var = 10
d) let var = 10
Answer: a) var = 10
Explanation: In Python, variables are declared simply by assigning a value to them. Python does not
require explicit type declaration.
print(5 ** 2)
a) 25
b) 52
c) 10
d) Syntax error
Answer: a) 25
Explanation: The ** operator in Python is used for exponentiation. Therefore, 5 ** 2 results in 25.
x = [1, 2, 3]
x.append(4)
print(x)
a) [1, 2, 3]
b) [1, 2, 3, 4]
c) (1, 2, 3, 4)
d) Error
Answer: b) [1, 2, 3, 4]
a) for i in range(5):
b) for (i = 0; i < 5; i++):
c) for i: range(5)
d) for i in 5:
Explanation: Python uses the for keyword and the range() function to iterate over a sequence of
numbers.
b = "World"
a) HelloWorld
b) Hello World
c) Hello + World
d) Error
Explanation: The + operator in Python is used to concatenate strings. Adding a space between a and b
results in "Hello World".
Which of the following methods is used to get the length of a list in Python?
a) length()
b) size()
c) len()
d) count()
Answer: c) len()
Explanation: The len() function is used to get the number of items in a list or other iterable in Python.
a) min()
b) lowest()
c) smallest()
d) min_value()
Answer: a) min()
Explanation: The min() function returns the smallest item from an iterable such as a list.
Explanation: The input() function is used to take input from the user in Python, typically as a string.
y = x
y[0] = 50
print(x)
Explanation: In Python, when a list is assigned to another variable, both variables refer to the same
object in memory. Modifying y also affects x.
python
Copy code
print(i)
a) 5 3
b) 5 3 1
c) 1 3 5
d) 5 4 3 2 1
Answer: a) 5 3
Explanation: The range(5, 1, -2) generates numbers starting from 5 and decrementing by 2 each
time, resulting in 5 and 3.
Answer: c) They can iterate over any iterable object, not just lists.
Explanation: In Python, for loops can iterate over any iterable object, including lists, tuples, strings,
dictionaries, and sets.
a) 10 9 8 7 6
b) 10 9 8 7 6 5
c) 5 6 7 8 9 10
d) 10 9 8 7 6 5
Answer: a) 10 9 8 7 6
Explanation: The range(10, 5, -1) generates numbers starting from 10 and decrementing by 1
each time until it reaches 6 (not including 5).
Answer: a) 2 4 6 8
Explanation: The range(2, 10, 2) generates even numbers starting from 2 up to but not including
10. The output will be 2 4 6 8.
print(i)
a) 2 3 4 5
b) 1 2 3 4 5
c) 2 3 4 5 6
d) 2 3 4
Answer: a) 2 3 4 5
Explanation: The range(2, 6) generates numbers from 2 to 5 (inclusive of 2 and exclusive of 6).