0% found this document useful (0 votes)
22 views71 pages

Cs Topper Module

The document contains a series of multiple-choice questions focused on exception handling in Python, covering topics such as syntax errors, types of exceptions, and the use of try-except blocks. It tests knowledge on how exceptions are raised, caught, and managed within Python programming. The questions also explore the purpose of specific keywords and constructs related to exception handling.

Uploaded by

khanumayesha566
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views71 pages

Cs Topper Module

The document contains a series of multiple-choice questions focused on exception handling in Python, covering topics such as syntax errors, types of exceptions, and the use of try-except blocks. It tests knowledge on how exceptions are raised, caught, and managed within Python programming. The questions also explore the purpose of specific keywords and constructs related to exception handling.

Uploaded by

khanumayesha566
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Karnataka Residential Educational Institutions Society

SUBJECT : COMPUTER SCIENCE (41)

CHAPTER-1 EXCEPTION HANDLING IN PYTHON


I Select the correct answer from the choices given:
1) In the following Python code, what is the syntax error? if
x = = 10
print(“x is 10”)
a) The colon (:) is missing before the print statement.
b) The condition has a missing parentheses.
c) The colon (:) is missing after the if condition.
d) The colon (:) is missing after the print statement.
2) What is an exception in programming?
a) A type of error that occurs during the execution of a program
b) A warning message displayed after execution.
c) A successful execution of a conditional statement
d) A special type of loop in programming
3) What is an exception in Python?
a) A Python object that represents a successful program execution
b) A Python object that represents an error
c) A built-in function used for debugging
d) A type of variable in Python
4) What happens when an error occurs during the execution of a Python program?
a) The program continues executing as normal
b) it automatically recompile the program
c) An exception is raised
d) The program runs a default error message and continues
5) Why should exceptions be handled in Python?
a) To ensure that errors are ignored
b) To make the program run faster
c) To prevent the program from terminating abnormally
d) To execute the program without error.
6) What does the keyword do in an exception block ?
a) It raises the exception.
b) It assigns the exception object to a variable.
c) It catches the exception and terminate the program
d) It creates a custom except for class
7) What is the effect of using try-except blocks in Python?
a) It prevents the program from terminating abruptly.
b) It helps in performing automatic type casting.
c) It can only handle syntax errors.
d) It optimizes the program execution speed.
8) What type of error does Python raise when a function receives an argument of the correct type but
inappropriate value?
a) KeyboardInterrupt
b) ValueError
c) TypeError
d) NameError
9) Which exception is raised when the file specified in a program statement cannot be opened ?
a) IOError b) EOFError c)IndexError d) Value error
10) Which exception is raised when the requested module definition is not found ?
a) FileNotFoundError b) ImportError c) SyntaxError d) ModuleNotFound
11) Which exception is raised when the end of file condition is reached without reading any data by
input()?
a) EOFError b) ImportError c) SyntaxError d) Value error
12) Which exception is raised when a division by zero operation is performed?
a) ZeroError b) TypeError c) DivisionError d) ZeroDivisionError
13) Which exception is raised when an index is out of range in a sequence?
a) KeyError b) ValueError c) IndexError d) TypeError
14) Which exception is raised when a local or global variable name is not defined?
a) Import Error b) NameError c) Syntax error d) Value Error
15) Which exception is raised due to incorrect indentation in the program code ?
a) ImportError b)AssertionError c) IndexError d) IndentationError
16) Which exception is raised when an operation or function is applied to an object of inappropriate data
type?
a) TypeError b) NameError c) OverflowError d) SyntaxError
17) Which built-in exception is raised when a file is not found?
a) FileNotFoundError b) IOError c) NameError d) TypeError
18) What is the purpose of the raise statement in Python?
a) To raise the program‟s execution to a higher point in the code.
b) To terminate the program
c) It can be used to throw an exception.
d) To end the program execution.
19) Which of the following is the correct syntax for raising an exception in Python?
a) throw Exception(„Error message‟) b) raise Exception(„optional argument‟)
c) raise „Error message‟ d) raise exception(„Error message‟)
20) What is a syntax error in Python?
a) An error related to the logical flow of the program.
b) An error in the logic of the program
c) An error that occurs when the rules of the programming language are not followed.
d) An error that occurs only during runtime.
21) What type of error is raised when you forget to close a parentheses in Python?
a) SyntaxError b) ValueError c) TypeError d) RuntimeError
22) What is another name for a syntax error in programming?
a) Runtime error b) Parsing error c) Logical error d) Exception error
23) What happens when a syntax error is encountered in Python?
a) The program executes
b) The program stops execution until the error is fixed.
c) The program runs slower.
d) The interpreter tries to correct the error automatically.
24) Which of the following is an example of a syntax error in Python?
a) Using a variable without declaring it first.
b) Forgetting to close a parenthesis in a function call.
c) Using the wrong type of operator.
d) Calling a function with the wrong number of arguments.
25) How does Python handle a program with a syntax error?
a) Python shows a warning but continues execution.
b) Python shows an error message and stops execution until the error is fixed.
c) Python prompt user to correct interactively
d) Python ignores the error and runs the program.
26) Identify the error the following programming segment If
marks >20 :
print “Good Score”
a) RuntimeError b) LogicalError c) KeyboardError d) SyntaxError
27) Which exception is raised when not followed rules of Python language?
a) IndentationError b) SyntaxError c) NameError d) ValueError
28) Which of the following is a valid example of a syntax error in Python?
a) print(“Hello World) b) if x = 5:
c) def my function(): d) All of these
29) What will happen if a try block contains a raise statement but there is no corresponding except block?
a) The program will ignore the raised exception and continue.
b) The program will terminate with a traceback error.
c) The program will automatically catch the exception and continue.
d) The program will raise a new exception automatically.
30) What happens if an exception is raised inside a try block, but no except block is present to catch it?
a) It call the else block
b) The program terminates with an error
c) The exception is caught by the raise statement
d) The program moves to the else block
31) What is the purpose of the else block in a try-except-else statement?
a) To handle exceptions that occur in the try block.
b) To run code when no exception occurs in the try block.
c) To execute code after the exception is raised.
d) To finalize code after all exceptions are handled.
32) Which of the following is used to handle exceptions in Python?
a) catch b) exception c) try - except d) throw
33) In which block is the exception actually thrown?
a) try b) catch c) finally d) exception
34) What will happen if an exception is raised but not caught in a try-except block?
a) The program will continue without interruption.
b) The program will terminate and display the traceback.
c) The program will ignore the exception and continue execution.
d) The program will prompt the user to handle the exception.
35) Which of the following will be executed if an exception is thrown and not caught?
a) The program terminates immediately b) The else block executes
c) The finally block executes d) Program continuous with next statement
36) Which of the following statements about the finally block is true?
a) It will be executed only if an exception is raised.
b) It will not be executed if an exception is raised.
c) It will be executed whether or not an exception is raised.
d) It will not be executed if there is no exception.
37) Which of the following is true about exception handling?
a) It is only useful for debugging purposes
b) It makes the program slower by introducing additional checks
c) It allows the program to continue execution even when an error occurs
d) It is not necessary in programs with few errors
38) What is the purpose of a finally block in exception handling?
a) It is used to define the exception
b) It always executes, regardless of whether an exception was thrown or not
c) It prevents the exception from being thrown
d) It rethrows the exception after handling
39) What is the role of the finally block in exception handling?
a) To execute code after the exception is caught, regardless of whether an exception occurred
b) To throw exceptions
c) To catch exceptions
d) To terminate the program
40) What is the primary purpose of the finally clause in Python?
a) To handle specific exceptions b) To catch all exceptions automatically
b) To ensure that code runs regardless of whether an exception occurs
c) To define the starting point of the program
d) What happens if an exception is raised in the finally block?
e) The exception is ignored. b) The exception is logged for further analysis.
f) The exception is re-raised and the program terminates.
g) The exception is caught in the except block.
41) Which keyword is used to raise (throw) an exception in Python?
a) catch b) throw c) raise d) except
42) What happens when an exception is raised in Python?
a)The program immediately terminates b) The exception is passed silently
43) What is the primary purpose of the assert statement in Python?
a) To catch exceptions during program execution.
b) To define functions for debugging.
c) To test if a condition is true and raise an exception if it is false.
d) To handle errors in user input.
44) Which statement is used in python to raise an exception manually ?
a) assert b) raise c) throw d) catch
45) Which of the following is the correct syntax for using an assert statement?
a) assert condition: b) assert expression[arguments]
c) assert(condition) d) assert: condition
46) What type of exception is raised when an assertion fails in Python?
a) TypeError b) ValueError c) IndexError d) AssertionError
47) What is the primary purpose of exception handling in programming?
a) To make the code run faster b) To manage runtime errors gracefully
c) To make code more complex d) To reduce the size of the program
48) What is the main reason for using exception handling in programming?
a) To automatically fix errors
b) To manage unexpected errors and maintain program flow
c) To prevent syntax errors
d) To terminate program abruptly
49) What does the Python interpreter do when an error occurs during program execution?
a) It stops the program without any notification b) It creates an exception object
c) It deletes all variables d) It restarts the program
50) What is the process called when an exception object is created and handed over to the runtime system
for handling?
a) Handling an exception b) Catching an exception
c) Throwing an exception d) Ignoring an exception
51) What does the runtime system search for when an exception is raised?
a) The variable that caused the exception
b) The source code file where the exception occurred
c) A block of code called the exception handler that can handle the exception
d) The compiler directives related to the exception
52) What is the name of the block of code that handles exceptions raised during program execution?
a) Error block b) Catch block
c) Exception handler d) Runtime block
53) Which of the following statements is true about using multiple except blocks in Python?
a) Only one except block is allowed per try block.
b) Multiple except blocks can be used to handle different exceptions separately.
c) Multiple except blocks can be used, but only the last one is executed.
d) All except blocks are executed in sequence when an error occurs.
54) What will happen if an exception is raised inside the else block of a try-except-else structure?
a) The exception will be caught by the except block.
b) The program will terminate immediately.
c) The exception will be ignored, and the code will continue execution.
d) The exception will not be caught and will propagate outside the block.
55) Which of the following is true about the else block in Python exception handling?
a) It is executed if an exception is raised in the try block
b) It is executed only if no exception occurs in the try block
c) It is always executed, regardless of exceptions
d) it is used to define an alternate block
56) Which Python keyword is used to handle exceptions?
a) finally b) identifier c) catches d) except
57) Which of the following keywords are not specific to exception handling?
a) Try b) except c) else d) finally
c) The exception is propagated and can be caught in a try-except block
d) The program prints a debug message and continues execution
58) Which of the following statements is true about the raise keyword?
a) It can only be used within a function
e) It can be used to throw both predefined and custom exceptions
b) It is used to handle exceptions d) It is used to catch exceptions
59) If an exception is raised and not caught within the current function, what happens?
a) The program terminates immediately
f) The exception is passed to the next function call in the call stack
b) The exception is silently ignored d) The program automatically corrects the error
60) Assertion : Zero Division Error is raised when a number is divided by zero.
Reason (R): Division by zero is undefined in mathematics and therefore not allowed in Python.
a) Both A and R are true, but R is not the correct explanation of A
b) A is true, but R is false c) A is false, but R is true
d) Both A and R are true, and R is the correct explanation of A
61) Assertion:TypeError is raised when an operator is supplied with a value of incorrect data type.
Reason (R): Trying to concatenate a string and an integer without conversion causes a TypeError.
a) Both A and R are true, and R is the correct explanation of A
b) Both A and R are true, but R is not the correct explanation of A
c) A is true, but R is false d) A is false, but R is true
62) Assertion : ValueError is raised when a function receives a value of the correct data type but
inappropriate value.
Reason (R): Converting a non-numeric string to an integer using int("abc") raises a ValueError.
a) Both A and R are true, and R is the correct explanation of A
b) Both A and R are true, but R is not the correct explanation of A
c) A is true, but R is false d) A is false, but R is true
63) Assertion :IndexError occurs when trying to access an index that is out of the range of a list.
Reason (R): Lists in Python start indexing from 1.
a) Both A and R are true, and R is the correct explanation of A)
b) Both A and R are true, but R is not the correct explanation of A)
c) A is true, but R is false. d) A is false, but R is true.
64) Assertion : Each time an error is detected in a program, the Python interpreter raises an exception.
Reason (R): Exception handlers are designed to execute when a specific exception is raised.
a) Both A and R are true, and R is the correct explanation of A.
b) Both A and R are true, but R is not the correct explanation of A.
c) A is true, but R is false. d) A is false, but R is true.
65) Assertion : Programmers can only raise exceptions using the raise statement in Python.
Reason (R): The assert statement can also be used to forcefully raise exceptions in Python.
a) Both A and R are true, and R is the correct explanation of A.
b) Both A and R are true, but R is not the correct explanation of A.
c) A is false, but R is true. d) A is true, but R is false.
66) Assertion : The raise statement can be used to throw an exception in Python.
Reason (R): The raise statement is used only for handling exceptions that are caught by the try-except
block.
a) Both A and R are true, and R is the correct explanation of A.
b) Both A and R are true, but R is not the correct explanation of A.
c) A is true, but R is false. d) A is false, but R is true.
67) Assertion : An assert statement in Python is used to test an expression in the program code. If the
result is false, an AssertionError is raised.
Reason (R): The assert statement is generally used at the beginning of a function or after a function
call to check for valid input.
a) Both Assertion and Reason are true, and Reason is the correct explanation of Assertion.
b) Both Assertion and Reason are true, but Reason is not the correct explanation of Assertion.
c) Assertion is true, but Reason is false. d) Assertion is false, but Reason is true.
68) Assertion :Each and every exception has to be handled by the programmer to avoid the program
from crashing abruptly.
Reason (R): This is done by writing additional code in a program to give proper messages
a) Both A and R are true, and R is the correct explanation of A.
b) Both A and R are true, but R is not the correct explanation of A.
c) A is true, but R is false. d) A is false, but R is true.
69) Assertion : In Python, the else block in a try...except...else construct is executed only when no
exception is raised in the try block.
Reason (R): The except block runs only if an exception occurs in the try block; otherwise, the control
moves to the else block if it exists.
a) Both A and R are true, and R is the correct explanation of A
b) Both A and R are true, but R is not the correct explanation of A
c) A is true, but R is false
d) A is false, but R is true
CHAPTER-2 FILE HANDLING IN PYTHON
I Select the correct answer from the choices given:
1) The files are stored permanently in a computer system on
a) Random Access Memory b) Cache Memory
c) CPU d)Secondary storage media
2) Which of the following file extensions is used for plain text files?
a) .exe b) .txt c) .jpg d) .mp3
3) The following device is used to store data permanently entered in Python program
a) Primary storage b) Non-volatile Memory
c) Temporary storage d) Secondary storage devices
4) Which of the following is data file ?
a) computer file b) meta file c)image file d) text file and binary file
5) Computers store every file as a collection of
a) 0‟s and 1‟s b) 0‟s and 2‟s c) 0‟s and 9‟s d) ASCII
6) Each line of a text file is terminated by a special character
a) EOS b) EOP
c) EOF d) EOL
7) Document created in notepad is an example of
a) Text file b) Binary file c) Word file d) system file
8) The default EOL character in Python is
a) \k b) \v c) \b d) \n
9) What is the primary purpose of file handling in Python?
a) To process data faster b) To store data temporarily
c) To permanently store data and output for reuse
d) To display output on the screen
10) The following file can be understood as a sequence of characters consisting of alphabets, numbers and
other special symbols.
a) Text file b) binary file c) numeric file d) alphabets file
11) What happens if you try to open a binary file in a text editor?
a) The text editor will display the file‟s content in ASCII format.
b) The text editor will show the file as a series of 0s and 1s.
c) The text editor will display garbage values.
d) The text editor will read the file successfully if it is an image.
12) Which of the following is the correct syntax to open a file in Python?
a) fobj=open(“filename”, accessmode) : b) fileobj = open(filename, accessmode)
c) open=file(“[Link]”, “accessmode”) d) [Link](“filename”)

