Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 75

File Handling in Python Class 12

Q1. Which statement will read 5 characters from a file(file object


‘f’)?

a. f.read()

b. f.read(5)

c. f.reads(5)

d. None of the above

Q2. Which function open file in python?

a. open( )

b. new( )

c. Open( )

d. None of the above

Q3. Processing of Text file is faster than binary files.(T/F)

a. True

b. False

Q4. Which mode create new file if the file does not exist?

a. write mode

b. append mode

c. Both of the above

d. None of the above

Q5. Which statement will return one line from a file (file object is
‘f’)?
a. f.readline( )

b. f.readlines( )

c. f.read( )

d. f.line( )

Show Answer

Q6. readlines() method return _________

a. String

b. List

c. Dictionary

d. Tuple

Q7. EOF stands for _________________

a. End of File

b. End off File

c. End on File

d. End or File

Q8. Which function is used to read data from Text File?

a. read( )

b. writelines( )

c. pickle( )

d. dump( )

Q9. Which of the following will read entire content of file(file


object ‘f’)?

a. f.reads( )
b. f.read( )

c. f.read(all)

d. f.read( * )

Q10. Which symbol is used for append mode?

a. ap

b. a

c. w

d. app

Q11. Which of the following options can be used to read the first
line of a text file data.txt?

a. f = open(‘data.txt’); f.read()

b. f = open(‘data.txt’,’r’); f.read(n)

c. myfile = open(‘data.txt’); f.readline()

d. f = open(‘data.txt’); f.readlines()

Show Answer

Q12. File in python is treated as sequence of ________________

a. Bytes

b. Bites

c. bits

d. None of the above

Q13. Which function is used to write data in binary mode?

a. write

b. writelines
c. pickle

d. dump

Q15. Let the file pointer is at the end of 3rd line in a text file
named “data.txt”. Which of the following option can be used to
read all the remaining lines?

a. f.read( )

b. f.read(all)

c. f.readline( )

d. f.readlines( )

Show Answer

File Handling in Python Class 12 MCQ

Q16. ____________________ module is used for serializing and


de-serializing any Python object structure.

a. pickle

b. unpickle

c. pandas

d. math

Q17. Which of the following error is returned when we try to open


a file in write mode which does not exist?

a. FileNotFoundError

b. FileFoundError

c. FileNotExistError

d. None of the above


Q18. ______________ function returns the strings.

a. read( )

b. readline( )

c. Both of the above

d. None of the above

Q19. The syntax of seek() is: file_object.seek(offset [,


reference_point])

What is reference_point indicate?

a. reference_point indicates the starting position of the file object

b. reference_point indicates the ending position of the file object

c. reference_point indicates the current position of the file object

d. None of the above.

Q20. Identify the invalid mode from the following.

a. a

b. r+

c. ar+

d. w

Q21. Which of the following is an invalid mode of file opening?


a. read only mode

b. write only mode

c. read and write mode

d. write and append mode

Q22. readlines( ) function returns all the words of the file in the
form of List. (T/F)

a. True

b. False

Q23. What is ‘f’ in the following statement?

f=open("Data.txt" , "r")

a. File Name

b. File Handle

c. Mode of file

d. File Handling

Q24. What is full form of CSV

a. Comma Separation Value

b. Comma Separated Value

c. Common Syntax Value

d. Comma Separated Variable


Q25. Which statement will open file “data.txt” in append mode?

a. f = open(“data.txt” , “a”)

b. f = Open(“data.txt” , “ab”)

c. f = new(“data.txt” , “a”)

d. open(“data.txt” , “a”)

File Handling in Python Class 12 MCQ

Q26. Fill in the blank

import pickle
f=open("data.dat",'rb')
d=_____________________.load(f)
f.close()
a. unpickle

b. pickling

c. pickle

d. pick

Show Answer

Q28. What error is returned by the following statement if the file


does not exist?

f=open("A.txt")
a. FileNotFoundError

b. NotFoundError

c. FileNotFound

d. FoundError
Show Answer

File Handling in Python Class 12 MCQ

Q31. Almost all the files in our computer stored as _______ File.

a. Text

b. Binary

c. CSV

d. None of the above

Q32. Binary files are not in human readable format.(T/F)

a. True

b. False

Q33. .pdf and .doc are examples of __________ files.

a. Text

b. Binary

c. CSV

d. None of the above

Q34. The syntax of seek() is:file_object.seek(offset [,


reference_point]) What all values can be given as a reference
point?

a. 1

b. 2
c. 0

d. All of the above

Show Answer

Q35. There is no delimiter to end a line in binary files.(T/F)

a. True

b. False

Show Answer

File Handling in Python Class 12 MCQ

Q36. seek( ) method is used for random access to the file.(T/F)

a. True

b. False

