wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CCC 112 Introduction to Computer Programming 1

Total questions: 60

Worksheet time: 3600secs

Name
Class
Date
1.

Which characteristic of Python makes code execute immediately after it is written?

a)

Object-oriented architecture

b)

Interpreter system

c)

Compiler optimization

d)

Modular design

2.

Python was first released publicly in which year?

a)

1989

b)

1991

c)

1994

d)

1998

3.

Which Python feature eliminates the need to explicitly declare variable types?

a)

Static typing

b)

Type inference

c)

Dynamic typing

d)

Auto-casting

4.

Which of the following is not a valid rule for Python identifiers?

a)

They can start with a letter

b)

They can contain numbers

c)

They can start with a number

d)

They can include underscores

5.

In Python, indentation is used to:

a)

Improve code execution time

b)

Separate functions from variables

c)

Define code blocks

d)

Indicate comments

6.

What happens when a user inputs data using input()?

a)

The value is stored as an integer

b)

The program automatically casts it

c)

The program continues without waiting

d)

The data is returned as a string

7.

Which category does tuple belong to in Python’s built-in data types?

a)

Binary type

b)

Mapping type

c)

Sequence type

d)

Text type

8.

Which function is used to explicitly convert a float string like "12.5" into a float?

a)

cast()

b)

float()

c)

convert()

d)

eval()

9.

What will print("Hello" + 5) result in?

a)

Hello5

b)

5Hello

c)

A TypeError

d)

No output

10.

The method used to convert a string to all lowercase letters is:

a)

lowerCase()

b)

lower()

c)

tolower()

d)

lowercase()

11.

Which Python string feature allows extraction of specific portions of a string?

a)

Index concatenation

b)

String slicing

c)

String partitioning

d)

Lexical trimming

12.

Which of the following is a numeric data type in Python?

a)

frozenset

b)

memoryview

c)

float

d)

range

13.

The main purpose of creating global variables is to:

a)

Improve loop speed

b)

Restrict variable access

c)

Use them inside and outside functions

d)

Automatically optimize memory

14.

Python was originally developed in which country?

a)

USA

b)

Germany

c)

Netherlands

d)

Canada

15.

What does the replace() method return?

a)

A modified copy of the string

b)

A list of replaced characters

c)

A boolean indicating success

d)

The number of replaced characters

16.

Which of the following represents a text data type in Python?

a)

str

b)

bytes

c)

list

17.

Which constructor removes decimals when converting?

a)

str()

b)

convert()

c)

float()

d)

int()

18.

What is the correct way to declare a string variable?

a)

text = Hello

b)

text = "Hello"

c)

string("Hello")

d)

var text = 'Hello'

19.

F-strings became available starting from which Python version?

a)

2.7

b)

3.0

c)

3.4

d)

3.6

20.

Which characteristic of Python made it popular among scientists in the early days?

a)

Built-in GUI library

b)

Numerical computation and data analysis capabilities

c)

Strong encryption support

d)

Extensive mobile development tools

21.

Which of the following best describes a list in Python?

a)

A fixed-size ordered collection of items

b)

A dynamic ordered collection that can store mixed data types

c)

An unordered mutable collection with unique values

d)

An immutable ordered collection of items

22.

What will list("abc") return?

a)

["abc"]

b)

("a", "b", "c")

c)

["a", "b", "c"]

d)

{"a", "b", "c"}

23.

Which method adds multiple items at once to a list?

a)

insert()

b)

append()

c)

update()

d)

extend()

24.

Which of the following removes an element by index from a list?

a)

remove()

b)

pop()

c)

delete()

d)

clear()

25.

What is the result of accessing my_list[-1]?

a)

The second element

b)

The first element

c)

An error

d)

The last element

26.

Which statement about tuples is TRUE?

a)

They can be extended using append().

b)

They allow element reassignment.

c)

They are immutable collections.

d)

They cannot be nested.

27.

What happens when a tuple is deleted using del my_tuple?

a)

All elements are set to None

b)

The reference to the tuple is removed

c)

Only the last element is deleted

d)

Tuple becomes empty but still exists

28.

Which operation is valid for tuple concatenation?

a)

tuple1 + tuple2

b)

tuple1 | tuple2

c)

tuple1.append(tuple2)

d)

tuple1.extend(tuple2)

29.

What is the main characteristic that distinguishes sets from lists?

a)

Sets support indexing

b)

Sets store only integers

c)

Sets do not allow duplicates

d)

Sets are ordered