13) What type of software is required to view or modify the contents of a binary file?
a) Text editor b) Any word processor
c) Spread sheet application d) Specific software designed for handling binary files
14) Binary files are also stored in terms of
a) 0‟s and 1‟s b) 0‟s and 2‟s c) 0‟s and 9‟s d) ASCII
15) Which function in Python is used to open a file for writing data?
a) [Link]() b) open() c) openfile() d) write()
16) How are binary files stored in a computer?
a) As sequences of words. b) As sequences of bytes.
c) As sequences of characters. d) As a sequence of symbols.
17) What does the <file>.mode attribute return in Python?
a) The name of the file
b) The current file pointer position
c) The access mode in which the file was opened
d) The contents of the file
18) Which of the following access modes opens a file for reading only?
a) r b) w b) r+ d) a
19) Which mode is used to Opens the file in read-only mode in python ?
a) <r+> b) <w> c) <a> d) <r>
20) Which mode is used to Opens the file in binary and read-only mode ?
a) <rb> b) <wb> c) <ab> d) <rb+>
21) Which of the following modes allows you to open a file for both reading and writing?
a) <r+> b) <a+) c) <wb+> d) <a+>
22) In Python, what happens when the file you are trying to open in write mode („w‟) does not exist?
a) An error is thrown. b) A new empty file is created.
c) A new empty file is not created. d) Nothing happens.
23) In Python, when you open a file in „w‟ mode, what happens to the file if it already exists?
a) The file will be overwritten with the new data
b) The file will remain unchanged
c) A new file will be created and the data will be written into it
d) Python will raise an error
24) What does the mode „w‟ do when opening a file in Python?
a) Opens the file for reading only
b) Opens the file for writing and creates the file if it doesn‟t exist
c) Opens the file for both reading and writing
d) Opens the file for appending data
25) Which of the following file modes in Python is used to open a file for appending data without
overwriting the existing content?
a) <r> b) <w> c) <a> d) <x>
26) Which of the following file modes in Python is used to open a file for appending data overwriting the
existing content?
a) <r> b) <w> c) <a> d) <x>
27) The following file modes in Python is used to Opens the file in append and read mode.
a) <r> b><w+> c) <r+> d) <a+>
28) What is the purpose of the close() function in Python file handling?
a) To save data to the file
b) To stop reading data from the file
c) To ensure that the file is closed after reading or writing
d) To open a file for further reading or writing
29) When using the with statement to open a file, what happens when the block inside with is exited?
a) The file must be closed manually. b) The file is automatically closed.
c) The file is closed only if there‟s an error. d) The file remains open until the program ends.
30) After opening a file with the open() function, how do you close the file to free up resources?
a) file_object.close() b) file_object.end() c) file_object.finish() d) file_object.closefile()
31) The correct syntax of file close is
a) file(close) b) [Link]() c) [Link]( ) d) close(file)
32) Which of the following is the correct syntax to open a file in write mode?
a) obj=open(“[Link]”, „r‟) b) obj=open(“[Link]”, „w‟)
c) obj=open(“[Link]”, „rw‟) d) obj=open(“[Link]”, “x”)
33) What does the write() method return ?
a) Writing is successful b) It does not return the number of characters
c) The number of characters written d) Return file object
34) What does the writelines() method return ?
a) Writtern only binary digits b) The number of characters read
c) The number of characters written d) It does not return the number of characters
35) Which of the following method is used to write multiple strings to a file.
a) write() b) writing() c) writestring() d) writelines()
36) What does the read() method do in Python?
a) It reads only the first line b) Reads a specified number of bytes from a file
c) Reads a single line from a file d) Write a specified number of bytes from a file
37) Which of the following is true about the read() method without any arguments?
a) It reads only the first line b) It reads a fixed number of characters
c) It reads the entire file d) It throws an error
38) What does the readlines() method do in Python?
a) Reads the entire file as a single string
b) Reads the file in all the lines and returns a list of lines
c) Reads the first line of the file
d) Reads all lines and prints them
39) Which of the following statements is TRUE regarding the readline() method?
a) It can be used to read a specific number of bytes from the file.
b) It only reads the first line of a file regardless of the value of n.
c) It reads the file until the newline character is reached, then stops.
d) It modifies the content of the file while reading it.
40) Which method returns the current position of the file object in python ?
a) [Link]() b) [Link]() c) [Link]() d) [Link]()
41) If you want to move the file pointer to a specific position, which method should be used in
combination with tell()?
a) seek() b) open() c) read() d) close()
42) What will happen if you call writelines() on an empty list?
a) It will raise an exception. b) It will write an empty line to the file.
c) It will not write anything to the file. d) It will overwrite the file with an empty string.
43) If you want to read a file line by line in Python, which of the following would you use?
a) [Link]() b) [Link]() c) [Link]() d) [Link]()
44) What is the primary purpose of Pickle in Python?
a) To store Python objects in a human-readable format
b) To compress Python objects to save space
c) To serialize and store Python objects for later retrieval
d) To perform mathematical operations on Python objects
45) Which of the following modules is used to serialize and deserialize Python objects?
a) json b) pickle c) os d) sys
46) Which of the following types of objects can be serialized using Pickle?
a) Lists b) Tuples c) Dictionaries d) All of these
47) What is the primary purpose of the dump() method in Python?
a) To convert a Python object into a string
b) To convert Python object into a binary format for saving to a file
c) To save the state of a Python object as text data
d) To deserialize a Python object from a binary file
48) Which module provides the dump() method to serialize objects in Python?
a) pickle b) json c) marshal d) os
49) In which case would you need to use the dump() method?
a) When you want to convert a binary file into a text file
b) When you need to store Python objects in a binary file
c) When you want to retrieve Python objects from a file
d) When you are reading a file‟s content line by line
50) What is the correct syntax for using the dump() method?
a) dump(data_object, file_object) b) dump(file_object, data_object)
c) file_object.dump(data_object) d) data_object.dump(file_object)
51) In the context of Pickling, what does the term “serializing” mean?
a) Making an object immutable
b) Converting an object into a byte stream for storage
c) Encrypting an object to prevent unauthorized access
d) Changing the type of an object for easier storage
52) Which of the following functions does Pickle provide for saving an object to a file?
a) [Link]() b) [Link]() c) [Link]() d) [Link]()
53) Which of the following functions does Pickle provide for loading a saved object from a file?
a) [Link]() b) [Link] ()
c) [Link]() d) [Link]()
54) In the Pickling process, which term refers to reading a serialized object from a file and restoring it to its
original state?
a) Serialization b) Deserialization c) Encryption d) Compression
55) What does the flush() method do when used with file handling in programming?
a) Closes the file immediately“ b) Clears the buffer and writes the contents to the file
c) Deletes the file contents permanently d) Opens the file for writing

II Fill in the blanks


1) Secondary storage media are used to permanently store data for later access in (Solid State Drive)
2) A file is a named location on storage media where data is permanently stored. (Secondary)
3) A text file consists of readable characters. (human)
4) Text files store data using bytes for schemes. (ASCII)
5) The system frees the memory allocated to it using the method. (close())
6) The method is used to read a specified number of bytes of data from a data file. (read())
7) The method reads all the lines and returns the lines along with newline character as a list of
strings. (readlines())
8) The method reads one complete line from a file. (readline())
9) Each program is stored on the secondary device as a (file)
10) Each line of a text file is terminated by a special character, called End of Line (EOL).
11) The method writes a single string to a file. (write)
12) The method writes multiple strings to a file. (writelines)
13) The default End of line character is python is (\n)
14) The Python function used to open a file for writing data is . (open())
15) The write() method is used to write a to a file in Python. (string)
16) The writelines() method is used to write strings to a file (multiple)
17) To serialize and deserialize Python objects is used module. (pickle)
18) To convert (pickle) Python objects for writing data to a binary file, the method is used.
(dump())
19) To load (unpickling) data from a binary file, the method is used (load)
20) The method is used to return the current position of the file pointer in Python. (tell())
21) The method is used to position the file object at a particular position in a file. (seek())
22) To create a text file, we use the method (open())
23) To clear the buffer and write the contents to the file, we use the method (flush())
CHAPTER-3 STACKS