Q41. The syntax of seek() is:file_object.seek(offset [,


reference_point] What is the default value of reference_point

a. 0

b. 1

c. 2

d. 3

Show Answer

Q42. _______ function returns the current position of file pointer.

a. get( )

b. tell( )

c. cur( )
d. seek( )

Show Answer

Q43. f.seek(10,0) will move 10 bytes forward from beginning of


file.(T/F)

a. True

b. False

Show Answer

Q44. Which statement will move file pointer 10 bytes backward


from current position.

a. f.seek(-10, 0)

b. f.seek(10, 0)

c. f.seek(-10, 1)

d. None of the above

Show Answer

Q45. When we open file in append mode the file pointer is at


the _________ of the file.

a. end

b. beginning

c. anywhere in between the file

d. second line of the file

Show Answer

File Handling in Python Class 12 MCQ

Q46. When we open file in write mode the file pointer is at


the _______ of the file.
a. end

b. beginning

c. anywhere in between the file

d. second line of the file

Q51. A _____________ is a named location on a secondary


storage media where data are permanently stored for later
access.

a. file

b. variable

c. comment

d. token

Show Answer

Q52. A _____ file consists of human readable characters.

a. Binary

b. Text

c. Both of the above

d. None of the above

Show Answer

Q53. Which of the following file require specific programs to


access its contents?

a. Binary

b. Text

c. CSV

d. None of the above


Show Answer

Q54. Which of the following file can be opened in any text editor?

a. Binary

b. Text

c. Both of the above

d. None of the above

Show Answer

Q55. Each line of a text file is terminated by a special character,


called the ________

a. End of File

b. End of Line

c. End of Statement

d. End of program

Show Answer

File Handling in Python Class 12 MCQ

Q56. Default EOL character in text file is ________

a. \n

b. \N

c. \t

d. \l

Show Answer

Q57. Which of the following file can be created in python?


a. Text File

b. Binary File

c. CSV File

d. All of the above

Show Answer

Q58. In which of the following data store permanently?

a. File

b. Variable

c. Both of the above

d. None of the above

Show Answer

Q59. open( ) function takes ____ as parameter.

a. File name

b. Access mode

c. Both of the above

d. None of the above

Q63. Write the output of the following:

>>> f = open("test.txt","w")
>>> f.mode
a. ‘w’

b. ‘r’

c. ‘a’

d. ‘w+’
Q64. Write the output of the following:

>>> f = open("test.txt","w")
>>> f.name
a. ‘test’

b. ‘test.txt’

c. ‘test.dat’

d. file does not exist

Q67. Ravi opened a file in python using open( ) function but


forgot to specify the mode. In which mode the file will open?

a. write

b. append

c. read

d. read and write both

Show Answer

Q69. Which of the following mode will create a new file, if the file
does not exist?

a. ‘a’

b. ‘a+’

c. ‘+a’

d. All of the above

Show Answer

Q70. Which of the following mode will open the file in binary and
read-only mode.
a. ‘r’

b. ‘rb’

c. ‘r+’

d. ‘rb+’

Q71. Which of the following mode will opens the file in read, write
and binary mode?

a. ‘wb+

b. ‘+wb’

c. Both of the above

d. None of the above

Show Answer

Q72. In the given statement, the file myfile.txt will open


in _______________ mode.

myObject=open(“myfile.txt”, “a+”)
a. append and read

b. append and write

c. append and read and binary

d. All of the above

Show Answer

Q73. Ravi opened the file myfile.txt in append mode. In this file
the file object/file handle will be at the __________

a. beginning of the file

b. end of the file

c. second line of the file


d. the end of the first line

Show Answer

Q74. Ravi opened the file myfile.txt in write mode. In this file the
file object/file handle will be at the ______________

a. beginning of the file

b. end of the file

c. second line of the file

d. the end of the first line

Show Answer

Q75. Ravi opened the file myfile.txt in read mode. In this file the
file object/file handle will be at the _______________

a. beginning of the file

b. end of the file

c. second line of the file

d. the end of the first line

Q76. Ravi opened a file in a certain mode. After opening the file,
he forgot the mode. One interesting fact about that mode is ” If
the file already exists, all the contents will be overwritten”. Help
him to identify the correct mode.

a. read mode

b. write mode

c. append mode

d. binary and read mode

Show Answer
Q78. Which of the following function is used to close the file?

a. close( )

b. end( )

c. quit( )

d. exit( )

Show Answer

Q79. open( ) function returns a file object called ______________

a. object handle

b. file handle

c. read handle

d. write handle

Show Answer

Q80. Which of the following is the valid way to open the file?

a. with open (file_name, access_mode) as fo:

b. fo = open (file_name, access_mode)

c. Both of the above

d. None of the above

Show Answer

Q81. Rohan opened the file “myfile.txt” by using the following


syntax. His friend told him few advantages of the given syntax.
Help him to identify the correct advantage.

with open ("myfile.txt", "a") as file_object:


a. In case the user forgets to close the file explicitly the file will closed
automatically.
b. file handle will always be present in the beginning of the file even in append
mode.

c. File will be processed faster

d. None of the above

Show Answer

Q82. Mohan wants to open the file to add some more content in
the already existing file. Suggest him the suitable mode to open
the file.

a. read mode

b. append mode

c. write mode

d. All of the above

Exception Handling MCQ Class 12 RBSE


1. The process of creating an exception object and handing it over to the runtime system is called
…………. an exception

1. Growing
2. Throwing
3. Executing
4. Handling

2. The syntax of raise statement is:

1. raise exception-name ((optional argument))


2. raise exception-name {(optional argument)}
3. raise exception-name [(optional argument)]
4. None of the above

3. The statements inside the finally block are always executed regardless of whether an exception
occurred in the try block or not.
1. True
2. False
3. Depend on code
4. None of the above

4. An exception is caught in the …….. block and handles in ……….. block.

1. except, try
2. try, except
3. EOF, Error
4. program, compile

5. Syntax errors are also handled as exceptions

1. False
2. True
3. Some times
4. None of the above

6. An exception is a Python object that represents an ………….

1. Logic
2. Expression
3. Error
4. Module

7. What keeps track of the exact position where the error has occurred.

1. Compiler
2. Interpreter
3. Both 1 and 2
4. None of the above

8. Exception handling can be done for:

1. user-defined
2. built-in
3. Both 1 and 2
4. None

9. Commonly Built in exception:

1. Value Error
2. Import Error
3. Type Error
4. All the above
10. An exception is a Python ………… that represents an error.

1. Class
2. Method
3. Object
4. All the above

Chapter -3(stack)

1. Process of inserting an element in stack is called ____________


a) Create
b) Push
c) Evaluation
d) Pop
View Answer

2. Process of removing an element from stack is called __________


a) Create
b) Push
c) Evaluation
d) Pop
View Answer

3. In a stack, if a user tries to remove an element from an empty stack it is called


_________
a) Underflow
b) Empty collection
c) Overflow
d) Garbage Collection

4. Pushing an element into stack already having five elements and stack size of 5, then
stack becomes ___________
a) Overflow
b) Crash
c) Underflow
d) User flow

[2] A stack is one of the following types of data structure?

a) Linear c) Circular d) All of these

[3] Stack data structure is following ____________ principle.


LIFO

[4] In stack data can be inserted or deleted from ____________ only.

Top

[5] The insert operation in the stack is known as pop. (True/False)

[6] You can replace any element position in the stack. (True/False)

[7] The peek operation refers to accessing/inspecting the top element in the stack.
(True/False)

[8] A condition raise due to the stack is full is known as ___________.

a) Underflow b) Overflow c) List is full d) Completely Filled

[9] While popping the element from the stack, a condition will be raised, this condition is
known as ____________.

a) Underflow b) Overflow c) List is Empty d) Blank List

[10] Stack overflow condition is raised in ____________ operation where as Stack


underflow condition is raised in _____________ operations.

Push, Pop

[1] What do you mean by data structure? Explain your answer with a
suitable example.

”Hide_Answer”

Ans.: The systematic way of organization,storing, accessing and retrieving data


including well-defined operations, behaviour and propeties is known as data
structure.
Examples:
1. String – Contains sequence of characters
2. List – Contains sequence of different data types
[2] What do you mean by the LIFO structure? Support your answer with
real-life examples.

”Hide_Answer”

Ans.: LIFO is one of the principle to access data from a data structure. It stands
for Last In First Out. It refers to the item which is inserted last will be access frist.
So the top element will be accessed first.
Example:
1. Books in the shelf
2. Stack of coins
3. Pile of chairs
4. Bangles on woman’s wrist
[3] Enlist a few of the fields where you feel a stack is used in real life.

”Hide_Answer”

Ans.: The stack is used in many fields in our routine life. Some examples are:
1. Browsers History
2. Mobile Phone Call log
3. Tubewell boring machine
4. Undo and redo commands in software
[4] What are the basic operations that can be performed on the stack?

Ans.: There are two basic operations can be performed on the stack:
1. Push – Inserting an element
2. Pop – Deleting an element
[5] What are the underflow and overflow conditions?

Ans.: Underflow is the condition which occurs when stack is empty while trying to
delete elements. Overflow is the condition which occurs while inerting an element
when memory is exhausted.
[6] Write steps on how you implement stack?

Ans.: The steps are:


1. Create a stack
2. Push an element
3. Pop an element
4. Traverse/Display an element

1. Alinear list of elements in which deletion can be done from one end (front) and
insertion can take
place only at the other end (rear) is known as a ?

a) Queue

b) Stack
©) Tree

d) Linked list
14. A data structure in which elements can be inserted or deleted at/from both
the ends but not in the
middle is?

a) Queue

b) Circular queue

¢) Dequeue

d) Priority queue

Q-) Exception Handling Python MCQ


techtipnow.in/exception-handling-python-mcq
June 24, 2022
Get latest and Best Python Exception Handling MCQ with answers for those preparing
for Computer Science, Information Technology, Informatics Practices, Python
Programming, CUET etc. compiled by well experienced and qualified IT experts.

