wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basics MCQs: Part 1

Total questions: 46

Worksheet time: 23mins

Name
Class
Date
1.

What is the correct file extension for Python files?

a)

.py

b)

.pt

c)

.python

d)

.pyt

2.

Which data type is immutable?

a)

Set

b)

Tuple

c)

Dictionary

d)

List

3.

What is the output of len('Python')?

a)

5

b)

6

c)

7

d)

Error

4.

Which function is used to get input from the user?

a)

get()

b)

input()

c)

read()

d)

scan()

5.

Which data type stores key-value pairs?

a)

List

b)

Tuple

c)

Dictionary

d)

Set

6.

What does '==' operator do?

a)

Comparison

b)

Assignment

c)

Increment

d)

Decrement

7.

What is the output of 10 // 3?

a)

3.33

b)

Error

c)

3

d)

4

8.

Which function converts a string to integer?

a)

int()

b)

float()

c)

str()

d)

char()

9.

What does break statement do?

a)

Ends program

b)

Stops loop

c)

Pauses loop

d)

Skips iteration

10.

Which keyword is used to create a loop?

a)

for

b)

iterate

c)

repeat

d)

loop

11.

What is the output of bool(0)?

a)

False

b)

Error

c)

0

d)

True

12.

Which data type is ordered?

a)

None

b)

List

c)

Dictionary

d)

Set

13.

Which function returns the length of a list?

a)

count()

b)

size()

c)

length()

d)

len()

14.

Which operator is used for floor division?

a)

/

b)

//

c)

**

d)

%

15.

Which statement is used to exit a function?

a)

stop

b)

exit

c)

return

d)

break

16.

Which of the following is mutable?

a)

Integer

b)

List

c)

String

d)

Tuple

17.

What does the 'is' operator check?

a)

Size

b)

Identity

c)

Type

d)

Value

18.

What is the output of len([1,2,3])?

a)

3

b)

Error

c)

4

d)

2

19.

What is the default value returned by a function?

a)

/

b)

0

c)

None

d)

False

20.

Which loop executes at least once?

a)

do-while

b)

None

c)

while

d)

for

21.

What is the output of 5 > 3?

a)

True

b)

False

c)

5

d)

3

22.

Which statement is used to stop infinite loop?

a)

exit

b)

pass

c)

break

d)

continue

23.

What is the primary purpose of a VLAN in a switched network?

a)

Segment broadcast domains logically

b)

Increase physical cable bandwidth

c)

Encrypt traffic end-to-end by default

d)

Replace routing protocols entirely

24.

In IPv4, what does CIDR notation /24 indicate about the subnet mask?

a)

Mask has 24 leading ones

b)

Mask equals 24 decimal value

c)

Mask replaces default gateway

d)

Mask uses only 24 hosts

25.

Which DNS record type maps a hostname to an IPv4 address?

a)

A record mapping IPv4 address

b)

AAAA record mapping IPv6

c)

MX record specifying mail

d)

CNAME record aliasing name

26.

What command tests reachability by sending ICMP Echo Requests and measuring replies?

a)

nslookup querying DNS

b)

ping using ICMP echo

c)

tracert showing hops

d)

netstat listing sockets

27.

In virtualization, what does a Type 1 hypervisor do?

a)

Runs directly on hardware

b)

Runs atop a host OS

c)

Replaces guest kernels

d)

Emulates only user apps

28.

Which cloud model offers complete applications managed by the provider and accessed by users over the internet?

a)

PaaS for developers

b)

SaaS hosted applications

c)

Private cloud on‑prem

d)

IaaS virtual servers

29.

What is the main benefit of infrastructure as code (IaC) in DevOps pipelines?

a)

Less need for version control

b)

Greater reliance on tickets

c)

Manual configuration flexibility

d)

Consistent repeatable provisioning

30.

Which version control operation integrates changes from a feature branch into the main branch with a merge commit?

a)

Forking creates remote copy

b)

Rebasing rewrites history

c)

Merging creates new commit

d)

Cloning copies repository

31.

What SQL clause filters rows returned by a SELECT query before grouping?

a)

FROM listing tables

b)

ORDER BY sorting rows

c)

HAVING filtering groups

d)

WHERE filtering rows

32.

Which data structure uses FIFO ordering for element processing?

a)

Graph with adjacency

b)

Tree with root nodes

c)

Stack with LIFO order

d)

Queue with FIFO order

33.

What is the Big-O time complexity of binary search on a sorted array?

a)

O(log n) logarithmic time

b)

O(n) linear per scan

c)

O(n log n) hybrid time

d)

O(1) constant always

34.

What best describes a RESTful API characteristic for resource manipulation?

a)

Stateless operations using HTTP verbs

b)

Stateful sessions maintaining server memory

c)

Binary RPC using persistent sockets

d)

Tightly coupled endpoints per client

35.

Which HTTP status code indicates that a resource was not found on the server?

a)

301 moved permanently

b)

500 internal error

c)

404 not found response

d)

200 successful request

36.

What is the main security purpose of a DMZ in network architecture?

a)

Provide wireless guest access

b)

Isolate public-facing services

c)

Encrypt internal database traffic

d)

Replace internal VLAN segmentation

37.

In public key infrastructure, what does a certificate authority primarily do?

a)

Issues and signs certificates

b)

Blocks revoked domains

c)

Encrypts all email contents

d)

Stores private keys centrally

38.

Which malware type holds data hostage by encrypting files until payment is made?

a)

Ransomware encrypting files

b)

Worm self-replicating

c)

Spyware monitoring users

d)

Adware injecting popups

39.

Which scheduling algorithm always picks the next job with the shortest expected processing time?

a)

First come first served

b)

Priority preemptive aging

c)

Round robin time slices

d)

Shortest job first selection

40.

Which SDLC phase focuses on collecting stakeholder requirements and documenting system needs?

a)

Design architecture phase

b)

Requirements analysis phase

c)

Implementation coding phase

d)

Testing and QA phase

41.

What does the principle of least privilege require when assigning user permissions?

a)

Grant admin by default

b)

Grant temporary guest access

c)

Grant broad read rights

d)

Grant only necessary access

42.

Which command on Windows displays active network connections and listening ports?

a)

netstat shows sockets

b)

ipconfig shows addresses

c)

route print shows table

d)

tracert shows hop path

43.

Which storage protocol commonly provides block-level access over Ethernet with targets and initiators?

a)

Fibre Channel fabric

b)

SMB file sharing protocol

c)

NFS file level sharing

d)

iSCSI block over Ethernet

44.

What is the best reason to implement multifactor authentication on remote access VPNs?

a)

Avoid VPN client updates

b)

Eliminate password resets

c)

Increase user login speed

d)

Reduce account takeover risk

45.

Which scripting language is most often used for automating tasks in Unix-like systems due to shell integration?

a)

Ruby scripting tools

b)

Perl scripting language

c)

PowerShell scripting

d)

Bash shell scripting

46.

What is the function of ARP in IPv4 networks?

a)

Assign IPs via dynamic leases

b)

Resolve hostnames to IP addresses

c)

Exchange routes between routers

d)

Map IP addresses to MAC addresses