1. A mechanism to store, organize and access data along with operations that can be efficiently
performed on the data is
a) datatype b) data structure c) data list d) data collection
2. Which of the following an example of a data structure?

a) print b) string c) function d) for loop


3. What type of data structure is string?

a) It contains sequence of characters

b) It contains sequence of integers

c) It is non linear data structure

d) It contains elements with mixed datatype.


4. A data structure that contains sequence of elements where each character is

a) int b) float c) list d) string


5. A sequence data structure in which each element may be of different types is

a) int b) float c) list d) string


6. LIFO stands for

a) Last in Front Out

b) Left In First Out

c) Last In First Out

d) Last In Forward Out


7. Which data structure follows Last-In-First-Out principle?

a) Queue b) Stack c)Deque d) integer


8. The principle of stack is

a) FILO b) LILO c) FIFO d)LIFO


9. Stack implements which of the following arrangement

a) FILO b) LILO c) FIFO d) LIFO


10. Which of the following is the application uses LIFO principle
a) Confirmation of train ticket is in waiting list
b) Calling customer service centre through IVRS, waiting till a support person is available

c) Sending print commands from multiple files using shared printer.

d) Bangles worn on wrist


11. Which of the following statement is correct about stack?

a) Addition of new element is from front , removal of existing element is from rear end

b) Addition of new element is from rear, removal of existing element is from front end

c) Addition of new element and removal of existing element happens from middle.

d) Addition of new element, removal of existing element takes place at same end TOP.
12. Which statement is not correct about stack?

a) Stack is a linear data structure

b) Stack does not follow LIFO rule

c) PUSH operation may result into overflow condition

d) Stack is used to reverse a string


13. The arrangement of elements in linear order where adding new elements or removal of existing
elements take place from the same end
a) Stack b) Queue c) Deque d) Deck
14. In stack data structure, from which end does addition of new elements and removal of existing
elements take place?
a) END b) TOP c) REAR d) TAIL
15. The fundamental operations performed on the stack are

a) insert,delete b) push,pop c) push,delete d) insert,pop


16. Which operation adds a new element to the TOP of the stack?

a) Push b) Pop c) Peek d) insert


17. Addition of new element at the TOP of the stack is called

a) Push b) Peek c) Pop d) overflow


18. Which operation is used to remove an element from the Top of the stack?

a) Push b) Pop c) Peek d) Is Empty


19. Removal of existing element from TOP of the stack is called as

a) push b) peek c) pop d) overflow


20. Trying to add an element to a full stack results in which exception?

a) overflow b) underflow c) peek d) empty stack


21. Trying to delete an element from an empty stack results in an exception called

a) overflow b) peek c) underflow d) full stack


22. Which exception will occur when trying to add an element to a full stack?
a) overflow b) underflow c) peek d) empty stack
23. Which exception will occur when trying to remove an existing element from an empty
stack?
a) overflow b) underflow c) peek d) full stack
24. Which datatype is used to implement stack in python?

a) string b) int c) float d) list


25. Which built-in method is used to insert a new element to Top of the stack in python?

a) insert b) add c) append insert


26. Which built-in method is used to remove an existing element from the stack in python?

a) pop b) delete c) free d) remove


27. Which of the following operation can result in stack overflow exception?

a) Trying to add an element to a full stack

b) Trying to add an element to an empty stack

c) Trying to delete an element from an empty stack

d) Trying to delete an element from full stack


28. Which of the following operation can result in stack underflow exception?

a) Trying to add an element to a full stack

b) Trying to add an element to an empty stack

c) Trying to delete an element from an empty stack

d) Trying to delete an element from a full stack


29. In which condition, stack overflow exception occurs?

a) Stack is full and append() is called

b) Stack is empty and append() is called

c) Stack is full and pop() is called

d) Stack is empty and pop() is called


30. In which condition stack underflow exception occurs?

a) Stack is full and append() is called

b) Stack is empty and append() is called


c) Stack is full and pop() is called

d) Stack is empty and pop() is called


31. If elements 10, 20,30,40 are inserted to the stack ,Which is the correct order in
which elements are popped?
a) 10,20,30,40 b) 20, 30,40,10 c) 30,40,10,20 d) 40,30,20,10
32. Which data structure is used to convert an expression in postfix notation?

a) queue b) stack c) deque d) string


33. Which built-in methods are used for implementing stack data structure in python?

a) push,pop b) insert,delete c) append,pop d) append,remove


34. Who introduced a different way of representing arithmetic expression called polish
notation?
a) Charles Babbage b) Dennis Richtie c) Ken Thompson d) Jan Lukasiewicz
35. Multiple chairs in a vertical pile is an application of which data structure?

a) Stack b) Queue c) String d) List


36. Which data structure is used to convert an infix expression to postfix?

a) Stack b) Queue c) String d) List


37. Which data structure is used to handle matching of parentheses in arithmetic expression?

a) Stack b) Queue c) String d) List


38. Which data structure is used to convert an infix expression to postfix or prefix
expression?
a) Stack b) Queue c) String d) List
39. Which rule is used to evaluate an infix expression?

a) BODMAS b) FIFO c) LIFO d) LILO


40. In which notation operators are written before their operands?

a) infix b) polish c) reverse polish d) postfix

41. The other name of prefix notation is

a) infix notation b) suffix notation

c) polish notation d) reverse polish notation


42. The other name of postfix notation is

a) infix notation b) polish notation

c) reverse polish notation d) suffix notation


43. The other name of polish notation is

a) infix notation b) prefix notation

c) postfix notation d) suffix notation


44. The other name of reverse polish notation is

a) infix notation b) prefix notation

c) postfix notation d) none of these


45. X+Y, Which representation is followed in the given expression

a) infix b) postfix c) polish d) prefix


46. The prefix notation of x+y is

a) xy+ b) (x+y) c) +xy d) (xy+)


47. The postfix notation of x*y is

a) xy* b)(*xy) c) *xy d) (x*y)


48. Evaluate the following postfix expression and find the result of 78*+2

a) 56 b) 112 c) 23 d) 65
49. Assertion: Stack follows the Last-In-First-Out

Reason (R): The new element is added and an existing element is removed from the same end

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


50. Assertion: Stack follows the FIFO order

Reason (R): In stack a new element is added and an existing element is removed from the one
end only
a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


51. Assertion: Stack follows the First-In-First-Out principle

Reason (R): The new element is added and an existing element is removed from the same end

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


52. Assertion:Stack data structure is used to reverse a string

Reason(R): The principle of stack is LIFO

a) A is true, R is correct reason

b) A is true, R is not correct reason


c) A is false, R is correct reason

d) A is false, R is not correct reason


53. Assertion: Stack data structure is used to reverse a string

Reason (R): The new element is added and an existing element is removed from the same end

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


54. Assertion:Stack data structure is used to reverse a string

Reason(R): The principle of stack is FIFO

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


55. Assertion:Stack data structure is used to redo/undo editing of text /image in text / image editor
Reason(R): The principle of stack is FIFO

a) A is true, R is correct reason

b) A is true, R is not correct reason


c) A is false, R is correct reason

d) A is false, R is not correct reason


56. Assertion: Stack data structure is used to redo/undo editing of text/image in text / image editor
Reason(R): The principle of stack is LIFO

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


57. Assertion: Stack data structure is used to maintain the history of browsed pages
Reason(R): The principle of stack is LIFO

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason


d) A is false, R is not correct reason
58. Assertion: Stack data structure is used to maintain the history of browsed pages
Reason(R): The principle of stack is FIFO

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


59. Assertion: Stack follows LIFO rule
Reason(R): Insertion and deletion takes place at different ends.

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


60. Assertion: Stack data structure is used in accessing link of the last visited webpage.
Reason(R):The ordering principle is FIFO

a) A is true, R is correct reason

b) A is true, R is not correct reason


c) A is false, R is correct reason

d) A is false, R is not correct reason


61. Assertion:append() and pop() built-in methods are used in python implementation of stack.
Reason(R): Stack is linear arrangement of elements where insertion and deletion takes place at the
same end.

a) A is true, R is correct reason

b) A is true, R is not correct reason

c) A is false, R is correct reason

d) A is false, R is not correct reason


CHAPTER - 4. QUEUE
1- Mark Questions(MCQs)

1. Which of the following is an ordered linear list of elements having different ends for
adding and removing elements in it?
a) Stack b) Queue c) Searching d) Sorting
2. An arrangement of linear data structure in which addition and removal of elements can
happen from any end is known as
a) Stack b) Queue c) Deque d) Enqueue
3. Following is a linear list of elements in which insertion and deletion takes place from
different ends.
a) Stack b) Queue c) Searching d) Sorting
4. What is the working principle of queue?
a) LIFO b) FIFO c) FILO d) LILO
5. With respect to queue data structure which of the below statement is true?
a) Addition and removal of elements take place at front end
b) Addition and removal of elements take place at rear end
c) Addition of element is at rear end and removal of elements from the front end
d) Addition of element is at front end and removal of elements from the rear end
6. Which of the below statement is not correct with respect to queue?
a) Queue is a linear list of elements.
b) Operations on Queue are performed in FIFO order.
c) Insertion operation in queue is called Enqueue.
d) Deletion operation in queue is called pop.
7. Which data structure is used to insert and delete elements in FIFO order?
a) Stack b) Queue c) Searching d) Sorting
8. In which order elements of queue are accessed?
a) LIFO b) FIFO c) LILO d) FILO
9. Queue follows:
a) LIFO principle b) FIFO principle c) LILO principle d) FILO principle
10. FIFO stands for:
a) First -In-First-Out b) Forward -In-First-out
c) First -In-Forward-out d) Forward -In- Forward -out
11. FCFS stands for:
a) First Come First Service b) First Count First Served
c) First Come First Served d) First Come First System
12. FIFO is also called as:
a) FCFS b) LIFO c) FSFC d) FILO
13. At which end, an element can be inserted in queue?
a) Top b) Peek c) Rear d) Front
14. From which end, an element is deleted from queue?
a) Top b) Peek c) Rear d) Front