1. ______ is a type of errors produce in python programs

a. Compile time error


b. Run time error
c. Both (a) and (b)
d. None of these

Show Answer

c. Both (a) and (b)

2. On encountering a _________ error, the interpreter does not execute the


program unless we rectify errors, save and rerun the programs.

a. Syntax error
b. Logical error
c. Runtime error
d. All of the above

Show Answer
a. Syntax error

3. Look at the following code and select the correct description of error shown while
executing it:

X = int(input(“Enter a Number”))
R = X*X
print “Square =”,R

a. can only concatenate str (not “int”) to str


b. missing parenthesis in call to ‘print’
c. name ‘Print’ is not defined
d. none of the above

Show Answer

b. missing parenthesis in call to ‘print’

4. ________ is a python object that represents an error.

a. Interpreter
b. Compiler
c. Exception
d. Module

Show Answer

c. Exception

5. (i) generally all exceptions are generated when a program is syntactically correct
(ii) SyntaxError is not considered as exception.

a. (i) True, (ii) False


b. (i) False, (ii) True
c. Both are True
d. Both are False

Show Answer

a. (i) True, (ii) False

6. When an error occurs during the execution of a program, an exception is said to


have been _____
a. Created
b. Asserted
b.
c. Triggered
d. Raised

Show Answer

d. Raised

7. Which of the following is not a built in exception in python?

a. SyntaxError
b. ValueError
c. ZeroDivisionError
d. ExportError

Show Answer

d. ExportError

8. It is raised when the file specified in a program statement cannot be opened.

a. NameError
b. IOError
c. ImportError
d. EOFError

Show Answer

b. IOError

9. It is raised when local or global variable is not defined

a. NameError
b. ValueError
c. TypeError
d. ZeroDivisionError

Show Answer

a. NameError

10. It is raised when the denominator in a division is not found

a. IOError
b. ValueError
c. TypeError
d. ZeroDivisionError

Show Answer

d. ZeroDivisionError

11. When you accept string instead of integer value,____ is raised.

a. TypeError
b. ValueError
c. NameError
d. SyntaxError

Show Answer

b. ValueError

12. It is raised when user accidently hits the Delete or Esc key while executing a
program

a. TypeError
b. ValueError
c. KeyboardInterrupt
d. IOError

Show Answer

c. KeyboardInterrupt

13. It is raised when requested module definition is not found

a. NameError
b.ImportError
c. TypeError
d. IndentationError

Show Answer

b.ImportError

14. It is raised due to incorrect indentation in the program

a. IndentationError
b. IOError
c. SyntaxError
d. TypeError

Show Answer

a. IndentationError

15. It is raised when the result of a calculation exceeds the maximum limit for
numeric data type

a. ZeroDivisionError
b. OverFlowError
c. TypeError
d. ValueError

Show Answer

b. OverFlowError

16. The process of creating exception object and handing it over to runtime system is
called

a. Catching Exception
b. Throwing Exception
c. Raising Exception
d. Asserting Exception

Show Answer

b. Throwing Exception

17. Searching and executing appropriate exception handler that can handle the
raised exception

a. Catching exception
b. Throwing exception
c. Handling exception
d. Asserting exception

Show Answer

a. Catching exception

18. An exception is said to be caught when


a. Error encountered and exception object is created
b. Runtime system searches for appropriate exception handler
c. Code that is designed to handle exception is executed
d. None of these

Show Answer

c. Code that is designed to handle exception is executed

19. Which of the following describes the exception handling process correctly?

a. Exception raised -> searches for exception handler -> create exception object
-> execute code of exception handler
b. Exception raised -> create exception object -> searches for exception handler
-> execute code of exception handler
c. Create exception object -> exception raised -> searcher for exception handler -
> execute code of exception handler
d. Create exception object -> searches for exception handler -> exception raised
-> execute code of exception handler

Show Answer

c. Create exception object -> exception raised -> searcher for exception handler ->
execute code of exception handler

20. Exceptions are caught in

a. Try block
b. Except block
c. Finally block
d. Else block

Show Answer

a. Try block

21. Exceptions are handled in

a. Try block
b. Except block
c. Finally block
d. Else block

Show Answer

b. Except block
22. The statement written inside _____ block is always executed regardless of
whether an exception has occurred or not

a. Try
b. Except
c. Else
d. Finally

Show Answer

d. Finally

23. Which of the following statement is not true about try..except block?

a. Every try block must be followed by at least an except block


b. A try block can be followed by more than one except block
c. The statement inside the except block is always executed regardless of
whether exception has occurred in try block or not
d. An except clause can be added without specifying any exception

Show Answer

c. The statement inside the except block is always executed regardless of whether
exception has occurred in try block or not

24. Which of the following is not true?

(i) The statement inside else block is executed regardless of whether there
except block is executed or not.
(ii) If an exception is encountered, further execution of the code inside the try
block is stopped and control is transferred to except block

a. (i) True, (ii) False


b. (i) False, (ii) True
c. Both (i) and (ii) are True
d. Both (i) and (ii) are False

Show Answer

b. (i) False, (ii) True

25. Which of the following is not true?

a. Code that might cause exception is put inside try block


b. An except block is executed only if some exception is raised in the try block
c. Finally block can be placed anywhere after end of try clause, such as before or
after all except and else block
d. If an exception is encountered, further execution of the code inside the try
block is stopped and control is transferred to except block

Show Answer

c. Finally block can be placed anywhere after end of try clause, such as before or after
all except and else block

26. The ______ is an exception handler

a. Try
b. Except
c. Finally
d. Else

Show Answer

b. Except

27. The keyword used with exception handling are

a. Raise, assert, throw, catch


b. Try, except, throw, catch
c. Try, except, else, finally
d. Throw, catch, finally, assert

Show Answer

c. Try, except, else, finally

28. Which of the following keyword is not part of exception handling?

a. Try
b. Catch
c. Except
d. Finally

Show Answer

b. Catch

29. If the exception is not handled by any of the except clauses, then it is re-raised
after the execution of the finally block.
a. True
b. False
c. Cant say
d. None of these

Show Answer

a. True

30. Advantage(s) of using exception handling in python is/are:

a. It maintains normal flow of program


b. It avoid the program getting crashed
c. Separate main logic of the program from error detection and correction code
d. All of above

Show Answer

d. All of above

31. Advantage(s) of using exception handling in python is/are:

a. Ensures that program does not terminate abnormally due to any error
b. Provide standardize solutions for commonly occurring errors (exceptions)
c. Both (a) and (b)
d. Only (a)
e. None of these

Show Answer

c. Both (a) and (b)

32. What will happen If finally and except blocks are not positioned properly

a. Program will execute, but will not display anything


b. Program will throw exception when executed
c. Program will not be compiled
d. Program will execute successfully

Show Answer

c. Program will not be compiled

33. Each try block must always be followed by at least one block that is either except
or a finally block.
a. True
b. False
c. May be
d. None of these

Show Answer

a. True

34. The ______ block is generally used to while working with files, clean up memory
resources

a. Try
b. Except
c. Finally
d. Else

Show Answer

c. Finally

35. Consider the given code and fill in the blanks:

try:
X = int(input(“enter a number”))
except ___________:
print(“please enter only numbers”)
else:
print(“Squeare =”,X*X)

