wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Computer science with python

Total questions: 170

Worksheet time: 1hrs 29mins

Name
Class
Date
1.

Which statement best describes Python indentation in code blocks?

a)

Ignored by the interpreter

b)

Optional for readability only

c)

Required to define block scope

d)

Used only inside functions

2.

In Python, which symbol starts a single-line comment?

a)

# hash symbol

b)

// double slash

c)

/* block marker */

d)

-- dash pair

3.

Which item is a Python keyword rather than an identifier?

a)

sum

b)

data

c)

if

d)

price

4.

What is the correct classification of tokens like int, float, str in Python?

a)

Identifiers for user variables

b)

Data types decided at runtime

c)

Operators for math operations

d)

Literals representing fixed values

5.

Which operator returns the remainder of division in Python?

a)

// floor division

b)

** exponent operator

c)

% modulo operator

d)

/ true division

6.

Which relational expression correctly checks equality in Python?

a)

a = b for equality

b)

a := b for equality

c)

a !== b for equality

d)

a == b for equality

7.

Which statement about input handling is accurate?

a)

print() converts to integers

b)

input() returns a string

c)

print() accepts only strings

d)

input() returns an integer

8.

Choose the correct logical operator set available in Python.

a)

plus minus times

b)

AND OR NOT

c)

&& || !

d)

and or not

9.

Which control structure is best when iterating a known range?

a)

for loop over range

b)

if-elif chained check

c)

while loop with flag

d)

recursive function calls

10.

In a loop, which statement skips the current iteration and continues?

a)

halt

b)

continue

c)

break

d)

stop

11.

Which operation shows that lists are mutable in Python?

a)

Changing an element by index

b)

Accessing a tuple element

c)

Concatenating two strings

d)

Reading a dictionary value

12.

Given s = "Computer". What does s[1:5] return?

a)

"mput"

b)

"puter"

c)

"Comp"

d)

"ompu"

13.

Which method adds an item to the end of a list?

a)

append()

b)

sort()

c)

insert()

d)

pop()

14.

Which statement best describes tuples?

a)

Unordered and immutable

b)

Ordered and immutable

c)

Mutable and faster

d)

Unordered and mutable

15.

In a dictionary, what must be unique?

a)

Items

b)

Indices

c)

Values

d)

Keys

16.

Which method removes and returns the last list item?

a)

remove()

b)

pop()

c)

insert()

d)

split()

17.

Select the correct way to access a dictionary value for key "id".

a)

data["id"]

b)

data.id()

c)

data.gets("id")

d)

data.items["id"]

18.

Which function returns the number of elements in a list?

a)

range()

b)

size()

c)

count()

d)

len()

19.

Which statement defines a reusable block of code in Python?

a)

Use def with a name

b)

Use class with a name

c)

Use lambda with print

d)

Use import with file

20.

What does return do inside a Python function?

a)

Sends a value back

b)

Creates a variable

c)

Prints a message

d)

Stops the program

21.

Which file mode should you use to add new data to the end of an existing text file without deleting its current contents?

a)

rw mode reads and writes together

b)

w mode creates a fresh empty file

c)

r mode opens file for reading only

d)

a mode appends data at file end

22.

A program reads all lines from a file and then closes it. Which function call is responsible for releasing the file resource?

a)

write() outputs to the file

b)

close() releases the resource

c)

read() fetches file contents

d)

open() creates a file handle

23.

You must handle a runtime error from dividing by zero. Which pair of keywords correctly creates the handler block and the error-catching clause?

a)

break and continue pair

b)

import and from pair

c)

else and finally only

d)

try and except together

24.

In an exception flow, which keyword runs regardless of whether an error occurred, typically used to clean up resources?

a)

except handles raised error

b)

try executes guarded code

c)

else runs when no error

d)

finally runs cleanup always

25.

A module named utils.py defines helper functions. How should you bring those into another script?

a)

import utils to access functions

b)

from utils import script file

c)

open(utils) to load module

d)

read() utils for functions

26.

Which statement best distinguishes a class from an object in Python?

a)

Class is blueprint for objects

b)

Object is class code block

c)

Class is single runtime value

d)

Object defines module imports

27.

When creating an object, which special method initializes its attributes at construction time?

a)

__call__() invocation method

b)

__init__() constructor method

c)

__enter__() context manager