15. If elements are inserted into queue in following order „A‟,‟S‟,‟D‟ and „F‟ and
then elements are removed, in which order elements are removed?
a) „A‟,‟S‟,‟D‟ ,„F‟ b) „F‟, ‟D‟, ‟S‟, „A‟ c) „A‟, „F‟, ‟S‟, ‟D‟ d) ‟S‟,‟D‟ , „A‟, „F‟
16. Which operation is used to insert a new element to the queue at the rear end?
a) Enqueue b) Dequeue c) Isempty d) Peek
17. Which exception will occur when inserting elements beyond capacity of the
queue?
a) Underflow b) Overflow c) Dequeue d) Enqueue
18. Which operation is used to remove one element at a time from the front
of the queue?
a) Enqueue b) Dequeue c) Isempty d) Peek
19. Which exception will occur when trying to delete an element from an
empty queue?
a) Underflow b) Overflow c) Dequeue d) Enqueue
20. The operation is used to view elements at the front of the queue, without removing
it from the Queue is
a) Enqueue b) Dequeue c) Isempty d) Peek
21. Which operation is used to check whether the queue has any element or not?
a) Enqueue b) Dequeue c) Isempty d) Peek
22. Which operation is used to simply read, but not to delete the element at the
front end of the queue?
a) Enqueue b) Dequeue c) Isempty d) Peek
23. Which operation is used to check whether any more elements can be added to the
queue or not?
a) Enqueue b) Isfull c) Isempty d) Peek
24. Which operation is used to avoid overflow exceptions while performing
enqueue operation?
a) Enqueue b) Isfull c) Isempty d) Peek
25. Which operation is used to avoid underflow exception while performing
dequeue operation?
a) Enqueue b) Isfull c) Isempty d) Peek
26. Which function always adds an element to the rear end of the queue?
a) push( ) b) insert( ) c) append( ) d) add( )
27. What is the index of pop method to delete an element from the front end of the queue?
a) 1 b) 0 c) n d) n-1
28. Which data type is used to implement a queue in Python?
a) Tuple b) Dictionary c) List d) None
29. Which built-in-function (method) is used to create an empty queue?
a) Enqueue( ) b) list( ) c) append( ) d) insert ( )
30. Which built-in-function is used to insert a new element at the end of queue?
a) Enqueue( ) b) list( ) c) append( ) d) insert( )
31. Which built-in-function is used to delete an element from the front of the queue?
a) Enqueue( ) b) pop( ) c) append( ) d) Dequeue( )
32. Which built-in-function is used to check, if the queue has an element or not?
a) isEmpty( ) b) list( ) c) append( ) d) len( )
33. Which built-in-function (method) is used to find the number of elements in
the queue?
a) Enqueue( ) b) isEmpty( ) c) isFull( ) d) len( )
34. In which condition, queue overflow occurs?
a) Queue is full and Enqueue( ) is called.
b) Queue is empty and Enqueue( ) is called.
c) Queue is full and Dequeue( ) is called.
d) Queue is empty and Dequeue( ) is called.
35. In which condition, queue underflow exception occurs?
a) Queue is full and Enqueue( ) is called.
b) Queue is empty and Enqueue ( ) is called.
c) Queue is full and Dequeue( ) is called.
d) Queue is empty and Dequeue ( ) is called.
36. Deque is a version of queue which allows insertion and deletion at
a) front end b) rear end c) both ends d) middle
37. Which of the following is a data structure where elements can be added or
removed at either end, but not in the middle?
a) Enqueue b) Dequeue c) Deque d) Queue
38. Which of the following is an arrangement in which addition and removal of
element(s) can happen from any end?
a) Enqueue b) Dequeue c) Deque d) Queue
39. Which of the following permits insertion and deletion operations from any end?
a) Enqueue b) Dequeue c) Deque d) Queue
40. Which of the following data structure does not apply any restriction on the side
from which addition/removal of elements should happen?
a) Enqueue b) Dequeue c) Deque d) Queue
41. Which of the following is also known as double ended queue?
a) Enqueue b) Dequeue c) Deque d) Queue
42. Identify the not correct statement about Deque
a) It is a data structure where elements can be added or removed at either end.
b) Adding or removal of elements can happen in the middle
c) Deque can support both stack and queue operations.
d) Insertfront operation is used to insert new element at the front of the deque.
43. Which operation is used to insert a new element at the front of the deque?
a) Enqueue b) Dequeue c) Insertrear d) Insertfront
44. Which operation is used to insert a new element at the rear of the deque?
a) Enqueue b) Dequeue c) Insertrear d) Insertfront
45. Which operation is used to remove an element from the front of the deque?
a) Enqueue b) Dequeue c) Deletionrear d) Deletionfront
46. Which operation is used to remove one element at a time from the rear
of the deque?
a) Enqueue b) Dequeue c) Deletionrear d) Deletionfront
47. Which built-in-function (method) is used to create an empty deque?
a) Enqueue( ) b) list( ) c) append( ) d) insert( )
48. Which built-in-function (method) is used to insert an element at the front of deque?
a) Enqueue( ) b) list( ) c) Insertrear( ) d) insert( )
49. Which operation is used to check the presence of element(s) in deque?
a) Enqueue b) Isfull c) Isempty d) Peek
50. Which operation is used to read value from the front of deque, without removing it
from the queue when the queue is not empty?
a) Getfront b) Insertfront c) Deletionrear d) Peek
51. Which operation is used to read value from the rear of the deque, without removing it
from the deque?
a) Getfront b) Getrear c) Deletionrear d) Peek
52. In a deque, if insertion and deletion of elements is done from the same end, it
will behave as
a) Queue b) Stack c) List d) String

53. Assertion:Customers forming a line at the cash counter in a bank is an


example of queue in everyday life
Reason(R):The ordering principle of queue is LIFO
a) A is true, R is correct reason
b) A is true, R is not correct reason
c) A is false, R is correct reason
d) A is false, R is not correct reason
54. Assertion: Customers forming a line at the cash counter in a bank is an example of
queue in everyday life
Reason(R): The ordering principle of queue is FIFO
a) A is true, R is correct reason
b) A is true, R is not correct reason
c) A is false, R is correct reason
d) A is false, R is not correct reason
55. Assertion: Queue is a non linear data structure
Reason(R): Insertion and deletion takes place at same end
a) A is true, R is correct reason
b) A is true, R is not correct reason
c) A is false, R is correct reason
d) A is false, R is also false
56. Assertion:Queue is used to send print commands using a shared printer
Reason(R):The ordering principle of queue is FCFS
a) A is true, R is correct reason
b) A is true, R is not correct reason
c) A is false, R is correct reason
d) A is false, R is not correct reason
57. Assertion:Queue is used to send print commands using a shared printer
Reason(R):The ordering principle of queue is LIFO
a) A is true, R is correct reason
b) A is true, R is not correct reason
c) A is false, R is correct reason
d) A is false, R is not correct reason
58. Assertion:Deque is also known as Double ended queue
Reason(R):Deque allows insertion, deletion operation from any end
a) A is true, R is correct reason
b) A is true, R is not correct reason
c) A is false, R is correct reason
d) A is false, R is not correct reason
59. Assertion:Queue is also known as Double ended queue
Reason(R):Queue allows insertion, deletion operation from any end
a) A is true, R is correct reason
b) A is true, R is not correct reason
c) A is false, R is correct reason
d) A is false, R is not correct reason
CHAPTER - 5 SORTING
I Select the correct answer from the choices given:
1) Arranging elements of a data structure in ascending or descending order is known as
a) Searching b) Hashing c) Sorting d) Collision
2) What is the primary purpose of sorting in programming?
a) To remove duplicates from a list
b) To order or arrange elements in a particular order
c) To print the elements sequentially
d) To find the maximum or minimum element in a list
3) Which Python function is used to sort a list in ascending order?
a) order() b) sort() c) ascending() d) arrange()
4) In Bubble Sort, after each pass, what happens to the largest element in the list?
a) It moves to the first position b) It moves to the middle of the list
c) It moves to the last position d) It is removed from the list
5) In bubble sort while sorting in ascending order, which element reaches its correct position after the
first pass.
a) The smallest element b) The middle element
c) The largest element d) The second largest element
6) How many passes does Bubble Sort make to sort a list of n elements?
a) no passes b) n + 2 passes c) n - 1 passes d) log(n) passes
7) Which sorting algorithm repeatedly compares adjacent elements and swaps them if they are
unordered?
a) Quick Sort b) Merge Sort c) Insertion Sort d) Bubble Sort
8) How does Bubble Sort work to sort the elements of a list?
a) By repeatedly selecting the smallest element and placing it at the beginning
b) By repeatedly comparing adjacent elements and swapping them if unordered
c) By dividing the list into sublists and sorting each sublist
d) By selecting the largest element and placing it at the beginning
9) In the selection sort algorithm, what does the left list contain during the sorting process?
a) All unsorted elements b) The largest element found
c) The element is not found d) The smallest elements found
10) The smallest (or largest) element from the unsorted part is swapped with the first unsorted element in
a) Selection Sort b) Bubble Sort c) Shell Sort d) Quick Sort
11) The minimum element is swapped with the first unsorted element in
a) Selection Sort b) Bubble Sort c) Shell Sort d) Quick Sort
12) How does the size of the unsorted list change after each pass in the selection sort algorithm described?
a) It increases by one b) It stays the same. c) It decreases by one d) It is halved.
13) How is Insertion Sort similar to Selection Sort?
a) Both algorithms divide the list into sorted and unsorted parts
b) Both algorithms swap elements multiple times
c) Both algorithms sort them individually
d) Both algorithms use a divide-and-conquer approach
14) Which sorting technique is best suited if elements are already sorted?
a) Bubble sort b) Selection sort c) Insertion sort d) Quick sort
15) What does the time complexity of an algorithm represent?
a) The total memory required by the algorithm
b) The amount of time an algorithm takes to process a given data
c) The number of lines of code in an algorithm
d) The number of iterations in a loop
16) The amount of time an algorithm takes to process a given data is called
a) time complexity b) loop complexity c) if complexity d) watch complexity
17) Which of the following type of algorithms is characterized by a constant execution time, regardless of
the size of the input data?
a) Linear time algorithms b) Exponential time algorithms
c) Constant time algorithms d) Quadratic time algorithms
18) What kind of algorithms have a time complexity of O(n)?
a) Constant time algorithms b) Linear time algorithms
c) Logarithmic time algorithms d) Quadratic time algorithms
19) Which of the following describes the behavior of linear time algorithms?
a) The algorithm‟s execution time increases exponentially with input size.
b) The algorithm‟s execution time increases logarithmically with input size.
c) The algorithm‟s execution time increases directly in proportion to input size.
d) The algorithm‟s execution time does not depend on the input size.

20) The term is used to describe algorithms whose time complexity is n2, typically caused by nested loops
a) Linear time algorithms b) Exponential time algorithms
c) Quadratic time algorithms d) Constant time algorithms
21) Which of the following is an example of a quadratic time complexity algorithm?
a) A single loop iterating over n elements
b) A loop with n iterations and another loop with n iterations inside it
c) A recursive algorithm halving the problem size each time
d) A linear search algorithm
22) Which of the following examples represent the worst case input for an insertion sort?
a) array in sorted order b) array sorted in reverse order
c) normal unsorted array d) large array
23) A computational complexity that describes the amount of time an algorithm takes to run as a function
of the size of its input.
a) Time Complexity b) Data Complexity c) Clock Complexity d) Loop Complexity
24) Assertion : Sorting a large number of items can take a substantial amount of time.
Reason (R): The extra time of sorting is worth it when compared to the time needed to search in an
unsorted list ?
a) Both A and R are true b) Both A and R are false
c) A is true, but R is false. d) A is false, but R is true.
25) A): Bubble sort compares adjacent elements in each pass and swaps them if they are not in order.
R): The largest unsorted element "bubbles up" to its correct position at the end of the list.
a) Both A and R are true b) Both A and R are false
c) A is true, but R is false. d) A is false, but R is true.
26) Assertion : In Bubble sort, the total number of passes required to sort a list with n elements is n-
Reason (R): In each pass, the smallest element is placed at its correct position in the list.
a) Both A and R are true b) Both A and R are false
c) A is true, but R is false. d) A is false, but R is true.
27) : In Bubble Sort, the size of the unsorted portion of the list decreases with each pass.
(R) : After each pass, the largest unsorted element is placed at the end of the list, making it sorted.
a) Both A and R are true b) Both A and R are false
c) A is true, but R is false. d) A is false, but R is true.
28) Assertion : Selection sort makes (n - 1) passes through a list of n elements to sort the list.? Reason
(R): In selection sort, the list is divided into two parts: a sorted left list and an unsorted right list.
a) Both A and R are true b) Both A and R are false
c) A is true, but R is false. d) A is false, but R is true.
29) Assertion : In selection sort, the number of passes required to sort a list of n elements is (n-1). Reason
(R): In each pass, selection sort places the smallest (or largest) element from the unsorted part of the
list to the beginning of the unsorted section.
a) Both A and R are true b) Both A and R are false
c) A is true, but R is false. d) A is false, but R is true.
30) Assertion : In selection sort, the sorted and unsorted parts of the list are clearly separated during the
sorting process.
Reason (R): The selection sort repeatedly compares adjacent elements and swaps them if they are in
the wrong order.
a) Both A and R are true b) Both A and R are false
c) A is true, but R is false. d) A is false, but R is true.
31) Assertion : Selection sort is an in-place sorting algorithm.
Reason (R): It does not require any extra memory space other than the input array.
b) Both A and R are false b) A is true, but R is false.
c) A is false, but R is true. d) Both A and R are true
32) Assertion : In Selection Sort, the smallest element is found & placed at the beginning in each pass.
Reason (R): In each pass of Selection Sort, all elements of the unsorted list are compared to find the
minimum value.
a) Both A and R are false b) Both A and R are true
c) A is true, but R is false d) A is false, but R is true
33) In selection sort the smallest element is selected in each pass and placed in its correct position.
(B) In selection sort the nth element is the last, and it is already in place
a) A is true and B is false b) A is false and B is true
c) A and B are true d) A and B are false
34) Assertion : Insertion sort divides the list into a sorted and an unsorted part.
Reason (R): Each element from the unsorted part is inserted into its correct position in the sorted part
by traversing the sorted part backward.
a) A is false, but R is true b) Both A and R are false
c) A is true, but R is false d) Both A and R are true
35) : In insertion sort, in each pass, the sorted list is traversed from the backward direction. (R):
This is done to find the correct position to insert the current element from the unsorted list.
a) Both A and R are false b) A is true, but R is false
c) A is false, but R is true d) Both A and R are true
36) Assertion : In insertion sort, the first pass starts with an empty sorted list. Reason
(R): The sorted list initially contains the smallest element from the entire list.
a) Both A and R are false b) A is true, but R is false
c) A is false, but R is true d) Both A and R are true
CHAPTER - 6 SEARCHING
1 MARK MCQ’S
1. What is searching?
a) Arranging a given collection of elements in some particular order
b) Finding the location of an element from the list
c) Removing elements from the list
d) Finding the largest element
2. Which of the following method is fundamental and the simplest search method?
a) Linear search b) Binary search c) Search by hashing d) Selection search
3. In which searching technique, each element in the list is compared one by one with the key?
a) Linear search b) Binary search c) Search by hashing d) Selection search
4. Which of the following is sequential search or serial search?
a) Linear search b) Binary search c) Search by hashing d) Selection search
5. Which of the following technique is useful for collection of items that are small in size and are
unordered?
a) Linear search b) Binary search c) Search by hashing d) Selection search
6. In which searching technique, the key to be searched is compared with the element in the middle
of a sorted list?
a) Linear search b) Binary search c) Search by hashing d) Sequential search
7. Which of the following searching technique is used only on ordered (sorted) list?
a) Linear search b) Binary search c) Search by hashing d) Sequential search
8. Following searching requires only one key comparison to discover the presence or absence of a
key.
a) Linear search b) Binary search c) Search by hashing d) Sequential search
9. Statement : Linear search method compares key element with the all elements of the list from
beginning to end.
Statement (B) : Binary search method Compares key element with middle element only.
a) A is true B is false b) Both A and B are false
c) A is false B is true d) Both A and B are true
10. Statement : Linear search method is the most fundamental and simplest method of searching
Statement (B) : Linear search is also called as sequential search method.
a) A is true B is false b) Both A and B are false
c) A is false B is true d) Both A and B are true
11. Statement : Linear search method is the most fundamental and simplest method of
searching
Statement (B) : In linear search method the key element is compared only with middle
element
a) A is true B is false b) Both A and B are false
c) A is false B is true d) Both A and B are true
12. Statement : Linear search method will take more time