a. IOException
b. ValueError
c. ZeroDivisionError
d. TypeError

Show Answer

b. ValueError

36. Consider the given code and fill in the blank space with appropriate exception
object name.

try:
X = int(input(“enter a number”))
R = X*Y
except ___________ :
Print(“Please check Y is not defined”)
else:
Print(“Result =”,R)

a. TypeError
b. NameError
c. IOerror
d. IndexError

Show Answer

b. NameError

37. Identify the type of exception will be thrown by given code:

L=[12,32,40]
print(L[4])

a. IndexError
b. ZeroDivisionError
c. IOError
d. TypeError

Show Answer

a. IndexError

38. Look at the given code and fill in the blank space

try:
num1 = 10
num2 = 0
q = num1/num2
except ___________:
print(“Division is not possible as num2 is set to 0”)
____________:
print(“quotient = “,q)

a. ZeroDivisionError, finally
b. ZeroDivisionError, else
c. ValueError, finally
d. ValueError, else

Show Answer

b. ZeroDivisionError, else
39. Rajesh has written following line of code to import python pandas library but he is
getting error while executing. Help him in handling and correcting given code.

Import panda as pd
S = pd.Series[12,23,34]

a.
try:
import panda as pd
S = pd.Series[12,23,34]
except NameError:
print(“Please check the name of module you are importing”)

b.
try:
import panda as pd
S = pd.Series[12,23,34]
except ImportError:
print(“Please check the name of module you are importing”)

c.
try:
import panda as pd
S = pd.Series[12,23,34]
except IOError:
print(“Please check the name of module you are importing”)

d.
try:
import panda as pd
S = pd.Series[12,23,34]
except SyntaxError:
print(“Please check the name of module you are importing”)

Show Answer

b.
try:
import panda as pd
S = pd.Series[12,23,34]
except ImportError:
print(“Please check the name of module you are importing”)

40. Consider the following code and select the type of error it will generate.

print(“exception handling program”)


try:
int x = 10
if x%2 == 0:
print(“even no”)
else:
print(“odd no”)

a. SyntaxError
b. Runtime error
c. Logical Error
d. No Error will be generated

Show Answer

Computer Network MCQ | CBSE Computer Science


Questions
techtipnow.in/computer-network-mcq

July 15, 2022

Get computer network mcq helpful for all competitive exams, cucet computer science,
informatics practices and other IT based entrance.

1. ARPANET stands for?

a. American research project agency network


b. Advance research project agency network
c. Advance research project American network
d. American research project advance network

Show Answer

b. Advance research project agency network

2. Which if the following is not a topology?


a. Star
b. Mesh
c. Tree
d. Hierarchy

Show Answer

d. Hierarchy

3. Identify the type of network in given diagram

a. LAN
b. WAN
c. MAN
d. PAN

Show Answer

d. PAN

4. Identify the correct topology which has following characteristics:


(i) its very easy to diagnose the fault in this topology
(ii) failure of central nub/switch leads to failure of the entire network

a. Bus
b. Ring
c. Star
d. Tree

Show Answer

c. Star

5. MAN stands for

a. Main area network


b. Metropolitan area network
c. Most available network
d. Metro access network

Show Answer
b. Metropolitan area network

6. Each IP packet consider

a. Only source address


b. Only destination address
c. Source and destination address
d. None of these

Show Answer

c. Source and destination address

7. Select the correct sequence regarding evolution of computer network

a. ARPANET-> EMAIL->NSFNET ->WWW


b. ARPANET->NSFNET->EMAIL->WWW
c. WWW->ARPANET->NSFNET->EMAIL
d. WWW->ARPANET->EMAIL->NSFNET

Show Answer

a. ARPANET-> EMAIL->NSFNET ->WWW

8. 802.11 represents:

a. Internet Protocol
b. WiFi
c. Bluetooth
d. www

Show Answer

b. WiFi

9. State Bank of India is an example of

a. LAN
b. WAN
c. MAN
d. PAN

Show Answer

b. WAN
10. The device that regenerates a signal being transmitted on the network is
called

a. Router
b. Modem
c. Gateway
d. Repeater

Show Answer

d. Repeater

11. I am known as Intelligent hub and I provide packet filtering

a. Hub
b. Switch
c. Router
d. Modem

Show Answer

b. Switch

12. is

a. Tree topology
b. Bus topology
c. Star topology
d. Ring topology

Show Answer

b. Bus topology

13. Your school is planning to link its front office situated in hilly region where
cable connection is not feasible, suggest an economic way to connect it
with reasonably high speed

a. Bluetooth
b. FM
c. Satellite
d. None of these

Show Answer
c. Satellite

14. Refer the given diagram and identify which of the device acts as a Server?

a. A
b. B
c. C
d. D

Show Answer

c. C

o. Which of the following is not true about star topology

a. All communication devices are connected to a single cable called backbone


b. Adding node in it is easy
c. It is expensive as compared to Bus topology
d. Chances of data collision is less

Show Answer

a. All communication devices are connected to a single cable called backbone

16. Govt Hr Sec School has a computer network. The network is in one
building. What kind of network it is?

a. LAN
b. WAN
c. MAN
d. PAN

Show Answer

a. LAN

17. When you connect two mobiles using Bluetooth to transfer a picture or file,
which type of network is found?

a. LAN
b. WAN
c. MAN
d. PAN

Show Answer

d. PAN

18. The _______ is computer that provide service to other programs or


computers

a. Client
b. Server
c. Communication channel
d. Adapter

Show Answer

b. Server

19. The ______ topology is combination of star and bus topology

a. Ring
b. Mesh
c. Tree
d. All of above

Show Answer

c. Tree

20. Identify the device which can connect dissimilar network

a. Router
b. Gateway
c. Modem
d. Both (a) and (b)

Show Answer

d. Both (a) and (b)

21. In MAC Address MAC stands for

a. Media Access Control


b. Media Access Communication
c. Metropolitan Area Communication
d. Metropolitan Area Connection

Show Answer

a. Media Access Control

22. MAC address is made up of _____

a. 12 digit Binary number


b. 12 digit Hexadecimal number
c. 12 digit Octal number
d. 12 digit Decimal number

Show Answer

b. 12 digit Hexadecimal number

23. To identify each node uniquely in a computer network __________ address


is assigned

a. TCP/IP
b. IP
c. MAC
d. TCP

Show Answer

b. IP

24. IPV4 is

a. Version of IP Address
b. Version of TCP Address
c. Version of MAC address
d. Version of WiFI

Show Answer

a. Version of IP Address

25. IPV4 comprises of

a. 16 bit numeric address


b. 32 bit numeric address
c. 64 bit numeric address
d. 128 bit numeric address

Show Answer

b. 32 bit numeric address

26. IPV6 comprises of

a. 16 bit numeric address


b. 32 bit numeric address
c. 64 bit numeric address
d. 128 bit numeric address

Show Answer

d. 128 bit numeric address

27. (i) MAC address once assigned to network adapter can not be changed
(ii) IP address assigned to a node in a network can be changed
conditionally

a. Both are true


b. Both are false
c. (i) true, (ii) false
d. (i) false, (ii) true

Show Answer

a. Both are true

Data Communication MCQ Computer Science


techtipnow.in/data-communication-mcq-computer-science