d)

__str__() representation text

28.

Which description correctly matches Python being an interpreted language?

a)

Runs only after bytecode linking

b)

Translates to machine code package

c)

Compiled fully ahead of runtime

d)

Executed line by line by interpreter

29.

Choose the accurate difference between list and tuple in Python.

a)

Both mutable and resizable

b)

Tuple mutable, list immutable

c)

Both immutable by default

d)

List mutable, tuple immutable

30.

During loop control, which pair correctly describes exiting the loop versus skipping one iteration?

a)

continue exits loop, break skips

b)

return exits loop, yield skips

c)

else exits loop, pass skips

d)

break exits loop, continue skips

31.

What does the term 'relation' refer to in a relational database model?

a)

A table

b)

A relationship between tables

c)

A row of data

d)

A column of data

32.

Which of the following is a valid relational database key?

a)

Tuple

b)

Attribute

c)

Primary key

d)

Cardinality

33.

What is the meaning of 'degree' in a relational database?

a)

The number of rows in a table

b)

The number of attributes in a relation

c)

The number of tables in a database

d)

The number of keys in a relation

34.

Which key uniquely identifies each tuple in a relational database table?

a)

Foreign key

b)

Candidate key

c)

Primary key

d)

Alternate key

35.

What is the primary difference between a primary key and a candidate key?

a)

A primary key can have multiple values, but a candidate key cannot

b)

A candidate key can be chosen as a primary key, but a primary key cannot be a candidate key

c)

A candidate key uniquely identifies records, but the primary key does not

d)

A primary key is a combination of multiple candidate keys

36.

In a relational database, the cardinality of a relation refers to:

a)

The number of tuples in a relation

b)

The number of attributes in a relation

c)

The number of foreign keys

d)

The number of columns in a table

37.

What is the domain of an attribute in a relational database model?

a)

The range of values an attribute can take

b)

The name of the attribute

c)

The number of unique values an attribute can hold

d)

The unique identifier for an attribute

38.

Which of the following is an example of a foreign key?

a)

A key in the 'Orders' table that refers to the 'Customer' table

b)

A key that uniquely identifies a row in the 'Customers' table

c)

A primary key in the 'Orders' table

d)

A key used for internal table indexing

39.

Which statement correctly describes a 'candidate key'?

a)

It is any column that can uniquely identify rows in a table

b)

It is a column that uniquely identifies rows, but it is not the primary key

c)

It is the key used for referencing another table

d)

It is the primary key

40.

Which command is used to display all databases in a MySQL system?

a)

SHOW DATABASES

b)

SHOW TABLES

c)

LIST DATABASES

d)

DISPLAY DATABASES

41.

What is the purpose of the `DROP DATABASE` command?

a)

To delete all rows in a table

b)

To delete a specific table from a database

c)

To delete a database and all its contents

d)

To delete a database connection

42.

Which command is used to remove a table from a database?

a)

REMOVE TABLE

b)

DELETE TABLE

c)

DROP TABLE

d)

ALTER TABLE

43.

What is the purpose of the `ALTER TABLE` command?

a)

To delete a table

b)

To update data in a table

c)

To change the structure of an existing table

d)

To retrieve data from a table

44.

Which SQL clause is used to filter records based on a condition?

a)

HAVING

b)

WHERE

c)

ORDER BY

d)

GROUP BY

45.

Which of the following commands is used to insert data into a table?

a)

UPDATE

b)

INSERT INTO

c)

ADD INTO

d)

INSERT RECORD

46.

Which SQL clause is used to sort the result set in ascending or descending order?

a)

GROUP BY

b)

ORDER BY

c)

HAVING

d)

WHERE

47.

Which SQL statement is used to remove data from a table?

a)

DELETE

b)

DROP

c)

REMOVE

d)

TRUNCATE

48.

Which aggregate function is used to calculate the sum of a numeric column?

a)

COUNT()

b)

SUM()

c)

MAX()

d)

AVG()

49.

Which of the following SQL clauses is used to filter groups of records in the result set?

a)

WHERE

b)

HAVING

c)

ORDER BY

d)

GROUP BY

50.

Which of the following is NOT an SQL operator?

a)

AND

b)

OR

c)

SELECT

d)

NOT

51.

Which type of join returns all records when there is a match in one of the tables?

a)

Inner join