Statement (B) : Binary search method will take less time


a) A is true B is false b) Both A and B are false
c) A is false B is true d) Both A and B are true
13. Statement : Linear search method applicable for only sorted list

Statement (B) : Binary search method applicable for only sorted list
a) A is true B is false b) Both A and B are false
c) A is false B is true d) Both A and B are true
14. Statement : Linear search method applicable for sorted and unsorted list

Statement (B) : Binary search method applicable for only sorted list
a) A is true B is false b) Both A and B are false
c) A is false B is true d) Both A and B are true

15. In binary search if the search element is greater than middle element then search
continues in?
a) Left side of the list b) Right side of the list
c) First location of the list d) Last location of the list
16. In binary search if the search element is less than middle element then search continues in?
a) Left side of the list b) Right side of the list
c) First location of the list d) Last location of the list
17. Which is the best searching method used to search in a dictionary?
a) Linear search b) Binary search c) Search by hashing d) Selection search
18. When two elements map to the same slot in the hash table, is called?
a) Collision b) Wrong hashing c) Resolution d) Hash function
19. Which of the following formula is used to generate hash value?
a) h(element)=element+size(hash table)
b) h(element)=element-size(hash table)
c) h(element)=element/size(hash table)
d) h(element)=element%size(hash table)
20. Assume that list contains 10 elements [34,16,2,93,80,77,51] What is hash value of the element 93?
a) 93 b) 3 c) 9 d) 0
1 MARK FILLS IN THE BLANKS
(Hashing, Binary search, Linear search, Searching, Collision, Sorted and unsorted list)
1. Searching mean finding the location of the element.
2. The simplest method of searching is Linear Search .
3. The linear search method is applicable for Sorted and unsorted list.
4. Binary Search method applied only on sorted list.
5. Hashing is a technique which can be used to know the presence of a element in just one step.
(Collision, Linear search, Binary search, Search by hash method, Remainder method, Sorted list)
1. Linear search method compares key with all elements.
2. Binary search method compares key with only middle elements.
3. Hash value is generated in search by hash method.
4. Two elements map to the same slot in the hash table is called Collision.
5. The method used in generating hash value is called reminder method.
CHAPTER 7. UNDERSTANDING DATA

MCQs:
1. ICT stands for
a) International Communication Technology
b) Information and Communication Technology
c) Integrated Computer Technology
d) Internet and Cloud Technology
2. What significant impact did the ICT revolution have?
a) Decreased volume of data generated.
b) Slowed down data processing methods.
c) Generated large volume of data rapidly.
d) Eliminated need for data storage.
3. What is the fundamental role of data?
a) To store character-based information.
b) To enable informed decision-making.
c) To provide entertainment to users.
d) To replace human understanding.
4. Data is defined as
a) Organised facts ready for decision making
b) Collection of characters, numbers and symbols
c) Processed information
d) Only numerical values
5. The singular form of “data” is:
a) Dato
b) Datium
c) Datum
d) Date
6. The government collects population data through
a) Surveys
b) Census
c) Sampling
d) Interviews
7. Which of the following is NOT an example of data?
a) Name and contact details of a person
b) Images and videos
c) Online posts and comments
d) Final analysis report
8. Data stored in electronic form is preferred because
a) It is always accurate
b) It reduces memory usage
c) Processing becomes faster and easier
d) It avoids the need of analysis
9. Weather alerts are generated by analysing
a) Voting machines
b) Sports performance details
c) Satellites data
d) Library membership
10. Data that is organised in rows and columns is called
a) Metadata
b) Structured data
c) Unstructured data
d) Processed data
11. Which of these is an example of structured data?
a) A table showing sales records
b) A social media post
c) An email message
d) A photograph
12. Which of these is an example of unstructured data?
a) Fee records in a CSV file
b) Tabular ATM transaction history
c) Newspaper articles with pictures
d) Spreadsheet of salaries
13. Metadata is best defined as
a) Data after processing
b) Data about data
c) Numerical data only
d) Structured data only

14. An image file's resolution, image size, image type are examples of
a) Structured data
b) Tabular data
c) Fixed format data
d) Metadata
15. Data collection is the process of
a) Identifying and gathering data from sources
b) Storing processed information
c) Deleting irrelevant data
d) Generating reports from databases
16. Which organisation collects global economic data for making economic forecasts?
a) UNESCO
b) NASA
c) WHO
d) IMF
17. Data storage refers to
a) Presenting information
b) Storing data on digital devices for future use
c) Deleting old files
d) Summarising data with statistics
18. Which of the following is NOT a digital storage device?
a) RAM
b) CD/DVD
c) Pen Drive
d) Memory Card
19. The first step in the data processing cycle is
a) Data output
b) Data collection
c) Data storage
d) Data processing
20. Which of these is NOT an example of automated data processing?
a) Online bill payment
b) Generating exam admit card online
c) Cash withdrawal through ATMs
d) Manual exam paper correction

21. Which of the following is NOT a measure of central tendency?


a) Mean
b) Median
c) Mode
d) Range
22. Mean is affected most by
a) Mode
b) Outliers
c) Median
d) Standard deviation
23. Mean is also called as
a) sum
b) difference
c) ratio
d) average
24. The middle value of sorted data is called
a) Mean
b) Median
c) Mode
d) Range
25. Mode refers to
a) Average of values
b) Middle value of data
c) Most frequently occurring value
d) Difference between maximum and minimum
26. Which of the following is a measure of variability?
a) Mean
b) Median
c) Range
d) Mode
27. Range is calculated as
a) Maximum + Minimum
b) Maximum – Minimum
c) Mean – Median
d) Mode × Frequency

28. Which measure uses ALL data values to calculate spread?


a) Range
b) Mode
c) Median
d) Standard deviation
29. Smaller value of standard deviation means
a) Data are widely spread
b) Data are less spread
c) Outliers exist
d) Data is skewed
30. Larger value of standard deviation means
a) Data are widely spread
b) Data are less spread
c) Outliers exist
d) Data is skewed
CHAPTER - 8 DATABASE CONCEPTS

MCQ
1. Which of the following is a limitation of manual record keeping?
a) Easy data retrieval
b) Automatic backup
c) Erroneous calculations while consolidating records
d) Controlled access of users
2. A file in a computer can contain
a) texts b) videos c) images d) all of the above
3. Data redundancy in file systems means
a) same data duplicated in multiple files
b) data missing in files
c) data compression in files
d) encrypted data in files
4. Data inconsistency occurs when
a) data format is changed
b) file is deleted
c) application program fails
d) same data stored in multiple files do not match
5. DBMS is a
a) collection of files b) software to manage databases
c) spreadsheet d) type of operating system
6. Which of the following is an example of DBMS?
a) MS Word b) Oracle c) Notepad d) Windows
7. Retrieving data from a database is called
a) querying b) formatting c) indexing d) modifying
8. Database schema primarily refers to
a) database user permissions b) structure of the database
c) data in the database d) snapshot of the database
9. The purpose of data constraint is
a) to store additional information about data b) to restrict the type of data inserted
c) To modify the data d) to display data to the users
10. meta-data is also called as
a) database schema b) database instance
c) database catalog d) database constraint
11. Which of the following is not an operation in data manipulation?
a) Insertion b) Formatting c) Deletion d) Update
12. In a relational database tables are called as
a) attributes b) tuples c) relations d) instances
13. A row in a relation is also called
a) domain b) tuple c) attribute d) degree
14. A column in a relation is also called
a) domain b) tuple c) attribute d) degree
15. The number of attributes in a relation is called
a) degree b) domain c) cardinality d) instance
16. The number of tuples in a relation is called
a) domain b) degree c) cardinality d) attribute
17. Candidate keys are
a) attributes that can uniquely identify the tuples
b) alternate name for primary key
c) foreign keys
d) attributes having same names
18. An alternate key is
a) another name for primary key b) candidate key not chosen as primary key
c) a composite key d) a foreign key
19. Composite primary key means:
a) one attribute is primary key b) multiple attributes together act as primary key
c) foreign key used as primary key d) any attribute is primary key
20. An attribute whose value is derived from the primary key of another relation is
a) foreign key b) candidate key c) alternate key d) secondary key
CHAPTER 9 STRUCTURED QUERY LANGUAGE

1. Which MySQL data type is fixed length and pads unused space with blanks? (easy)
a. CHAR(n)
b. VARCHAR(n)
c. TEXT
d. STRING
2. What is the maximum length allowed for a VARCHAR data type in MySQL? (easy)
a. 32,767
b. 65,535
c. 1,024
d. 255
3. Which data type should be used in MySQL to store values larger than 4,294,967,295?
(average)
a. BIGINT
b. FLOAT
c. INT
d. DOUBLE
4. Which MySQL data type is suitable for storing dates in the format 'YYYY-MM-DD’?
(easy)
a. DATETIME
b. TIME
c. TIMESTAMP
d. DATE
5. How many bytes does a FLOAT data type occupy in MySQL? (easy)
a. 2 bytes
b. 4 bytes
c. 8 bytes
d. 16 bytes
6. Why might a developer prefer VARCHAR over CHAR for storing names?(average)
a. VARCHAR is faster for indexing
b. CHAR wastes space for variable-length strings
c. CHAR supports Unicode while VARCHAR does not
d. VARCHAR automatically converts to uppercase
7. A school database stores student roll numbers. Which data type is most appropriate and
why?(difficult)
a. VARCHAR
b. CHAR
c. INT
d. DATE
8. A developer uses CHAR(10) to store student names. What is the possible drawback of this
choice?(difficult)
a. CHAR does not support special characters
b. CHAR automatically converts text to uppercase
c. CHAR always stores exactly 10 characters, wasting space
d. CHAR cannot store numeric values