July 9, 2022
Get MCQ based on Data Communication best suitable for all competitive exams,
entrance exams, computer science, CUET, informatics practices or any other IT
perusal.

1. Which of the following is not the component of Data Communication?

a. Message
b. Sender
c. Channel
d. Producer

Show Answer

d. Producer

2. Medium or path through which data or message travels between source and
destination is

a. Protocol
b. Channel or Media
c. Server
d. Bandwidth

Show Answer

b. Channel or Media

3. Set of rules that needs to be followed by different components of communication


system in order to have reliable and successful communication is

a. Protocol
b. Channel or Media
c. Bandwidth
d. Data Transfer Rate

Show Answer

a. Protocol

4. The capacity of a channel is measured in terms of :

a. Bandwidth
b. Data Transfer Rate
c. Both (a) and (b)
d. None of these
Show Answer

c. Both (a) and (b)

5. Bandwidth is measured in

a. Byte per second


b. Bit per second
c. Hertz
d. Amperes

Show Answer

c. Hertz

6. MBps stands for

a. Mega Bit Per Second


b. Mega Byte Per Second
c. Meta Bit Per Second
d. Meta Byte Per Second

Show Answer

b. Mega Byte Per Second

7. Mbps is

a. Mega Bit Per Second


b. Mega Byte Per Second
c. Meta Bit Per Second
d. Meta Byte Per Second

Show Answer

a. Mega Bit Per Second

8. The number of bits transmitted between source and destination in one second is
___________. It is measured in terms of _______

a. Bandwidth, hertz
b. Data transfer rate, hertz
c. Data communication rate, bandwidth
d. Data transfer rate, bits per second
Show Answer

d. Data transfer rate, bits per second

9. A user wants to upload a text document at the rate of 5 pages per 10 seconds.
What will be the required data rate of the channel? (Assume that 1 page contains
1200 characters and each character is of 8 bits.)

a. 6.25kbps
b. 4.69kbps
c. 19.2 kbps
d. None of these

Show Answer

b. 4.69kbps
hint:
(1200x5x8)/10
=4800 bps
=4800/1024
=4.69kbps

10. Walkie-talkie used by traffic police is type of

a. Simplex communication
b. Half duplex communication
c. Full duplex communication
d. None of these

Show Answer

b. Half duplex communication

11. Unguided transmission can also be referred as

a. Wired media
b. Wireless media
c. Both (a) and (b)
d. None of these

Show Answer

b. Wireless media

12. When data travels through physical link made of wire/cable between two nodes is
referred as
a. Guided transmission
b. Wired media
c. Unguided transmission
d. Wireless media
e. Both (a) and (b)

Show Answer

e. Both (a) and (b)

13. Which of the following is best suitable for long distance wired data
communication?

a. Twisted pair cable


b. Co-axial cable
c. Fiber-Optic cable
d. Copper cable

Show Answer

c. Fiber-Optic cable

1.
14. Look at the image given below and identify the wired transmission media:

a. Twisted pair cable


b. Co-axial cable
c. Fiber optic cable
d. Copper shielded cable

Show Answer

b. Co-axial cable

15. Which of the followings carries data as light

a. Twisted pair cable


b. Co-axial cable
c. Fiber optic cable
d. All of the above

Show Answer

c. Fiber optic cable


16. The number assigned by IEEE to wireless LAN is

a. 191.656.0.1
b. 802.11
c. IPV4
d. 6404

Show Answer

b. 802.11

17. (i) I am two way or bidirectional communication


(ii) Mobile phone uses me
(iii) using me data can be sent or received simultaneously at both the end

Who am I?

a. Simplex communication
b. Half Duplex communication
c. Full Duplex communication
d. None of these

Show Answer

c. Full Duplex communication

18. VoLTE stands for

a. Voice Over Long Travel Ends


b. Voice Over Left Turn engagement
c. Voice Over Long Term Evolution
d. Voice of Longest Territory Evolution

Show Answer

c. Voice Over Long Term Evolution

Computer Security Aspects MCQ


techtipnow.in/computer-security-aspects-mcq

July 13, 2022


find latest, unique and most imp computer security aspects mcq for all competitive and
entrance exams, cuet, CS, IP and IT students. it covers viruses, worms, trojan,
antivirus, firewall and many more..

1. Malware stands for

a. Malfunctioned Software
b. Malcontent Software
c. Malaysian Software
d. Malicious Software

Show Answer

d. Malicious Software

2. Which of the following is not a malware?

a. Viruses
b. Worms
c. Trojan
d. Cookies

Show Answer

d. Cookies

3. (i) virus is a piece of software code that is created to hamper system resources
and activated as soon as infected file is opened by user
(ii) Virus behaves uniformly without caring of reason or motivation behind their
creation

a. (i) True, (ii) False


b. (i) False, (ii) True
c. Both are true
d. Both are False

Show Answer

a. (i) True, (ii) False

4. I
Am a malware
Am standalone program and capable of working on my own.
Nimda, Code Red are some of my examples

Who am I?
a. Firewall
b. Worms
c. Trojan
d. Spyware

Show Answer

b. Worms

5. __________ looks like a legitimate software which once installed acts like a
virus.

a. Worm
b. Trojan
c. Spyware
d. Cookies

Show Answer

b. Trojan

6. Which of the following is usually annoying but harmless for system?

a. Spyware
b. Adware
c. Trojan
d. Worms

Show Answer

b. Adware

7. The virtual keyboard of an operating system that uses a fixed QWERTY key
layout is called

a. On-Screen Keyboard
b. Online Virtual Keyboard
c. Virtual Qwerty Keyboard
d. Virtual Keypad

Show Answer

a. On-Screen Keyboard

8. The virtual keyboard that randomizes the key layout every time it is used
a. On-Screen Keyboard
b. Online Virtual Keyboard
c. Virtual Qwerty Keyboard
d. Virtual Keypad

Show Answer

b. Online Virtual Keyboard

9. A malware once designed, can take many routes to reach your computer. Which
of the followings you think is not correct channel of distribution of malware:

a. Downloaded from the Internet into hard drive of computer by user unintentionally
b. Removable storage media infected with malware get transferred to other systems that
they are plugged into
c. Links or attached files with unsolicited email we receive can be malware
d. All are correct

Show Answer

d. All are correct

10. Raju has been asked to identify common sign of some malware infection. Help
him out to find so from given option:

a. Program opening and closing automatically.


b. Sudden lack of storage space, random sound starts to appear.
c. Computer get slow down with frequent crashes
d. All of the above
e. (b) and (c)

Show Answer

d. All of the above

11. Act of repeatedly sending advertisement links and invitation emails to a large
number of users is called:

a. Stacking
b. Hacking
c. Spamming
d. Denial of Service

Show Answer
c. Spamming

12. HTTPS is

a. Hypertext transfer protocol safe


b. Hypertext transfer protocol secure
c. Hypertext transfer protocol sensitive
d. Hypertext transfer protocol shared

Show Answer

b. Hypertext transfer protocol secure

13. To get HTTPS for your website you need to get

a. Purchase domain from Google only


b. Purchase domain with SSL
c. Purchase domain with Firewall
d. Purchase domain only

Show Answer

b. Purchase domain with SSL

14. It acts as a network filter and continuously monitors and controls the incoming
and outgoing traffic.

a. Antivirus
b. Firewall
c. SSL
d. Sandbox

Show Answer

b. Firewall

15. Cookies that gets recreated after being deleted is known as