b)

Left join

c)

Right join

d)

Outer join

52.

Which type of join returns all records from the right table and the matched records from the left table?

a)

Inner join

b)

Left join

c)

Right join

d)

Full outer join

53.

Which of the following SQL commands will give the Cartesian product of two tables?

a)

SELECT FROM table1, table2

b)

SELECT FROM table1 INNER JOIN table2

c)

SELECT FROM table1 LEFT JOIN table2

d)

SELECT FROM table1 RIGHT JOIN table2

54.

What does the `cursor.execute()` function do in Python's `sqlite3` module?

a)

Opens a connection to the database

b)

Executes a SQL query

c)

Fetches all records from the database

d)

Commits the transaction to the database

55.

Which Python function is used to commit changes to the database after an update or insert operation?

a)

`commit()`

b)

`execute()`

c)

`save()`

d)

`flush()`

56.

What is the purpose of the `%s` in the `execute()` method of Python's `sqlite3`?

a)

It formats strings for display purposes

b)

It is used to represent placeholders for parameters in queries

c)

It indicates a SQL query to execute

d)

It closes the database connection

57.

Assertion (A): In SQL, the `INSERT INTO` command can only be used to insert one row at a time into a table. Reasoning (R): The `INSERT INTO` command can be used to insert multiple rows in a single query, by specifying the values for each row within parentheses.

a)

Both the assertion and reasoning are true, and the reasoning correctly explains the assertion.

b)

Both the assertion and reasoning are true, but the reasoning does not correctly explain the assertion.

c)

The assertion is false, but the reasoning is true.

d)

The assertion is true, but the reasoning is false.

58.

What does LAN stand for?

a)

Limited Area Network

b)

Laser Assisted Network

c)

Local Area Network

d)

Local Aerial Network

59.
What is an advantage of a LAN?
a)
You can save money by sharing peripherals like printers.
b)
It is limited to a small area.
c)
Can cover near infinite geographical distance.
d)
Expensive to setup.
60.
A series of number used to identify a network device.
a)
IP Address
b)
IM Address
c)
MAC Address
d)
OP Address
61.
What does Protocol mean?
a)
Security
b)
Rules
c)
Orders
d)
Services
62.
Which if these terms refers to the maximum rate at which data can betransferred? (1-4)
a)
Error detection
b)
Packet switching
c)
Bandwidth
d)
Transmission media
63.
What is meant by a data packet? (6-9)
a)
A unit of data that travels along a network
b)
The number of error found in data when it has been transmitted
c)
The data a computer needs to connect to a network
d)
A connection point in a network that allows data to be shared
64.
What is cloud computing? (1-4)
a)
Storing large amounts of data on a single computer
b)
Using the internet to store and access data and programs remotely
c)
Storing hard copies of data as a backup
d)
Using the internet to communicate with other users
65.

ABC University has its campus buildings spread out across the city.

Which network is being used?

a)

LAN

b)

WAN

66.

Which field is computer networks originated from?

a)

Government

b)

Military

c)

Media

d)

Police

67.
A client-server network does not store files locally on a computer on a network.  Instead they are stored on a 'server' - true or false?
a)
True
b)
False
68.
Choose the best definition to explain what is meant by a 'peer to peer' network.
a)
Computers have equal status and do not rely on a central server.  Each workstation is effectively a server and client.
b)
A client is used to make requests, the server processes these requests and then responds to the request.  The server provides a service.
69.
Which of the following is an advantage of a peer to peer network?
a)
Files and folders cannot be centrally backed up.
b)
Does not need an expensive server as individual workstations are used to access files.
c)
The server is expensive to purchase
d)
Network security can be carried out centrally.
70.
Which of the following is an advantage of a client-server network?
a)
If one computer fails it will not disrupt the network.
b)
There is little or no security.
c)
Users can access shared data which is centrally controlled.
d)
If any part of the network fails, a lot of disruption can occur.
71.

Computer networks share...

a)

Files

b)

Resources

c)

Software

d)

All of the above

72.

Hubs are more efficient in distributing data packets than Switches?

a)

True

b)

False

73.

What kind of transmission medium is most appropriate to carry data in a computer network that is exposed to electrical interferences?

a)
  1. Unshielded twisted pair

b)
  1. Optical fiber

c)
  1. Coaxial cable