30.

Which expression creates an empty set?

a)

{}

b)

set()

c)

[]

d)

{None}

31.

Which operation checks if an element exists in a set fastest?

a)

Using index

b)

Using in operator

c)

Using pop()

d)

Using count()

32.

What will happen if you try to modify an element inside a set directly?

a)

It is updated automatically

b)

It raises a TypeError

c)

The set converts to a list

d)

Nothing happens

33.

Which of the following creates a frozenset?

a)

frozen({1,2,3})

b)

frozenset([1,2,3])

c)

set.frozen([1,2,3])

d)

tuple.set()

34.

What is the result of {1,2,3} & {3,4,5}?

a)

{1,2,4,5}

b)

{3}

c)

{1,2}

d)

{3,4,5}

35.

Which Python collection stores data as key-value pairs?

a)

List

b)

Set

c)

Tuple

d)

Dictionary

36.

Which of the following is NOT allowed as a dictionary key?

a)

A string

b)

A tuple

c)

A list

d)

An integer

37.

What happens if a dictionary is created with duplicate keys?

a)

It raises an error

b)

All key-value pairs are stored

c)

The last value overwrites the previous one

d)

The first value is retained

38.

Which method removes the last inserted key-value pair in a dictionary?

a)

pop()

b)

del

c)

remove()

d)

popitem()

39.

Which statement about dictionary keys is TRUE?

a)

Keys are case-sensitive

b)

Keys can be lists

c)

Keys must be unique only within nested dictionaries

d)

Keys can be changed after creation

40.

Which collection type is ordered and unchangeable?

a)

List

b)

Tuple

c)

Set

d)

Dictionary

41.

Which statement is used to make decisions in Python?

a)

for

b)

if

c)

loop

d)

repeat

42.

Which keyword is used when all previous conditions in an if-elif chain are False?

a)

finally

b)

unless

c)

else

d)

break

43.

What does the elif keyword represent?

a)

A separate if statement

b)

Another condition after the first if

c)

The end of a loop

d)

A loop control instruction

44.

Which logical operator returns True if at least one condition is True?

a)

and

b)

or

c)

not

d)

==

45.

What is a nested if statement?

a)

An if inside a loop

b)

An if statement placed inside another if or else block

c)

A loop inside an if

d)

A function inside an if

46.

Short-hand if (single-line if) is used when:

a)

The condition and the action fit on one line

b)

The condition is always false

c)

The code block is very long

d)

You need user input

47.

Which operator is used to reverse a condition?

a)

and

b)

or

c)

not

d)

xor

48.

Which loop repeats as long as a condition remains True?

a)

for loop

b)

while loop

c)

do loop

d)

until loop

49.

The break statement is used to:

a)

Skip to the next iteration

b)

End the loop immediately

c)

Restart the loop

d)

Pause the program

50.

The continue statement does what?

a)

Ends the loop

b)

Repeats the last instruction

c)

Skips the current iteration and moves to the next

d)

Stops the entire program

51.

What kind of loop is best for iterating over sequences (lists, strings, etc.)?

a)

switch loop

b)

for loop

c)

while loop

d)

recursive loop

52.

The range() function is used to:

a)

Create infinite loops

b)

Generate a sequence of numbers

c)

Randomize values

d)

Convert data types

53.

The else clause in a loop executes when:

a)

The loop ends normally without break

b)

The loop has no condition

c)

A continue is used

d)

The loop runs only once

54.

What is an infinite loop?

a)

A loop that runs only twice

b)

A loop without a break

c)

A loop whose condition never becomes False

d)

A loop that returns many outputs

55.

Which form of control structure is used for decision-making?

a)

loop structures

b)

if-elif-else

c)

functions

d)

classes

56.

What does a nested loop contain?

a)

A loop inside another loop

b)

A loop without conditions

c)

Only if-else statements

d)

A loop inside a function

57.

A while-else block executes the else part when:

a)

The loop breaks early

b)

The loop condition becomes False naturally

c)

The loop runs only once

d)

The loop contains continue

58.

Which condition is correctly written in Python?

a)

if a = 10

b)

if a equals 10

c)

if a == 10

d)

if (a = 10) then

59.

Short-hand if-else (ternary operator) is written as:

a)

if condition then value

b)

value1 or value2

c)

value_if_true if condition else value_if_false

d)

if(condition){...}

60.

Logical operators in Python include:

a)

plus, minus, divide

b)

if, elif, else

c)

and, or, not

d)

true, false, none