a. Super cookies
b. Worm cookies
c. Nimda cookies
d. Zombie cookies

Show Answer
d. Zombie cookies

16. _______ is a malware that records the key pressed by user on the keyboard.
Using which one can get very sensitive and personal information of user like
password emails etc.

a. Spyware
b. Snooping
c. Key logger
d. Denial of Service

Show Answer

c. Key logger

17. Find the invalid method used by Antivirus to detect malware

a. Sandbox detection
b. Data mining technique
c. Firewall
d. Heuristics

Show Answer

c. Firewall

18. It’s a kind of system used by antivirus where a new application or file is executed
in a virtual machine (environment) to detect any malicious activity by observing
its behavior

a. Data mining
b. Sandbox
c. Heuristics
d. VDF (Virus Definition File)

Show Answer

b. Sandbox

19. Consecutive sequence of bytes that is commonly found in a certain malware


sample is referred as

a. Virus polymorphic
b. Sandbox
c. Virus Signature
d. None of these
Show Answer

c. Virus Signature

20. Method of comparing source code of a suspected program with already known
virus present in database of antivirus is known as

a. Sandbox detection
b. Real time protection
c. Heuristics
d. Firewall

Show Answer

c. Heuristics

DBMS Concept MCQ


techtipnow.in/dbms-concept-mcq

July 14, 2022

Database Concept mcq computer science class 12, CUET mcq computer science,
helpful for all competitive exams entrance exams and IT preparation

1. Which of the following constraint ignores NULL value?

a. UNIQUE
b. FOREIGN
c. CHECK
d. All of above

Show Answer

b. FOREIGN

2. Which is the correct difference between Primary key and Foreign key?

a. A table can have multiple primary key and single foreign key
b. A primary key cannot ignore NULL value but Foreign key can
c. A Primary key can have duplicate data but foreign key does not
d. None of the above

Show Answer
b. A primary key cannot ignore NULL value but Foreign key can

3. Which one of the following refers to the copies of the same data (or
information) occupying the memory space at multiple places.

a. Data Repository
b. Data Inconsistency
c. Data Mining
d. Data Redundancy

Show Answer

d. Data Redundancy

4. Which of the following refers to the number of attributes in a relation?

a. Degree
b. Row
c. Column
d. All of the above

Show Answer

a. Degree

5. Consider attributes ID, CITY and NAME. Which one of this can be
considered as a primary key?

a. NAME
b. ID
c. CITY
d. CITY, ID

Show Answer

b. ID

6. Which of the following is considered as DBMS ?

a. Access
b. Oracle
c. SQL Server
d. All of these

Show Answer
d. All of these

7. What will be cardinality and degree for given table ‘coach’?

Coachid Coachname Ag Sport Dateofap Pay Gender


e p

1 Karan 35 Karate 27/03/19 1000 M


0

2 Ravina 34 Karate 20/01/20 1200 F


0

3 Kamal 34 Squash 19/02/20 2000 M


0

4 Tarun 33 Basketball 01/01/20 1500 M


0

5 Sumeru 36 Swimming 12/01/20 7500 M

6 Anjani 36 Swimming 24/02/20 8000 F

7 Shamima 37 Squash 20/02/20 2200 F


0

8 Soumya 30 Karate 22/02/20 1100 F


0

a.
a. cardinality = 7, degree = 8
b. cardinality = 9, degree = 8
c. cardinality = 7, degree = 56
d. cardinality = 8, degree = 7

Show Answer

d. cardinality = 8, degree = 7

8. if degree of relation is 4 that means relation have

a. 4 tuples
b. 4 attributes
c. 4 state
d. 4 relations
Show Answer

b. 4 attributes

9. Relational model was developed by

a. E. F Codd
b. Richard Stallman
c. Guido Van Rossum
d. John Von Neumann

Show Answer

a. E. F Codd

10. For the given table ‘student’ having fields


admno, rollno, name, class, dob
identify the most suitable field for Primary key

a. Admno
b. Rno
c. Name
d. Class

Show Answer

a. Admno

11. A database management system is a _________ type of software

a. System software
b. Application software
c. General software
d. Both (a) and (c)

Show Answer

b. Application software

12. Which one of the following refers to the copies of the same data (or
information) occupying the memory space at multiple places.

a. Data Repository
b. Data Inconsistency
c. Data Mining
d. Data Redundancy
Show Answer

d. Data Redundancy

13. The term ‘Data’ refers to

a. The electronic presentation of the information


b. Basic information
c. Raw facts and figures
d. Both (a) and (c)

Show Answer

c. Raw facts and figures

14. Which of the following refers to the number of tuples on a relation?

a. Entity
b. Column
c. Cardinality
d. None of the above

Show Answer

c. Cardinality

15. In a relation, which of the following refers to the term ‘attribute’?

a. Entity
b. Row
c. Column
d. Both (b) and (c)

Show Answer

c. Column

16. __________ is used to represent the relationship between tables

a. Primary key
b. Foreign key
c. Unique key
d. Candidate key

Show Answer
b. Foreign key

17. Order(order_id, ccode, total)


here the order_id, ccode and total are _________ and Order is __________

a. Relation attribute
b. Attribute, relation
c. Degree, relation
d. Relation tuple

Show Answer

b. Attribute, relation

18. before DBMS information was stored using ________

a. Data System
b. Memory System
c. File System
d. Drive

Show Answer

c. File System

19. Storing records using DBMS helps in

a. Eliminates Data Redundancy


b. Maintain data consistency
c. Controlled data sharing
d. All of the above

Show Answer

d. All of the above

20. Collection of logically related records are called

a. Information
b. Relation
c. Database
d. Tuple

Show Answer
b. Relation

21. I
ensure every tuple is unique in relation
can be applied to only one attribute in a relation
can not accept NULL values
who am I?

a. Primary key
b. Unique key
c. Foreign key
d. Candidate key

Show Answer

a. Primary key

22. Which of the following is a real life application of DBMS?

a. Inventory Management
b. Banking
c. Online Shopping
d. All of the above

Show Answer

d. All of the above

23. Database schema refers to

a. Table name and their fields


b. Relationship among tables
c. Data stored in tables
d. (a) and (b)

Show Answer

d. (a) and (b)

24. When we define database schema(structure), database state is

a. 0
b. 1
c. Null
d. Equal to degree
Show Answer

a. 0

25. In RDBMS, R represents

a. Record
b. Relation
c. Relational
d. Referential

Show Answer

c. Relational

26. In a relation tuple represents a

a. Single cell
b. Single row
c. Single column
d. None of the above

Show Answer

b. Single row

27. Which following property is not observed with respect to RDBMS?

a. Sequence of attributes in a relation is immaterial


b. Tuples in a relation can be duplicated
c. No attribute can have many data value in one tuple
d. NULL is used to represent values that are unknown or non applicable to certain
attributes

Show Answer

b. Tuples in a relation can be duplicated

28. Restriction on the type of data that can be inserted into the table is

a. Database Schema
b. Database Instance
c. Database Constraint
d. Database Key
Show Answer

c. Database Constraint

29. A tuple is a unique entity whereas attribute values can be duplicated in the
table

a. True
b. False
c. Depends upon type of record
d. Depends upon the database key

Show Answer

a. True

30. Which of the following is RDBMS?


a. MySQL
b. SQL Server
c. MongoDB
d. All of the above