9. Why might VARCHAR be preferred over CHAR for storing student addresses?(difficult)
a. CHAR cannot store space
b. VARCHAR is faster for searching
c. VARCHAR stores only the actual length of the string
d. CHAR is limited to 10 characters

10. A student’s age is stored using the INT data type. What kind of operations can be
performed on this data? (average)
a. Arithmetic operations
b. Text alignment
c. Date formatting
d. Concatenation
11. Which of the following is a relational database management system?(easy)
a. MongoDB
b. MySQL
c. No SQL
d. Graph Database
12. Which SQL statement is used to retrieve data from a database?(easy)
[Link]. [Link] [Link] [Link]
13. Which of the following is true about SQL?(average/)
a. SQL is case-sensitive
b. SQL is used only for data retrieval
c. SQL uses procedural logic
d. SQL uses English-like syntax
14. Which prompt indicates that MySQL is ready to accept SQL statements?(easy)
a. SQL>
b. mysql>
c. cmd>
d. db>
15. Which of the following is a fixed-length character data type in MySQL? (easy)
a. VARCHAR
b. CHAR
c. TEXT
d. STRING
16. Which constraint ensures that a column cannot have missing or unknown
values?(average)
a. UNIQUE
b. DEFAULT
c. NOT NULL
d. FOREIGN KEY

17. Which two constraints restricts range for column values?(easy)


a. UNIQUE
b. DEFAULT
c. PRIMARY KEY
d. CHECK
18. Which SQL command displays the structure of a table?(easy)
a. SHOW TABLE
b. DESCRIBE
c. STRUCTURE
d. VIEW TABLE
19. Which statement is used to add a new column to an existing table?(easy)
a. MODIFY COLUMN
b. ADD COLUMN TO
c. ALTER TABLE ADD
d. INSERT INTO TABLE
20. Which constraint ensures that no two rows have the same value in a column? (easy)
a. NOT NULL
b. PRIMARY KEY
c. UNIQUE
d. FOREIGN KEY
21. Which of the following is true about foreign keys? (average)
a. They must reference a primary key or unique key in another
table.
b. They must always contain non-NULL values.
c. They enforce uniqueness in the referencing column.
d. They can reference columns with duplicate values
22. Which one of the following SQL command is used to insert new records into a table?
(easy)
a. ADD
b. INSERT
c. UPDATE
d. SELECT
23. Which of the following is part of Data Manipulation Language (DML)?(easy)
a. CREATE
b. ALTER
c. DELETE
d. DROP
24. What should be ensured before inserting a record with a foreign key?(average)
a. The referenced table must be empty
b. The referenced table must be populated.
c. The foreign key must be NULL.
d. The foreign key must be unique
25. Which format is used to store date values in MySQL? (easy)
a. DD-MM-YYYY
b. MM-DD-YYYY
c. YYYY-MM-DD
d. DD/YYYY/MM
26. Which one of the SQL clause used to filter records based on a condition?(easy)
a. FROM
b. SELECT
c. WHERE.
d. HAVING
27. The keyword to rename a column in the output of a select query?(easy)
a. RENAME
b. TITLE
c. AS
d. ALIAS
28. Which clause ensures that duplicate values are not shown in the query result? (average)
a. UNIQUE
b. DISTINCT
c. ORDER BY
d. GROUP BY
29. Which operator is used to define a range in SQL queries?
a. BETWEEN
b. WITHIN
c. LIMIT
d. IN
30. What does the ORDER BY clause do in SQL?
a. Sorts rows based on column values
b. Filters rows based on conditions
c. Groups rows with similar values
d. Limits the number of rows returned
31. Which operator is used to check for missing or unknown values in SQL?(easy)
a. NOT
b. NOT EXISTS
c. IS NULL
d. IN
32. The SQL operator is used for substring pattern matching is
( average)
a. IN
b. BETWEEN
c. LIKE
d. MATCHES
33. What does the % wildcard represent in SQL? ( average)
a. Exactly one character
b. Matches any single character
c. Zero, one, or multiple characters
d. Only uppercase letters
34. Which query selects employees whose names start with 'K'?
( average)
a. SELECT * FROM EMPLOYEE WHERE Ename = 'K';
b. SELECT * FROM EMPLOYEE WHERE Ename LIKE '%K';
c. SELECT * FROM EMPLOYEE WHERE Ename LIKE 'K%';
d. SELECT * FROM EMPLOYEE WHERE Ename IN 'K_';
35. What does the query SELECT Ename FROM EMPLOYEE WHERE Ename LIKE
'_a%'; returns?
a. Names starting with 'a'
b. Names with 'a' as the last character
c. Names with 'a' as the second character .
d. Names with exactly two characters (average/Applying)
36. Which wildcard is used to match exactly one character in SQL?
a. %
b. _C
c. .#
d. D. * (average/ Understanding)
37. Which SQL command is used to modify existing data in a table?
a. UNION
b. INSERT
c. UPDATE
d. ALTER
38. What will happen if the WHERE clause omitted in an UPDATE statement?
a. No rows updated.
b. It demands condition interactively
c. All rows are updated.
d. Syntax error
39. Which of the following is a correct syntax to update multiple columns in SQL?
(average/applying)
a. UPDATE table SET col1 = val1 AND col2 = val2;
b. UPDATE table SET col1 = val1, col2 = val2;
c. UPDATE table SET (col1, col2) = (val1, val2);
d. MODIFY table SET col1 = val1, col2 = val2.
40. Which SQL statement is used to remove records from a table?
(average/applying)
a. REMOVE
b. DELETE
c. DROP
d. ERASE
41. What does the ORDER BY clause do in SQL?

a. Sorts rows based on column values


b. Filters rows based on conditions
c. Groups rows with similar values
d. Limits the number of rows returned
42. Which operator is used to check for missing or unknown values in SQL?(easy)
a. NOT
b. NOT EXISTS
c. IS NULL
d. IN
43. The SQL operator is used for substring pattern matching is
( average)
a. IN
b. BETWEEN
c. LIKE
d. MATCHES
44. What does the % wildcard represent in SQL? ( average)
a. Exactly one character
b. Matches any single character
c. Zero, one, or multiple characters
d. Only uppercase letters
45. Which query selects employees whose names start with 'K'?
( average)
a. SELECT * FROM EMPLOYEE WHERE Ename = 'K';
b. SELECT * FROM EMPLOYEE WHERE Ename LIKE '%K';
c. SELECT * FROM EMPLOYEE WHERE Ename LIKE 'K%';
d. SELECT * FROM EMPLOYEE WHERE Ename IN 'K_';
46. What does the query SELECT Ename FROM EMPLOYEE WHERE Ename LIKE
'_a%'; returns?
a. Names starting with 'a'
b. Names with 'a' as the last character
c. Names with 'a' as the second character .
d. Names with exactly two characters (average/Applying)
47. Which wildcard is used to match exactly one character in SQL?
a. %
b. _C
c. .#
d. D. * (average/ Understanding)
48. Which SQL command is used to modify existing data in a table?
a. UNION
b. INSERT
c. UPDATE
d. ALTER
49. What will happen if the WHERE clause omitted in an UPDATE statement?
a. No rows updated.
b. It demands condition interactively
c. All rows are updated.
d. Syntax error (average/applying)
50. Which of the following is a correct syntax to update multiple columns in SQL?
(average/applying)
a. UPDATE table SET col1 = val1 AND col2 = val2;
b. UPDATE table SET col1 = val1, col2 = val2;
c. UPDATE table SET (col1, col2) = (val1, val2);
d. MODIFY table SET col1 = val1, col2 = val2.
51. Which SQL statement is used to remove records from a table?
(average/applying)
a. REMOVE
b. DELETE
c. DROP
d. ERASE
52. Which function returns the name of the day from a given date?

a. DAY()
b. DAYNAME()
c. DATE()
d. NOW()
53. What will the query SELECT MONTHNAME('2003-11-28'); return?
(average/applying)
a. 11
b. November
c. 28
d. Friday
54. Which function is used to extract the year from a date?
(average/applying)
a. YEAR()
b. DATE()
c. MONTH()
d. DAY()
55. Which of the following is a multiple row (aggregate) function?
(easy/understanding)
a. ROUND()
b. DAYNAME()
c. MAX()
d. MONTHNAME()
56. What does the query SELECT SUM(SalePrice) FROM SALE WHERE CustID = 'C0001';
do?

a. Adds all SalePrice values in the SALE table.


b. Adds SalePrice values for customer C0001.
c. Displays SalePrice for customer C0001.
d. Counts SalePrice entries for customer C0001.
57. Which SQL function returns the average of values in a column?
(easy/understanding)
a. SUM()
b. AVG()
c. COUNT()
d. MAX()
58. What does the COUNT(*) function return?
(easy/understanding)
a. Number of non-null values in a column
b. Number of distinct values
c. Total number of rows in a table
d. Sum of all numeric values
59. Which function ignores NULL values while counting?
(easy/ Applying)
a. COUNT(*)
b. COUNT(column)
c. SUM(column)
d. MAX(column)
60. What will the query SELECT COUNT(DISTINCT Model) FROM INVENTORY;return?
(average/applying)
a. Total number of models
b. Number of rows in INVENTORY
c. Number of unique model types
d. Number of NULL values in Model
61. Which aggregate function return the largest value in a column?
(easy/understanding)
a. MIN()
b. MAX()
c. COUNT()
d. AVG()
62. What is the output of SELECT AVG(Price) FROM INVENTORY WHERE Model =
'LXI';?
(average/applying)
a. Average price of all cars
b. Average price of LXI model cars
c. Total price of LXI model cars
d. Number of LXI model cars
63. Which operation combines rows from two tables and removes duplicates?
(easy/understanding)
a. INTERSECT
b. MINUS
c. UNION
d. JOIN
64. What does the INTERSECT operation return?
(average /understanding)
a. All rows from both tables
b. Rows that are present only on the first table.
c. Common rows from both tables
d. Rows that present only on the second table.
65. Which operation returns rows that are in the first table but not in the second?
(easy/understanding)
a. UNION
b. INTERSECT
c. MINUS
d. SELECT
66. Which of the following conditions must be met to apply UNION, INTERSECT, or
MINUS operations?
(average/apply)
a. Tables must have the same number of rows.
b. Tables must have the same number of columns and matching data
types.
c. Tables must be in sored order.
d. Tables must have primary keys.
67. What will the result of DANCE ∩ MUSIC contain?
(easy/apply)
a. All students from both events
b. Students only in MUSIC
c. Students only in DANCE
d. Students participate in both events.
68. What does the Cartesian product of two tables return?
(easy/understanding)
a. Only matching rows
b. All combinations of rows from both tables
c. Rows with NULL values
d. Duplicate rows only
69. If table A has 4 rows and table B has 5 rows, how many rows the Cartesian product A × B
contain?
(easy/applying)
a. 9
b. 20
c. 4
d. 5
70. What is the degree of the resulting relation when two Tables of degree three are combined by
Cartesian product?(average/applying)
a. 3
b. 6
c. 9
d. 12
71. Which clause is used to filter rows after applying Cartesian product based on a
condition?(easy/remembering)
a. GROUP BY
b. HAVING
c. WHERE.
d. ORDER BY
72. What does the JOIN operation do in SQL?(easy/understanding)
a. Combines all possible rows from two tables
b. Combines rows from two tables based on a condition
c. Removes duplicate rows from a table
d. Filters rows based on a condition
73. Which JOIN type removes redundant columns when joining two tables with a common
attribute?
a. INNER JOIN
b. LEFT JOIN
c. NATURAL JOIN
d. CROSS JOIN
74. What is the result of the query SELECT * FROM UNIFORM U JOIN COST C ON
[Link] = [Link];?(average/applying)
a. Cartesian product of UNIFORM and COST
b. Only rows with matching UCode from both tables
c. All rows from UNIFORM
d. All rows from COST
75. How many JOIN operation are needed to combine N tables using equality condition?(easy))
a. N
b. N+1
c. N–1
d. 2
76. Identify the correct date function from the following.(easy)
a. FINDDATE ()
b. JULIANDATE ()
c. NOW ()
d. SYSTEM_DATE ()
77. The SQL command to modify the structure of a table is(easy)
a. CREATE
b. UPDATE
c. INSERT
d. ALTER
78. The most popular query language used by RDBMS is(easy)
a. MYSQL
b. PYTHON
c. C++
d. JAVA
79. Which of the following is a string single row built in function (easy)