d)
  1. Microwave

74.

The term HTTP stands for?

a)
  1. Hyper terminal tracing program

b)
  1. Hypertext tracing protocol

c)
  1. Hypertext transfer protocol

d)
  1. Hypertext transmit protocol

75.

Expand NIC.

a)

Network Interaction Card

b)

Network internal Card

c)

Network Interface Card

76.

________________ is the box with the set of RJ-45 ports.

a)

Echo Dot

b)

Memory card

c)

Hub/Switch

77.

________________ have a wireless antenna, which increases the communication range of the radio signals.

a)

Routers

b)

Ethernet cables

c)

Gateway

78.

________________ is a computer network that is created for an individual person.

a)

LAN

b)

PAN

c)

WAN

79.

The best example for WAN is ______________.

a)

Local cable network

b)

Campus network

c)

Internet

80.

_________________ is an overall design of a computer network that describes how a computer network is configured and what strategies are being used in it.

a)

Network Topology

b)

Network Style

c)

Network Architecture

81.

A ______________ is a computer that provides services to clients or workstations.

a)

Main Computer

b)

Server/ Central Hub

c)

Service provider

82.
The most successful LAN technology developed in the early 1970s is ___.
a)
WiFi
b)
Bluetooth
c)
Token Ring
d)
Ethernet
83.
Ethernet requires each computer to have a unique ___.
a)
IP address
b)
MAC address
c)
username
d)
password
84.
The method of connecting two computers with a dedicated line is called ___.
a)
packet switching
b)
message switching
c)
circuit switching
d)
frequency switching
85.
Breaking up large messages into smaller pieces for transmission is known as ___.
a)
message switching
b)
packet switching
c)
circuit switching
d)
frequency hopping
86.
An IP address is used to ___.
a)
secure a computer
b)
identify a computer on a network
c)
encrypt data
d)
allocate bandwidth
87.
The protocol that runs on top of IP to handle packet ordering is ___.
a)
FTP
b)
TCP/IP
c)
HTTP
d)
DNS
88.
The world's first packet-switching network was called ___.
a)
Ethernet
b)
WiFi
c)
ARPANET
d)
TCP/IP
89.
The ARPANET was funded by the ___.
a)
National Science Foundation
b)
Advanced Research Projects Agency
c)
Department of Defense
d)
NASA
90.
The standard for packet switching was created in the ___.
a)
1980s
b)
1970s
c)
1990s
d)
2000s
91.
Today's internet includes many interconnected devices forming the ___.
a)
World Wide Web
b)
Internet of Things
c)
Cloud Network
d)
Digital Ecosystem
92.

What is the use of Bridge in the network?

a)

To connect LANs

b)

To separate LANs

c)

To control network speed

d)

All of the above

93.

Each IP packet must contain:

a)

Only source address

b)

Only destination address

c)

Source and destination address

d)

Source or destination address

94.

Which of these is not a communication channel?

a)

Satellite

b)

Microwave

c)

Radiowave

d)

Wi-Fi

95.

Which of these is not an example of unguided media?

a)

Optical fibre cable

b)

Radio wave

c)

Bluetooth

d)

Satellite

96.

Device used to connect dissimilar networks

a)

Modem

b)

Gateway

c)

Bridge

d)

Router

97.

................................ isresponsible for handling the address of the destination computerso that each packet is delivered to its proper destination

a)

IP

b)

TP

c)

TCP

d)

MAC

98.

_________ is a dedicated line between the caller and the sender

a)

Packet switching

b)

Circuit switching

c)

Line switching

d)

Message switching

99.

The techniques of switching in which data is fragmented into smaller techniques is called ..............

a)

Circuit switching

b)

Message switching

c)

Packet switching

d)

Line switching

100.

What does a modem do in a network?

a)

Routes data between networks

b)

Converts digital data to analog signals

c)

Amplifies signal strength

d)

Connects devices wirelessly

101.

What is the main function of an Ethernet card?

a)

To provide wireless internet access

b)

To connect devices to a wired network

c)

To amplify network signals

d)

To convert IP addresses

102.

Eesha is setting up her home office and needs to connect her computer to the router. Which type of connector should she use for her Ethernet cable?

a)

RJ11

b)

RJ45

c)

HDMI

d)

VGA

103.

Which network device forwards data to the correct device in a network?

a)

