Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Informatics Practices Mid-Term Exam

Total questions: 35

Worksheet time: 3600secs

Name
Class
Date
1.

Dictionaries are set of _________elements.

a)

sorted

b)

ordered

c)

unordered

d)

random

2.

Dictionaries are also called____________.

a)

mappings

b)

hashes

c)

associative arrays

d)

all of these

3.

Auxiliary memory refers to:

a)

Primary memory

b)

Secondary memory

c)

Ternary memory

d)

All of these

4.

Which of the following is correct with respect of the following Python code? d = {"X":3,"Y":7}

a)

a dictionary d is created

b)

X and Y are the keys of dictionary d

c)

3 and 7 are the values of dictionary d

d)

All of these

5.

Which of the following is the correct extension of the Python file?

a)

.py

b)

.python

c)

Both (a) and (b)

d)

None of these

6.

Which one of the following brackets do we use to create a LIST in Python?

a)

( )

b)

[ ]

c)

{ }

d)

" "

7.

Is Python case-sensitive when dealing with identifiers?

a)

no

b)

yes

c)

machine dependent

d)

none of the mentioned

8.

Which of the following is not a decision-making statement?

a)

if statement

b)

if-elif statement

c)

for statement

d)

if -else statement

9.

What will be the output of the following code? d = {'spring': 'autum', "autumn": "fall", "fall":"spring"} print (d["autumn"])

a)

autumn

b)

fall

c)

spring

d)

Error

10.

Which one of the following is the correct way of initializing a variable, x with value 5 in Python?

a)

int x

b)

int x = 5

c)

x = 5

d)

all of these

11.

Which one of the following will give an error?

a)

a=b=c=1

b)

a,b,c=1

c)

a,b,c=1,1,1

d)

None of these

12.

What will be the output of the following code? D1 = {"cat":17, "dog":6, "elephant":23, "bear":20} print (25 in D1)

a)

True

b)

False

c)

Error

d)

None

13.

What is the output when we execute list(“hello”)?

a)

[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]

b)

[‘hello’]

c)

[‘llo’]

d)

[‘olleh’]

14.

To decrease the value of X by 4 using an augmented operator, the correct expression will be :

a)

X-=4

b)

X*=4

c)

X=X**4

d)

None of the mentioned

15.

Correct syntax of writing simple ‘ if Statement’ is ................

a)

if condition statements

b)

if (condition) statements

c)

if condition : statements

d)

if condition-- statements

16.

Which one of the following is correct to create an empty dictionary?

a)

myDic = ( )

b)

myDic = [ ]

c)

myDic = { }

d)

None of these

17.

Assertion (A): Solving an expression involves NOT, AND, OR with no parenthesis then Reasoning (R): NOT will be evaluated first; AND will be evaluated second; OR will be evaluated last.

a)

Both A and R are true and R is the correct explanation for A

b)

Both A and R are true and R is not the correct explanation for A

c)

A is True but R is False

d)

A is False but R is True

18.

Assertion (A): We are trying to change an element in a tuple, we get an error Reasoning (R): Because tuple is an immutable data type, here we cannot change any element.

a)

Both A and R are true and R is the correct explanation for A

b)

Both A and R are true and R is not the correct explanation for A

c)

A is True but R is False

d)

A is False but R is True

19.

What is for loop in python? Write syntax and example.

4 lines
20.

Why can’t Lists be used as keys of dictionaries?

4 lines
21.

Why is a dictionary termed as an unordered collection of objects?

4 lines
22.

What is list in python? How we can create a list in Python?

4 lines
23.

Write difference between = and == OR Write the Differences between RAM and ROM.

4 lines
24.

What is an operating system? Give a few examples.

4 lines
25.

What is the value of this expression? 2**2**1

4 lines
26.

Which of the following will result in an error for a given valid empty dictionary D?

4 lines
27.

What is the output of the following codes? i. print(float(49//5)) ii. print(49//5) iii. print(49%5)

4 lines
28.

What is the output of the following codes? i. x = 15 print(x > 14 and x < 16) ii. a={(1,2):1,(2,3):2} print(a[1,2]) iii. a={'a':1,'b':2,'c':3} print(a['a','b'])

4 lines
29.

What is the difference between Interpreter and a Compiler? (any three) OR What is the difference between Software and Hardware? (any three)

4 lines
30.

What do you understand by Python programming language? Who developed Python programming language? OR Explain the evolution of computing devices.

4 lines
31.

Find out the Errors and rewrite the corrected code also underline the corrected part. #Write a Python program to check whether a number is negative, positive or zero. num = = int(input('Enter the number :')) if (num = 0): print('It is zero.') elif (num < 0): print('It is positive.') else print('It is negative.') OR #Write a Python program to check whether a year is leap year or not. year = int(input("Enter Year: ")) if (year % 4 == 0 or year % 100 != 0): print(year, "is a Leap Year") elif (year % 100 = 0): print(year, "is not a Leap Year") elif (year * 400 ==0): print(year, "is a Leap Year") else: input(year, "is not a Leap Year")

4 lines
32.

Find out the Errors and rewrite the corrected code also underline the corrected part. #Write a program to create a dictionary containing names of competition winner students as keys and number of their wins as values. n = int(input("How many students?")) CompWinners = { } for a in range(n): value == input("Name of the student :") key = int (input("Number of competitions won :")) CompWinners [key] == value print("The Dictionary now is :") print(CompWinners) OR #program that inputs a list, replicates it twice, and then prints the sorted list in ascending and descending orders. val = EVAL(input("Enter a list :")) print("Original list :", val) val = val * 2 print("Replicated list :", val) val.SORT() print("Sorted in ascending order :", val) val.SORT(reverse = False) print("Sorted in descending order :", val)

4 lines
33.

Write examples of the following ways to create a Python dictionary using dict( ) function. i. Creating an empty dictionary by dict( ) function. ii. Specify key:value pairs as keyword arguments to dict( ) function. iii. Specify comma-separated key:value pairs. iv. Specify keys separately and corresponding values separately. v. Specify key:value pairs separately in the form of sequences.

4 lines
34.

What do you understand by the “nested if “ statement? Write syntax for different formats of “nested if “statements. OR Write the output of the following Python statements. i. for x in range(5): print(x) ii. for y in range(2,5): print(y)

4 lines
35.

Write the output return by the following slices for the given below list. List = [’a’,’b’,’c’,10, 20, 30, 40, 50, 60, 70, 80, 90] i. print(List[::]) ii. print(List[::2]) iii. print(List[3:9:2]) iv. print(List[::-1]) v. print(List[1:1:-2]) OR Write the difference for the following:- i. between append() and extend() ii. between sort() and sorted()

4 lines