a. Length ()
b. Min ()
c. Now ()
d. Count ()
80. Which datatype is used to hold numbers with decimal points in MYSQL?(easy)
a. FLOAT
b. DATE
c. INT
d. INTEGER
81. The clause used to enforce condition is(easy)
a. DISTINCT
b. GROUP BY
c. ORDER BY
d. WHERE

Fill in the Blanks.

1. A Database is a collection of related tables used to store and manage data.


2. MySQL is a Relational type of database management system.
3. The SQL command used to create a new table is CREATE.
4. The ALTER statement is used to modify the structure of an existing table.
5. To insert new data into a table, we use the INSERT INTO statement.
6. The Where clause is used to filter rows based on specific conditions.
7. The Distinct clause is used to eliminate duplicate values from the result set.
8. The UPDATE statement is used to change existing data in a table.
9. The BETWEEN operator is used to match values within a specified range.
10. The IN operator is used to match values from a given list.
11. The ORDER BY clause is used to sort the result of a query in ascending or descending order.
12. The LIKE operator is used for pattern matching using wildcards like % and _.
13. A Single Row Function in SQL performs a specific task and returns a single value.
14. Single Row Function row functions operate on individual rows and return one result per row.
15. AGGREGATE row functions operate on a group of rows and return a single result.
16. The GROUP BY clause is used to group rows that have the same values in specified columns.
17. The JOIN operation combines rows from two or more tables based on common fields.
18. The SQL command used to remove a table from the database is DROP.
19. IS NULL and IS NOT NULL are used to test NULL VALUES.
20. The HAVING clause is used to apply conditions on grouped data after aggregation.
21. DISTINCT clause is used along with select to avoid duplicate values in an SQL query.
22. UNION operation is used to combine the selected rows of two tables at a time.
23. INSERT/ DELET, UPDATE is a command which comes under DML.
24. SUM /AVG/MAX/MIN/COUNT is an aggregate function in SQL.
25. BETWEEN operator defines the range of values inclusive of boundary values.
26. The function that converts string into uppercase is UPPER().
27. The result of 5+NULL is NULL.
CHAPTER - 10 COMPUTER NETWORK
Multiple Choice Questions.
1. Which of the following describes a computer network? (Q1-
Q59:easy
a. A system used to broadcast data
b. A system for printing documents
c. An interconnection between two or more computers or computing devices
d. A system for receiving data packets
2. Which of the following best defines a Local Area Network?
a. A network that connects devices across countries or continents
b. A network that connects devices within a limited geographical area such as a room, building,
or campus
c. A global collection of interlinked web pages
d. A wireless network only for mobile phones
3. The IEEE assigned number for wireless LAN is
a. IEEE 802.3
b. IEEE 802.5
c. IEEE 802.15
d. IEEE 802.11
4. Which media/technology is commonly used for LAN connectivity?

a. Satellite links b. Ethernet cables and Wi-Fi c. Undersea fiber-optic trunk lines d. Cellular 4G/5G towers
5. The protocol introduced as standard protocol on ARPANET is
a. TCP/IP
b. HTTP
c. FTP
d. PPP
6. What is the typical maximum range a LAN can be extended to, as mentioned in the passage?
a. 10 metres
b. 100 metres
c. 1 kilometre
d. 100 kilometres
7. The network connects devices like laptops, smartphones, printers, smartphones, mobile phones
of individuals is
a. LAN
b. PAN
c. WAN
d. MAN
8. Which of the following networks connects devices within a limited distance?
a. PAN
b. MAN
c. WAN
d. LAN
9. The network which offers high data transfer rates from 10 Mbps to 1000 Mbps is
a. WAN
b. PAN
c. LAN
d. MAN
10. The network covers a larger geographical area like a city or town.
a. WAN
b. LAN
c. PAN
d. MAN
11. Which of the following is an example of a Metropolitan Area Network ?
a. A home Wi-Fi setup
b. A university campus network
c. A city-wide cable TV network
d. A Bluetooth connection between devices
12. The network connects computers and other networks across countries or continents is
a. LAN
b. PAN
c. MAN
d. WAN
13. The device converts analog signals to digital bits and vice versa is
a. Switch
b. Modem
c. Router
d. NIC
14. Which of the following data rate ranges corresponds to LAN speeds
a. 56 kbps to 128 kbps
b. 10 Mbps to 1000 Mbps
c. 10 Gbps to 100 Gbps
d. 1 bps to 100 bps
15. The modulator converts:
a. Digital signals to analog
b. Analog signals to digital
c. Binary to hexadecimal
d. analog signals to optical signals
16. The function of the demodulator is
a. Converting Digital signals to analog
b. Converting binary signals to analog signals
c. Converting Analog signals to digital
d. Sending control signals
17. Another name for an Ethernet card is
a. IDE
b. NIC
c. FireWire
d. COM1
18. Which device is a network adapter used to set up a wired network?
a. Modem
b. Wi-Fi
c. Bluetooth
d. NIC
19. Which device acts as an interface between a computer and the network?
a. Switch
b. Hub
c. NIC
d. Repeater
20. The data rate of Gigabit ethernet is
a. 2048 Mbps
b. 1000 Mbps
c. 512 Mbps
d. 4096 Mbps
21. The network circuit mounted on the motherboard of a computer is
a. NIC
b. Router
c. Graphics Processing Unit
d. Switch
22. Which cable connects the computer to the network through NIC?
a. USB cable
b. HDMI cable
c. Ethernet cable
d. VGA cable
23. Which device is an eight-pin connector used exclusively with Ethernet cables for
networking?

a. RJ-45
b. USB
c. HDMI
d. VGA
24. Which device is the standard networking interface seen at the end of all network cables?
a. RJ-11
b. RJ-45
c. DB-25
d. PS/2
25. How many pins does an R-J45 connector have?
a. 24
b. 32
c. 8
d. 16
26. Which device is an analog device that works with signals on the cables to which it is
connected?
a. Router
b. Hub
c. Repeater
d. Switch
27. Which device regenerates signals on the cables to which it is connected?
a. Repeater
b. Modem
c. NIC
d. Gateway
28. Which device is used to connect different devices through wires in a network?
a. Repeater
b. Hub

c. Router
d. Modem

29. Which device connects multiple computers or communicating devices in a network?


a. Hub

b. NIC
c. RJ-45
d. Repeater

30. Which device receives data, analyzes it, and transmits it to other networks?
a. Switch
b. Router
c. Hub
d. Repeater
31. The device can analyze data, decide how it is packaged, and send it to another network is the
a. Hub
b. Switch
c. Router
d. Repeater

32. The device serves as the entry and exit point of a network is the
a. Gateway
b. Switch
c. Hub
d. NIC

33. Which device maintains information about internal and remote network paths?
a. Gateway
b. Router
c. Repeater
d. Modem

34. Which of the following refers to the arrangement of computers and peripherals in a network?
a. Protocol
b. Topology
c. Interface
d. Adapter

35. In which topology is each device connected to every other device in the network?
a. Ring
b. Mesh
c. Star
d. Bus
33. In which topology is each node connected to two other devices, one on each side?
a. Star
b. Ring
c. Mesh
d. Tree
34. The link in a ring topology is:
a. Unidirectional
a. Always wireless
b. Only analog
c. Irregular
35. In which topology does each device connect to a transmission medium?
a. Star
b. Bus
c. Ring
d. Mesh
36. In which topology is each device connected to a central node?
a. Ring
b. Star
c. Bus
d. Mesh
37. In which topology are there multiple branches, each with one or more basic topologies?
a. Mesh
b. Hybrid
c. Ring
d. Bus
38. Which of the following is a hierarchical topology?
a. Tree
b. Ring
c. Bus
d. Mesh
39. Which of the following is a hybrid topology?
a. Star
b. Tree
c. Mesh
d. Star-Bus

40. Which of the following is a unique value associated with a NIC


a. IP address
b. MAC address
c. Port number
d. Subnet mask
41. The value is engraved on a NIC at the time of manufacturing and cannot be changed is the
a. IP address
b. MAC address
c. Port number
d. Subnet mask
42. Which address uniquely identifies each node in a network?
a. MAC address
b. Gateway address
c. DNS address
d. Port number
43. How many hexadecimal digits are used in a MAC address?
a. 8
b. 10
c. 12
d. 16
44. How many bits are used in an IPv4 address?
a. 32
b. 64
c. 128
d. 16
45. How many bits are used in an IPv6 address?
a. 32
b. 64

c. 128
d. 256
46. Which of the following is an ocean of information stored in trillions of interlinked web pages?
a. Local Area Network
b. World Wide Web
c. Intranet
d. File Server
47. Which of the following is used to design standardized web pages readable across devices?
a. MAC
b. HTML
c. URL
d. DNS
48. Which of the following is a unique address or path for each web resource?
a. MAC
b. HTML
c. URL
d. ISP
49. Which protocol is used to retrieve linked web pages across the web?
a. HTTP
b. FTP
c. SMTP
d. TCP
50. What is the full form of MAC?
a. Media Access Control
b. Machine Address Code
c. Manual Access Configuration
d. Multi Access Channel
51. What is the full form of HTML?
a. Hyper Test Markup Language
b. High Tech Markup Language
c. Hyper Text Markup Language
d. Hyperlink Transfer Markup Language
52. What is the full form of URL?
a. Uniform Resource Locator
b. Universal Reference Link
c. Unified Retrieval Language

d. Unique Routing Locator


53. What is the full form of URI?
a. Uniform Resource Identifier
b. Universal Resource Interface
c. Unique Reference Identifier
d. Unified Resource Index
54. What is the full form of WWW?
a. World Wide Web
b. Wide World Web
c. Web Wide World
d. World Web Wide
55. What is the full form of DNS?
a. Domain Navigation Server
b. Domain Name Server
c. Digital Naming structure
d. Distributed Name Service
56. What is the full form of ISP?
a. Internet Server Protocol
b. Integrated Signal Processor
c. Internet Sharing Platform
d. Internet Service Provider
57. What is the full form of IP?
a. Internet Protocol
b. Internal Path
c. Integrated Port
d. Interlinked Packet
58. What is the full form of OUI?
a. Organizationally Unique Identifier
b. Online User Interface
c. Open Universal Identifier
d. Operational Unit Index
59. Which of the following best describes a WPAN?
a. A network that connects devices across a city using fiber optics
b. A network connecting personal devices within about 10 meters using technologies like Bluetooth
or Wi-Fi Direct

c. A global network of interlinked web pages accessed via browsers


d. A wired network connecting computers in an office using Ethernet cables(easy)
60. Why is LAN is considered comparatively secure?
a. It always uses fibre optics
b. Only authentic users within the network can access other computers or shared resources
c. Because it never connects to the internet
d. Because it uses abstract encryption methods.
61. Which of these is a common advantage of using a LAN in an office or campus?
a. Unlimited geographic coverage
b. Very low data transfer rates
c. Ability for users to share printers and upload/download files from a local server
d. Requirement for manual packet switching for each message. (average)
62. Ethernet is best defined as:
a. A type of modem used for long-distance links
b. A set of rules that defines how devices connect with each other through cables in a LAN
c. A wireless protocol for PANs
d. A browser for accessing the World Wide Web
63. Which of the following is a typical data rate range for LAN
a. 0.5 Mbps to 2 Mbps
b. 10 Mbps to 1000 Mbps
c. 10 Gbps to 100 Gbps
d. d. 1000 bps to 10 kbps
64. Which of the following best describes a Wide Area Network (WAN)?
a. A network that connects devices within a single room or building
b. A network that connects LANs and MANs across different geographical locations, possibly
across countries or continents
c. A personal network connecting devices within 10 metres
d. A network used only for cable TV distribution (easy)
65. Which of the following is the largest example of a WAN?
a. A university campus network
b. A home Wi-Fi network
c. The Internet
d. A Bluetooth connection between two phones
66. Which statement is true about how a WAN can be formed?
a. By connecting only wireless PANs together
b. By connecting a LAN to other LANs via wired or wireless media
c. By connecting devices using only USB cables
d. By connecting two devices using an RJ-45 cable only
67. Which organizations commonly use WANs to connect branches across different locations?
a. Small home users only
b. Large businesses, educational institutions, and government organisations
c. Single-room offices with one computer
d. Devices connected by Bluetooth
68. Which of the following is a typical purpose of a WAN?
a. To provide short-range high-speed sharing of a printer within a lab
b. To connect different branches of an organization in different cities or countries
c. To create a direct wired link between a phone and a laptop
d. To replace LANs in local classrooms
69. A company wants to connect its office in Delhi with its branch in Shimla and another branch overseas.
Which network type is most appropriate? (average/apply)
a. PAN
b. LAN
c. MAN
d. WAN
70. Which phrase correctly describes the relationship between the Internet and WANs?
a. The Internet is unrelated to WANs
b. The Internet is the largest WAN connecting billions of devices and millions of LANs
worldwide
c. The Internet is a PAN scaled down for homes
d. The Internet only connects devices within a campus.
71. Which of the following correctly describes an IP address?
a. A permanent hardware address burned into a network card.
b. A unique numeric address used to identify a node on an IP network.
c. A protocol for wireless communication
d. A web page address
72. An IPv4 address is written as four decimal numbers separated by periods because it is a:
a. 16-bit address
b. 64-bit address
c. 32-bit address
d. 128-bit address
73. Which of the following is a sample IPv4 address format?
a. 2001:CDBA:0000:0000:0000:0000:3257:9652
b. [Link]
c. [Link]/8
d. [Link]
74. Why was IPv6 introduced?
a. To replace Ethernet standards
b. To provide a larger address space because IPv4’s 32 bits were insufficient.
c. To reduce MAC address length
d. To convert decimal addresses into binary automatically
75. The network topology where data can be transmitted in only one direction is
a. Star
b. Ring
c. Mesh
d. Bus
76. Correct expansion form of HTTP is:
a. Hyperlink Text Transmit Protocol
b. Hyper Transfer Transmission Protocol
c. Hyper Text Transfer Protocol
d. Hypermedia Transmit Text Protocol
77. Conversion of the domain name of each web server to its corresponding IP address is
a. Network
b. Domain Name System
c. URI
d. Domain Name Resolution.
78. Printing documents within a building, can be done by using which type of network?
a. MAN
b. WAN
c. LAN
d. PAN
79. The device used for conversion between digital and analogue signal is
a. Modem
b. Repeater
c. Router
d. Switch(easy)
80. The approximate range of personal area networks is
a. 14 meters
b. 5 meters
c. 10 meters
d. 20 meters(easy)

Fill in the blanks


1. A -is a network device that receives data, analyses it, and forwards it between
networks.
(router)
2. When packets are too large for the outgoing network, a router can them into smaller
packets. (repackage)
3. A wireless router provides Wi-Fi access and usually also contains for wired Internet access.
(ports)
4. Home Wi-Fi routers commonly combine the functions of a router and to connect to the
ISP.(modem)
5. A gateway serves as the entry and point between an internal network and the
Internet. ( exit)
6. Gateways often maintain information about internal connection paths and identified paths of other
networks. (remote)
7. Gateways sit at the edge of a network, a is usually integrated with it for traffic filtering.
(firewall)
8. In ----- topology each device is connected directly to all other devices. (mesh)(easy/understanding)
9. In ------ networks are more reliable because multiple nodes can transmit simultaneously and there
are alternate routes if one node fails.(mesh)

10. A disadvantage of mesh topology is high and complex wiring due to many redundant
connections. (cabling cost)
11. In a ring topology each node is connected to other nodes, forming a closed loop. ( two)
12. Data transfer in classical ring topology is ---------- (unidirectional)
13. In bus topology every device connects to a single shared that transmits data in both
directions.(backbone )

14. Bus and ring topologies are----------- (less secured)


15. In star topology each device connects to a central device such as a
hub or a................ (switch)
16. A major risk in star topology is that failure of the device can lead to complete network
failure. (switch)

17. A tree or hybrid topology is a hierarchical arrangement that connects multiple LANs and combines basic
(topologies)
18. In star topology each device connects to a central device such as a hub or a
.(switch)
19. A major risk in star topology is that failure of the device can lead to complete network
failure. (switch)
20. A tree or hybrid topology is a hierarchical arrangement that connects multiple LANs and combines basic
(topologies)
CHAPTER - 11 DATA COMMUNICATION
1 MARK MCQ’S
1. The exchange of data between two or more connected devices is called
a) Bandwidth b) Data transfer rate
c) Protocol d) Data Communication
2. A Computer or any device which is capable of transferring data over a network is
a) Receiver b) Sender c) Message d) Communication media
3. A Computer or any device which is capable of accept data from the network is
a) Receiver b) Sender c) Message d) Communication media
4. The data or information that needs to be exchanged between the sender and receiver is called
a) Receiver b) Sender c) Message d) Communication media
5. The path through which the message travels between source and destination is called
a) Receiver b) Sender c) Message d) Communication media
6. Set of rules that need to followed by commination parties in order to have successful and reliable
data communication is called as
a) Receiver b) Sender c) Protocol d) Communication media
7. Bandwidth is measured in
a) bps b) Kbps c) Gbps d) Hertz(Hz)
8. MBps stands for
a) Megabyte per second b) Megabit per second
c) Measuring Byte per second d) Measuring Bit per second
9. Which of the following is a one way communication between two devices?
a) Half duplex b) Simplex c) Full duplex d) Half simplex
10. Example of simplex communication mode is
a) Walkie-Talkies b) Mobile c) TV d) Computer
11. Which of the following is a two way communication between two devices but only one device can
send data at a time?
a) Half duplex b) Simplex c) Full duplex d) Half simplex
12. Example of half duplex communication mode is
a) Walkie-Talkies b) Mobile c) TV d) Computer
13. A two way communication in which both devices can send and receive data simultaneously is
called
a) Half duplex b) Simplex c) Full duplex d) Half simplex
14. Example of full duplex communication mode is
a) Walkie-Talkies b) Fan c) TV d) Computer
15. Data is transferred through a physical links or cables is called
a) Guide media b) Unguided media c) Data transfer d) Switching
16. Data is transferred in air through electromagnetic waves is called
a) Guide media b) Unguided media c) Data transfer d) Switching
17. UTP stands for
a) Un twisted pair b) Unit twisted pair
c) Unshielded twisted pair d) Urban twisted pair
18. STP stands for
a) Switching twisted pair b) Shielded twisted pair
c) Soft twisted pair d) Signal twisted pair
19. A short range wireless technology that can be used to connect mobile-phones, mouse, headphones,
keyboards is called
a) LAN b) WAN c) Bluetooth d) Tablet
20. HTTP stands for
a) HeaderText Transfer protocol b) HyperText Transfer Protocol
c) HighText Transfer Protocol d) HomeText Transfer protocol
21. FTP stands for
a) Fibre Transfer protocol b) Fact Transfer Protocol
c) File Transfer Protocol d) Firewall Transfer protocol
22. PPP stands for
a) Point-to Point Protocol b) Protocol-to Point Protocol
c) Peer-to Peer Protocol d) Packet-to Packet Protocol
23. ISP stands for
a) Industry Service Provider b) Intel Service Provider
c) Infrared Service Provider d) Internet Service Provider
24. SMTP stands for
a) Single Mail Transfer Protocol b) Simple Mail Transfer Protocol
c) Service Mail Transfer Protocol d) Set Mail Transfer Protocol
25. TCP/IP stands for
a) Transmission Control Protocol/Internet Protocol
b) Transfer Control Protocol/Internet Protocol
c) Transmit Control Protocol/Internet Protocol
d) Technology Control Protocol/Internet Protocol