Hub

b)

Switch

c)

Modem

d)

Repeater

104.

Sneha is trying to set up a wireless network in her large house, but she finds that the signal does not reach the farthest rooms. She wonders what device she can use to improve the coverage of her network.

a)

Connect different networks

b)

Extend the range of a network

c)

Route data to the correct device

d)

Encrypt data packets

105.

Which device is used to connect two different networks and routes traffic between them?

a)

Switch

b)

Modem

c)

Router

d)

Hub

106.

What is the role of a gateway in a network?

a)

To connect multiple devices in a network

b)

To connect different networks and route traffic

c)

To amplify the signal

d)

To manage IP addresses

107.

Myra is trying to connect her laptop to the internet at a coffee shop. A WiFi card allows her device to:

a)

Connect via Bluetooth

b)

Connect to wired networks

c)

Connect to wireless networks

d)

Manage the DNS server

108.

Which of the following is NOT a function of a modem?

a)

Converting digital signals to analog signals

b)

Providing wireless connectivity

c)

Allowing internet access over telephone lines

d)

Converting analog signals to digital signals

109.

Which network device is used to extend the range of WiFi signals?

a)

Hub

b)

Switch

c)

Repeater

d)

Router

110.

Which device transmits data to all devices in a LAN, regardless of destination?

a)

Hub

b)

Switch

c)

Repeater

d)

Router

111.

Which device is responsible for translating domain names into IP addresses?

a)

Gateway

b)

DNS server

c)

Router

d)

Switch

112.

Asher is setting up his home network and wants to connect his devices to the internet using a broadband connection. Which of the following can help him achieve that?

a)

Modem

b)

Ethernet card

c)

Switch

d)

Router

113.

What is the primary difference between a hub and a switch?

a)

A switch forwards data to the correct device, while a hub sends it to all devices.

b)

A switch uses wireless technology; a hub does not.

c)

A hub assigns IP addresses, but a switch does not.

d)

A switch is used for longdistance connections, while a hub is used for local connections.

114.

Which of the following is the most common network topology in modern networks?

a)

Bus

b)

Star

c)

Tree

d)

Mesh

115.

In which topology does each device connect to a central point, such as a hub or switch?

a)

Ring

b)

Bus

c)

Star

d)

Mesh

116.

Which network topology is best for large, complex networks where devices are connected in a hierarchical manner?

a)

Star

b)

Tree

c)

Bus

d)

Mesh

117.

What does WAN stand for?

a)

Wide Area Network

b)

Wireless Access Network

c)

Wide Application Network

d)

Web Area Network

118.

Which network type is best suited for connecting devices in a city or campus?

a)

PAN

b)

LAN

c)

MAN

d)

WAN

119.

In which network topology does each device pass data to its immediate neighbor, forming a loop?

a)

Mesh

b)

Ring

c)

Bus

d)

Star

120.

Which of the following is a disadvantage of bus topology?

a)

Easy to install and expand

b)

Single cable failure can bring down the whole network

c)

Devices are directly connected to the hub

d)

Efficient for large networks

121.

A network topology where all devices are connected to a single central cable is known as:

a)

Star topology

b)

Bus topology

c)

Tree topology

d)

Mesh topology

122.

What does a mesh topology allow that other topologies don’t?

a)

Direct devicetodevice communication

b)

All devices to be connected in a single loop

c)

Increased reliability due to redundant connections

d)

Lower installation costs

123.

In which topology is there no central point of failure, since data can be routed in multiple paths?

a)

Ring

b)

Mesh

c)

Star

d)

Bus

124.

Which protocol is used for transferring web pages over the internet?

a)

FTP

b)

HTTP

c)

SMTP

d)

POP3

125.

Which of the following protocols is used for email retrieval from a mail server?

a)

SMTP

b)

FTP

c)

POP3

d)

IMAP

126.

Which protocol is commonly used for sending emails?

a)

FTP

b)

HTTP

c)

SMTP

d)

SSH

127.

What does TCP ensure in a network communication?

a)

Encryption of data

b)

Reliable transmission of data

c)

Faster transmission speed

d)

Secure login credentials

128.

Which protocol is used for secure web communication?

a)

FTP

b)

HTTPS

c)

SMTP

d)

POP3

129.

Which of the following protocols is used for remote login to a server?

a)

Telnet