Show Answer

d. All of the above

31. Which of the following represent a valid file system to store records

a. Access
b. MySQL
c. CSV files
d. All of above

Show Answer

c. CSV files

32. According to case of Q 33, Roll No 4 may not be interested in sport; can a
NULL value be assigned to that student’s preference attribute?

a. Yes
b. No
c. Not Sure
d. Depends upon you

Show Answer
a. Yes

33. A school has a rule that each student must participate in a sport activity. So each
one should give only one preference for sport activity. So each one should give
only one preference for sport activity. Suppose there are five students in a class,
each having a unique rollno. The class representative has prepared a list of sports
preferences as shown below:

Rolln Preference
o

1 Cricket

2 Football

3 Hockey

4 NULL

5 Volley ball

Null Kabaddi

Kabaddi was not chosen by any student. Is it possible to have this tuple in the
Sport preference relation?

a.
a. Yes
b. No
c. Not Sure
d. Depends upon you

Show Answer

b. No

34. An organization wants to create a database CUSTOMER-SALE to maintain


following details about its items and their sale.
CUSTOMER(Ccode, Cname, Cadd)
SALE( SaleID, CCode, Total)
Name the attributes of Customer which can be candidate key

a. Ccode, Cname
b. Ccode, Cadd
c. Cname, Cadd
d. Ccode
Show Answer

b. Ccode, Cadd

35. For the case given in Q34, The organization wants to receive details of
SALE of a particular Customer. Name the tables and the key which are
required to retrieve this detail.

a. Customer, ccode
b. Sale, ccode
c. Customer and sale, ccode
d. Customer and sale, saleid

Show Answer

c. Customer and sale, ccode

36. For the given tables of Q37, find the alternate key in table STUDENT.

a. Rollno
b. Reg_id
c. Class
d. Name

Show Answer

a. Rollno

37. For given following tables

STUDENT PROJECT
ASSIGNEN
D

Rollno Name Class Reg_id Reg_id Proj_no

1r04 Sanjay 12 R01 R01 101

2 Ram 12 R02 R03 102


kumar

3 Harish 12 R03 R04 103

4 Jaikaran 12 R04
Find Foreign Key in PROJECT ASSIGNED table
a. Reg_id
b. Proj_no
c. Both reg_id and Proj_no
d. No Foreign Key defined

Show Answer

a. Reg_id

38. _______ is a request to a database for obtaining information in a desired


way.

a. Table
b. Query
c. Report
d. Hosting

Show Answer

b. Query

39. In which of the following case NULL value cannot be assigned to the
column ROLLNO.

a. When the ROLLNO is zero


b. When the ROLLNO is not known
c. When the ROLLNO is not available
d. When the ROLLNO is not applicable

Show Answer

a. When the ROLLNO is zero

40. ___________ is used to get the common tuples from two tables.

a. Minus
b. Union
c. Catesian Product
d. Intersection

Show Answer

d. Intersection
SQL MCQ class 12
techtipnow.in/sql-mcq-class-12

July 4, 2022

Get Most Important MCQ for SQL with answers. These SQL MCQ class 12 are very
helpful for all students learning RDBMS, SQL or preparing for CUET, GATE or any IT or
Computer Science competitive.

1. Which of the following is not an SQL command?


a. Create Database
b. Create Table
c. Create Query
d. Show Table

Show Answer

c. Create Query

2. A table can have __ foreign keys


a. 1
b. 2
c. Many
d. Depends on RDBMS

Show Answer

c. Many

3. In which of the following case DML is not executed?


a. When new record is added
b. When existing record is modified
c. When existing attribute is modified
d. When records are deleted

Show Answer

c. When existing attribute is modified


4. Which is the correct difference between Primary key and Foreign key?
a. A table can have multiple primary key and single foreign key
b. A primary key cannot ignore NULL value but Foreign key can
c. A Primary key can have duplicate data but foreign key does not
d. None of the above

Show Answer

b. A primary key cannot ignore NULL value but Foreign key can

5. in SQL ‘FROM’ clause is used to


a. Define source table name while retrieving records
b. Define Column name while retrieving records
c. Define Criteria while retrieving records
d. Define values while inserting records

Show Answer

a. Define source table name while retrieving records

6. Which if the following is not an SQL aggregate function?


a. Avg
b. Max
c. Count
d. All are aggregate function

Show Answer

d. All are aggregate function

7. SQL stands for


a. Structured Question Language
b. Structured Query Language
c. Super Query Language
d. System Query Language

Show Answer

b. Structured Query Language

8. Which of the following is not true about DDL ?


a. The retrieval of information stored in database
b. The creation of schema object in database
c. The deletion of schema object
d. All are not True

Show Answer
a. The retrieval of information stored in database

9. DELETE FROM Book where Price <= 2000;


is a _________type of statement
a. DDL
b. DML
c. DCL
d. None

Show Answer

b. DML

10. A table can not have more than one UNIQUE keys.
a. True
b. False
c. Depends upon Primary key
d. Depends upon RDBMS

Show Answer

b. False

11. For given table ‘emp’ with following columns


eno, ename, sal, dept, designation
Select correct statement to display all records of ‘emp’ in descending order of
ename and within ascending order of dept.
a. SELECT * FROM emp ORDER BY ename, dept DESC;
b. SELECT * FROM emp ORDER BY ename, ORDER BY dept DESC;
c. SELECT * FROM emp ORDER BY ename DESC, dept;
d. SELECT * FROM emp WHERE ORDER BY ename, dept DESC;

Show Answer

c. SELECT * FROM emp ORDER BY ename DESC, dept;

12. Which of the following is not an SQL Constraint?


a. IS NULL
b. Primary Key
c. Default
d. Check

Show Answer

a. IS NULL

13. Select correct SQL statement to increase price of books by 10% in book table.
a. UPDATE book SET price = price*0.1;
b. UPDATE book SET price = price + price*0.1;
c. UPDATE book WHERE price = price*0.1;
d. UPDATE book WHERE price = price + price*0.1;

Show Answer

b. UPDATE book SET price = price + price*0.1;

14. For given table ‘sales’ what will be output of following code
SELECT Sname FROM sales WHERE Rank > 4 ORDER BY Sname;

a. Sname
Safiq
b. Sname
Amber
Safiq
c. Sname
Safiq
Amber
d. SName
Jagan
Jakir
Mohan

Show Answer

15. Consider the table ‘Student’ given below:

StudentNo Class Name Game Grade Supw Grade1 Marks

10 7 Sameer Cricket B Photograph A 89.78


y

11 8 Sujit Tennis A Gardening C 78.79

12 7 Kamala Swimming B Photograph B 55.89


y

13 7 Sudiksha Swimming C Cooking B 92.36


14 8 Veerendr Tennis B Literature C 88.20
a

15 9 Dilharan Hockey A Cooking B 67.66

Write SQL command to add a new column DOB (date of birth)


a. Alter table student modify DOB date;
b. Alter table student add DOB date;
c. Alter table student create DOB date;
d. Alter table student new DOB date;

Show Answer

b. Alter table student add DOB date;

17. For given table student in Q15 list different games offered by school.
a. Select Game from Student;
b. Select Unique(Game) from Student;
c. Select Distinct(Game) from Student;
d. Select Game from student where Distinct(Game);

Show Answer

c. Select Distinct(Game) from Student;