FILLS IN THE BLANKS


(Twisted pair, Data transfer rate, Bandwidth, Circuit, Packets, Data)
1. Bandwidth is the range of frequencies available for transmission of data through that channel.
2. Data transfer rate is the number of bits transmitted between source and destination in one second.
3. Older telephone uses circuit switching technique.
4. In packet switching, information or message is broken down into small pieces called packets
5. Twisted pair cables are less expensive and most commonly used in telephone lines and
LAN‟s.
(SMTP, FTP, HTTP, HTML, WAN, LAN)
1. HTTP is the primary protocol to access the world wide web.
2. HTML language is used to create web pages
3. FTP protocol is used to transfer files from one machine to another.
4. The protocol used for email services is SMTP.
5. The network that cover largest area is WAN.
CHAPTER-12 SECURITY ASPECTS
1 MARK MCQ’S

1. Network security is concerned with


a) Protection of CPU b) Protection of Application software
c) Protection of our devices and data d) protection of Web camera
2. The software that is developed to damage hardware devices, steal data or cause any other trouble to
the user is called
a) Virus b) Worms c) Ransomeware d) Malware
3. A piece of software code that harm your computer resources like CPU time, memory , personal
files or sensitive information is called
a) Virus b) Worms c) Ransomeware d) Malware
4. A malware that incurs unexpected or damaging behavior on an infected computer system is
a) Virus b) Worms c) Ransomeware d) Malware
5. Which type of malware targets user data?
a) Virus b) Worms c) Ransomeware d) Malware
6. A virus spread through email, downloading and executing files from the internet is called.
a) Virus b) Worms c) Trojan d) Malware
7. Which type of malware records and send collected information to an external entity without
knowledge of the user?
a) Virus b) Worms c) Trojan d) Spyware
8. Which type of malware displays online advertisements using pop-ups?
a) Virus b) Adware c) Trojan d) Spyware
9. A software is used to detect and remove viruses is called.
a) Virus b) Adware c) Anti-Virus d) Spyware
10. A malware or hardware used to record the keys pressed by a user on the keyboard is called.
a) Virtual Keyboard b) Keyloggers
c) Onscreen Keyboard d)Standard Keyboard
11. HTTPS stands for
a) Hypertext Transfer Protocol
b) Hypertext Transfer Protocol Software
c) Hypertext Transfer Protocol Secured
d) Hypertext Transfer Sandbox
12. A network security system designed to protect a trusted private network from unauthorized access
is called.
a) Firewall b) Spam c) Cookies d) Grey Hats
13. A small file or data packet, which is stored by website on the client‟s Computer, is called.
a) Firewall b) Spam c) Cookies d) Grey Hats
14. Choose the item not belonging to the group
a) Firewall b) Virus c) Worms d) Ransomeware
15. Which type of firewall placed on a computer to monitor the network?
a) E-mail Firewall b) Network firewall
c) Host-based firewall d) White hat firewall
16. The person with skill to take control of other‟s computer system, he is called.
a) Thief b) Surfer c) Browser d) Hacker
17. Hackers with good intention are called.
a) Black hats b) White Hats c) Grey Hats d) Hacker
18. If hackers use their knowledge to unethically break the laws, then they are called.
a) Black hats b) White Hats c) Grey Hats d) Hacker
19. DoS stands for
a) Distributed Of services
b) Denial of services
c) Depends on services
d) Due of services
20. Snooping means
a) Secretly transferring data file
b) Secretly sending emails
c) Secretly listening to a conversation
d) Secretly watching online activities
FILLS IN THE BLANK
(Network firewall, HTTP, HTTPS, Worms, Ransomware, Trojan)
1. Worms are standalone programs that are capable of working on it‟s own.
2. Ransomware malware target user data.
3. Malware that does not self-replicate or infect other files is Trojan.
4. HTTP sends information over the network.
5. Netwok firewall placed between two or more networks and monitors the traffic between
different networks.
(White Hats, Black Hats, Cookies, Spam, Host based firewall, virus)
1. Cookies are used by the websites to store browsing information of the user.
2. White hats uses his knowledge to find and help in fixing the security flaws in the system.
3. Any unwanted data, information, email, advertisement is called Spam.
4. Firewall placed on computers and monitors the network traffic.
5. Black hats uses his knowledge unethically break the law.

You might also like