b)

FTP

c)

HTTP

d)

POP3

130.

What does FTP stand for?

a)

File Transfer Protocol

b)

Fast Transfer Protocol

c)

File Transmission Protocol

d)

Function Transfer Protocol

131.

Which protocol is used for voice communication over the internet?

a)

SMTP

b)

FTP

c)

VoIP

d)

POP3

132.

What is the primary function of the IP protocol?

a)

Transmit files between servers

b)

Route packets of data between devices

c)

Convert digital signals to analog signals

d)

Send emails securely

133.

Which protocol is responsible for establishing a connection between devices over a serial link?

a)

PPP

b)

FTP

c)

TCP/IP

d)

SMTP

134.

What does PPP stand for?

a)

PointtoPoint Protocol

b)

Packet Processing Protocol

c)

Public Protocol Protocol

d)

Pathway Protocol Program

135.

What does the 'WWW' in a web address stand for?

a)

Web Wide World

b)

World Web Workspace

c)

World Wide Web

d)

Wireless Web

136.

Which language is used to describe data in a way that both humans and machines can read it?

a)

HTML

b)

XML

c)

CSS

d)

PHP

137.

A domain name is used to identify:

a)

A server's IP address

b)

A specific webpage within a website

c)

A website's unique name

d)

A website's data

138.

Which of the following is a characteristic of a star topology?

a)

All devices share a single communication line

b)

Each device is connected to a central hub

c)

Data travels in a circular manner

d)

It requires less cabling than bus topology

139.

What is the main purpose of the DHCP protocol?

a)

To assign IP addresses to devices on a network

b)

To encrypt data during transmission

c)

To manage network traffic

d)

To provide a secure connection between networks

140.

Which of the following is a common use of a VPN?

a)

To connect to a local area network

b)

To access the internet securely over a public network

c)

To transfer files between servers

d)

To monitor network performance

141.

Assertion (A): A router connects multiple networks together and routes data between them based on IP addresses.

Reasoning (R): A router operates at the data link layer of the OSI model, which allows it to route packets between devices on different networks.

a)

- a) Both the assertion and reasoning are true, and the reasoning correctly explains the assertion.

b)

- b) Both the assertion and reasoning are true, but the reasoning does not correctly explain the assertion.

c)

- c) The assertion is true, but the reasoning is false.

d)

- d) The assertion is false, but the reasoning is true.

142.

Assertion (A): XML is a markup language that defines the structure of data, making it both human-readable and machine-readable.

Reasoning (R): XML tags are predefined and have specific functions that are universally understood across all platforms.

a)

- a) Both the assertion and reasoning are true, and the reasoning correctly explains the assertion.

b)

- b) Both the assertion and reasoning are true, but the reasoning does not correctly explain the assertion.

c)

- c) The assertion is true, but the reasoning is false.

d)

- d) The assertion is false, but the reasoning is true.

143.

Assertion (A): The HTTP protocol is used to send email messages over the internet.

Reasoning (R): HTTP is designed for communication between web browsers and web servers, while email communication is typically done using SMTP or POP3.

a)

- a) Both the assertion and reasoning are true, and the reasoning correctly explains the assertion.

b)

- b) Both the assertion and reasoning are true, but the reasoning does not correctly explain the assertion.

c)

- c) The assertion is false, but the reasoning is true.

d)

- d) The assertion is true, but the reasoning is false.

144.

Assertion (A): A hub forwards data packets to all devices connected in a network.

Reasoning (R): Since a hub does not differentiate between devices, it broadcasts all data, which can lead to network congestion.

a)

- a) Both the assertion and reasoning are true, and the reasoning correctly explains the assertion.

b)

- b) Both the assertion and reasoning are true, but the reasoning does not correctly explain the assertion.

c)

- c) The assertion is true, but the reasoning is false.

d)

- d) The assertion is false, but the reasoning is true.

145.

SQL is

a)

Structured Query Language

b)

Simple Query Language

c)

Structured Question Language

d)

Structure Quality Language

146.

To remove a record from a table which SQL statement would you use?

a)

Remove

b)

Cancel

c)

Delete

d)

Eradicate

147.

In order to modify data in a database we would use which SQL statement?

a)

Update

b)

Amend

c)

Alter

d)

Modify

148.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

149.

Which statement allows us to add a record to a table?