18. For given table Library (Bno, Title, Qty, Price) Display list of books with price
ranges 150 to 200 and qty should not be null.
a. Select Title, Price from Library Where Price between 150 Or 200 And qty = NOT
NULL
b. Select Title, Price from Library Where Price between 150 And 200 Or qty = NOT
NULL
c. Select Title, Price from Library Where Price between 150 Or200 And qty IS NOT
NULL
d. Select Title, Price from Library Where Price between 150 And 200 And qty IS NOT
NULL

Show Answer

d. Select Title, Price from Library Where Price between 150 And 200 And qty IS NULL

19. Consider the ‘Club’ (coachid, coachname, sport, dateofapp, pay). List name of all
coaches with their date of appointment in descending order.
a. Select * from club order by dateofapp DESC
b. Select coachname, dataofapp from club order by dateofapp DESC
c. Select coachname, dataofapp from club order by dateofapp DSC
d. Select * from club order by dateofapp DSC
Show Answer

b. Select coachname, dataofapp from club order by dateofapp DESC

20. An attribute A of datatype varchar(20) has the value “Keshav”. The attribute B of
data type char(20) has value “Meenakshi”. How many characters are occupied in
attribute A and attribute B?
a. 20, 6
b. 6, 20
c. 9,6
d. 6,9

Show Answer

b. 6, 20

21. “Select Distinct Brand From Product;” What does this given query do?
a. It gives all the tuples having dept_name
b. It gives the dept_name attribute values of all tuples without repetition
c. It gives all the dept_name attribute of all the tuples
d. It gives all the dept_name attribute of all the tuples

Show Answer

b. It gives the dept_name attribute values of all tuples without repetition

22. Suchita is creating a table Employee with fields eno, ename, salary. She doesn’t
want the salary column to be remain unfilled i.e. she wants to make entry in this
field mandatory. Which constraint she should use at the time of creating employee
table.
a. Check
b. Default
c. Not Null
d. Primary Key

Show Answer

c. Not Null

23. Chaman want to change the default value of DISCOUNT in the CUSTOMER table
from 10 to 15. Write most appropriate command to do the same.
a. Alter Table Customer Add Discount int default(15);
b. Alter Table Customer Modify Discount int Default(15);
c. Alter Table Customer Change Discount Default from 10 to 15;
d. All of the above

Show Answer
b. Alter Table Customer Modify Discount int Default(15);

24. Write a query to display the name of customers whose name contains ‘a’ as third
alphabet from customer table (cno, cname, cadd, mobile).
a. Select cname from customer where cname like ‘%%a’;
b. Select cname from customer where cname like ‘_ a’;
c. Select cname from customer where cname like ‘ _ _a%’;
d. Select * from customer where cname like ‘_ _a’;

Show Answer

c. Select cname from customer where cname like ‘ _ _a%’;

25. Raju is trying to delete all records of table ‘emp’. For this he wrote:
DELETE ALL FROM EMP;
But he is getting error while executing this code. Help him in writing correct code
a. DELETE FROM EMP;
b. DELETE * FROM EMP;
c. DELETE EMP;
d. DELETE ALL EMP;

Show Answer

a. DELETE FROM EMP;

26. DROP TABLE Customer;


Is a __ type of statement
a. DDL
b. DML
c. DCL
d. TCL

Show Answer

a. DDL

27. Which of the following is not DDL command?


a. ALTER
b. SELECT
c. CREATE TABLE
d. DROP

Show Answer

b. SELECT

28. SQL command used to display the list of tables stored in database
a. SELECT TABLES
b. VIEW TABLES
c. SHOW TABLES
d. LIST TABLES

Show Answer

c. SHOW TABLES

29. Which of the following type of table constraints will prevent the entry of duplicate
rows?
a. Unique
b. Distinct
c. Primary Key
d. NULL

Show Answer

a. UNIQUE, c. Primary Key

30. The default date format followed in SQL is


a. Dd/mm/yyyy
b. Mm/dd/yyyy
c. Yyyy/dd/mm
d. Yyyy/mm/dd

Show Answer

d. Yyyy/mm/dd

31. Which of the following is not a valid data type to store alphanumeric data in
MySQL?
a. Char
b. Varchar
c. Text
d. Memo

Show Answer

d. Memo

32. Which two constraints when applied together will produce a Primary Key
constraint?
a. Foreign Key + Unique Key
b. NOT NULL + Foreign Key
c. NOT NULL + Unique Key
d. Primary Key can not be replaced by combining other constraints

Show Answer
c. NOT NULL + Unique Key

33. To store Mobile number in a table which data type should be preferred?
a. Int
b. Char(n)
c. Varchar(n)
d. Float

Show Answer

b. Char(n)

34. Reena wants to see the the fieldnames and its data type of table ‘department’.
What code she should write?
a. Select * from department;
b. View department;
c. Show table department;
d. Describe department;

Show Answer

d. Describe department;

35. Jaikaran want to remove primary key assigned to bookid from book table. Help
him in writing suitable code.
a. Drop primary key from book
b. Alter table book modify bookid drop primary key;
c. Alter table book drop primary key;
d. Alter table book drop primary key (bookid);

Show Answer

c. Alter table book drop primary key;

36. Which of the following is not a valid operator used in SQL to set criteria in query?
a. IN
b. LIKE
c. IS NOT NULL
d. ==

Show Answer

d. ==

37. Write SQL command to display name of all employees containing ‘aa’ as a
substring in name.
a. Select name from employee where name like ‘aa%’;
b. Select name from employee where name like ‘aa%’ ;
c. Select name from employee where name like ‘%aa%’ ;
d. Select name from employee where name like ‘_aa’;

Show Answer

c. Select name from employee where name like ‘%aa%’ ;

38. Supriya has following code to insert a record in table ’salesman’, but
getting error. Help her in writing appropriate code.
INSERT EMP VALUES(‘203’,’RAJU’, ‘DELHI’);

a. INSERT IN EMP VALUES(‘203’,’RAJU’, ‘DELHI’)’;


b. INSERT (EMP) VALUES(‘203’,’RAJU’, ‘DELHI’);
c. INSERT TO EMP VALUES(‘203’,’RAJU’, ‘DELHI’);
d. INSERT INTO EMP VALUES(‘203’,’RAJU’, ‘DELHI’);

Show Answer

d. INSERT INTO EMP VALUES(‘203’,’RAJU’, ‘DELHI’);

39. “SELECT * FROM Employee; “ is


a. DDL
b. DML
c. DCL
d. None of these

Show Answer

a. UNIQUE

40. DDL stands for


a. Dynamic Data Language
b. Database Definition Language
c. Data Definition Language
d. Dynamic Database Language

Show Answer

c. Data Definition Language

41. DML is
a. Database Manipulation Language
b. Data Manipulation Language
c. Data Maintenance Language
d. Database Maintenance Language

Show Answer
b. Data Manipulation Language

42. Char(n) and varchar(n) are used to store _ length and variable data
a. Variable, fixed
b. Fixed, variable
c. Equal, equal
d. None of these

Show Answer

b. Fixed, variable

43. Which of the following provides the ability to query information from the database
and insert
tuples into, delete tuples from, and modify tuples in the database?
a. DML(Data Manipulation Language)
b. DDL(Data Definition Language)
c. Query
d. Relational Schema

Show Answer

a. DML(Data Manipulation Language)

You might also like