a)

Add To

b)

Update To

c)

Add Into

d)

Insert Into

150.

Less than or equal to?

a)

>=

b)

=>

c)

=<

d)

<=

151.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

152.

Which SQL statement would add a record to the database?

a)

INSERT INTO Designer VALUES ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

b)

INSERT VALUES ('SMI01', 'M Smith', 'mail@msmith.com', 01224123456') INTO Designer

c)

INSERT ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456') INTO Designer

d)

INSERT Designer INTO VALUES (''SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

153.

Where does the CREATE Command belong?

a)

DML

b)

DDL

c)

DCL

154.

______________ constraint prevents NULL values

a)

UNIQUE

b)

NOT NULL

c)

NULL

d)

FOREIGN KEY

155.

A primary key can be NULL in the table? TRUE or FALSE

a)

TRUE

b)

FALSE

156.

How do we select all rows for the "Designer" table?

a)

SELECT * FROM Designer

b)

SELECT [All] FROM Designer

c)

SELECT Designer.*

d)

SELECT FROM Designer

157.

How would we script a SQL query to select "Description" from the Item table?

a)

SELECT Item.Description

b)

EXTRACT Description FROM Item

c)

SELECT Item FROM Description

d)

SELECT Description FROM Item

158.

How would we script a SQL query to select "Description" from the Item table?

a)

SELECT Item.Description

b)

EXTRACT Description FROM Item

c)

SELECT Item FROM Description

d)

SELECT Description FROM Item

159.

You are required to update the phone number for only the DesignerID "SMI01" in the "Designer" table. Which of these would successfully do that?

a)

UPDATE Designer SET PhoneNo = '01224123456'

b)

UPDATE Designer (PhoneNo) VALUES ('01224123456')

c)

UPDATE Designer SET PhoneNo = '01224123456' WHERE DesignerID = 'SMI01'

d)

UPDATE PhoneNo = '01224123456' FROM Designer WHERE DesignerID = 'SMI01'

160.

How would you DELETE records from the Items table with a "Chair" Type?

a)

DELETE 'Chair' FROM Items

b)

DELETE Type FROM Items WHERE Type = 'Chair'

c)

DELETE FROM Items WHERE Type = 'Chair'

d)

DELETE ITEMS WHERE Type = 'Chair'

161.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?

a)

SELECT * FROM Persons WHERE FirstName=’a’

b)

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

c)

SELECT * FROM Persons WHERE FirstName LIKE ‘%a’

d)

SELECT * FROM Persons WHERE FirstName=’%a%’

162.

What does the ALTER TABLE clause do?

a)

The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints

b)

The SQL ALTER TABLE clause is used to insert data into database table

c)

THE SQL ALTER TABLE deletes data from database table

d)

The SQL ALTER TABLE clause is used to delete a database table

163.

The UPDATE SQL clause can _____________

a)

update only one row at a time

b)

update more than one row at a time

c)

delete more than one row at a time

d)

delete only one row at a time

164.

How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?

a)

UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

b)

MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

c)

MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

d)

UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

165.

Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.

a)

SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)

b)

SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)

c)

SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)

d)

SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);

166.

Which would find pupils with "er" anywhere in their name?

a)

SELECT * FROM Pupils Where Name = "%er"

b)

SELECT * FROM Pupils Where Name = "$er$"

c)

SELECT * FROM Pupils Where Name = "%er%"

d)

SELECT * FROM Pupils Where Name = "er%"

167.

Which is the correct query to delete the rows of employees whose exp is less than 10.

a)

DELETE * FROM EMP WHERE EXP<10;

b)

DELETE FROM EMP;

c)

DELETE FROM EMP WHERE EXP<10;

d)

DELETE FROM EMP WHERE EXP>10;

168.
A column in a database
a)
record
b)
row
c)
field
d)
data
169.
Return all dramas made after 2004.
a)
SELECT * FROM movies WHERE genre = 'drama';
b)
SELECT * FROM movies WHERE genre = 'drama' AND year > 2004;
c)
SELECT * FROM movies WHERE genre = "drama' AND year < 2004;
d)
SELECT * FROM movies WHERE imdb_rating = 7 AND LIMIT = 7
170.

Which of the following is not a Constraint in SQL?

a)

Not Null

b)

Unique

c)

Check

d)

Distinct