wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.2 Programming Alt

Total questions: 87

Worksheet time: 44mins

Name
Class
Date
1.
1.Which of the following programming construct denotes execution of statements or functions one after another?
a)
A.Sequence
b)
B.Selection
c)
C.Iteration
2.
3.Which of the following arithmetic operator in Python is used to find remainder of a division operation?
a)
A.DIV
b)
B.//
c)
C.%
3.
4.What is the function of // operator in Python?
a)
A.Finding quotient of division operation
b)
B.Finding remainder of division operation
c)
C.Finding quotient and rounding it to the next whole number
d)
D.None of the above
4.
5.Which of the following arithmetic operator in Python is used to find 25?
a)
A.^
b)
B.*
c)
C.**
d)
D.None of the above
5.
6.Complete this sentence: ……………………… is used to execute a particular set of statements repeatedly until a condition is satisfied.
a)
A.Sequence
b)
B.Iteration
c)
C.Selection
d)
D.All of the above
6.
7.Which of the following structure is used to iterate a set of statements by counting the number of times it needs to be executed?
a)
A.For structure
b)
B.Do…. While
c)
C.Repeat… Until
d)
D.None of the above
7.
8.Which of the following structures is NOT available in Python?
a)
A.For structure
b)
B.While loop
c)
C.Repeat… Until
d)
D.None of the above
8.
10.Which of the following programming construct is used to print out multiplication tables?
a)
A.Iteration
b)
B.Selection
c)
C.Sequence
9.
12.Complete the syntax for ‘for’ structure in Python:
a)
for variable in …………………. :
b)
print (k, "times 4 is ", k*4)
c)
A.(numbers)
d)
B.range(numbers)
e)
C.Starting number to ending number
10.
13.What is the function of break statement in Python?
a)
A.Terminates the program
b)
B.Terminates the current loop and resumes operation from next statement
c)
C.Allow user to input values during program execution
11.
1.Which of the following represents labels that represent values in computer and that can be changed during program execution?
a)
A.Variables
b)
B.Constants
c)
C.Data types
12.
2.Which of the following is FALSE?
a)
A.Variable declaration is done at the start of the program
b)
B.Variable declaration is important to allocate required memory space
c)
C.Not initialising a variable results in an error-free output
d)
D.All of the above
13.
3.What symbol is used to assign values in Python?
a)
A.=
b)
B.==
c)
C.←
14.
4.Which of the following is NOT an integer?
a)
A.3
b)
B.-3.2
c)
C.-3
d)
D.0
15.
5.Which of the following is a real number?
a)
A.3
b)
B.3.5
c)
C.-4
d)
D.All of the above
16.
6.Which of the following data types is used to store several characters?
a)
A.Character
b)
B.String
c)
C.Boolean
d)
D.All of the above
17.
7.Complete this sentence: A ………………… data type represents only two values.
a)
A.Character
b)
B.Integer
c)
C.Boolean
d)
D.All of the above
18.
8.Which of the following statements is used to typecast a variable that holds string data type?
a)
A.Variable_name=input(“Enter string value: ”)
b)
B.Variable_name=Str(input(“Enter string value: ”))
c)
C.Variable_name=String(input(“Enter string value: ”))
d)
D.Variable_name=Chr(input(“Enter string value: ”))
19.
9.How much memory is allocated for a Boolean variable?
a)
A.1 bit
b)
B.1 byte
c)
C.2 byte
d)
D.No limits
20.
10.How much memory is allocated for a character variable?
a)
A.1 bit
b)
B.1 byte
c)
C.2 byte
d)
D.No limits
21.
11.How much memory is allocated for a string variable?
a)
A.1 bit
b)
B.1 byte
c)
C.2 byte
d)
D.No limits
22.
14.What symbol is used to add comments in Python?
a)
A.#
b)
B.%
c)
C.//
d)
D.!
23.
1.If string_name=‘Programming techniques’. What is the output of print(string_name.length)?
a)
A.20
b)
B.21
c)
C.22
d)
D.23
24.
2.If string_name=‘Programming techniques’. What is the output of print(string_name.substring(5,6))?
a)
A.amming
b)
B.ramming
c)
C.rammin
d)
D.gramm
25.
3.If string_name=‘Programming techniques’. What is the output of print(string_name.substring(12,4))?
a)
A.tech
b)
B. tec
c)
C.echn
d)
D.techn
26.
4.Which of the following represents the code that changes a variable string_name to uppercase characters?
a)
A.string.upper()
b)
B.string_name.upper()
c)
C.string_name.uppercase()
27.
5.What command is used to find length of string in Python?
a)
A.length()
b)
B.len()
c)
C.lengthof()
d)
D.None of the above
28.
6.If string_name=‘Patrick’, what is the value returned for string_name[2:3]?
a)
A.‘t’
b)
B.‘a’
c)
C.‘r’
d)
D.‘tri’
29.
7.If string_name=‘Patrick’, what is the value returned for string_name[3:6]?
a)
A.‘trick’
b)
B.‘rick’
c)
C.‘ric’
d)
D.Error message
30.
8.If string_name=‘I like Programming’, what is the output for print(‘like’ in string_name)?
a)
A.[2:6]
b)
B.True
c)
C.False
d)
D.None of the above
31.
9.If string_name=‘I like Programming’, what is the output for string_name.find(‘like’)?
a)
A.True
b)
B.False
c)
C.[2:6]
d)
D.2
32.
10.If string_name=‘I like Programming’, what is the output for string_name.find(‘computer’)?
a)
A.True
b)
B.False
c)
C.-1
d)
D.None of the above
33.
11.If str1=‘Yes’ and str2=‘No’, what is the result for str1+str2 in Python?
a)
A.‘YesNo’
b)
B.‘Yes No’
c)
C.YesNo
d)
D.Yes and No
34.
12.What function converts a character to its ASCII code in Python?
a)
A.ASC()
b)
B.ord()
c)
C.chr()
d)
D.ascii()
35.
13.What function converts an ASCII code to its character in Python?
a)
A.ASC()
b)
B.ord()
c)
C.chr()
d)
D.ascii()
36.
14.Which of the following method is used to check whether a character is in lowercase or not in Python?
a)
A.lower()
b)
B.islower()
c)
C.upper()
d)
D.isupper()
37.
15.Which of the following function is used to convert the number 9.11 to string in Python?
a)
A.str()
b)
B.int()
c)
C.string()
d)
D.float()
38.
16.Which of the following function is used to convert string value ‘4.56’ to a data type such that it can be used in mathematical operations in Python?
a)
A.str()
b)
B.int()
c)
C.real()
d)
D.float()
39.
1.Complete this sentence: ………………………….. are subprograms that can be called whenever required from the main program.
a)
A.Functions
b)
B.Procedures
c)
C.Both A and B
40.
2.Complete this example: Function is an example of ……………………..
a)
A.Computational thinking
b)
B.Abstraction
c)
C.Generalisation
d)
D.Algorithmic design
41.
3.Which of the following is NOT required to be known by an user?
a)
A.Function name
b)
B.How function works?
c)
C.Inputs and outputs of the function
d)
D.Function code
42.
4.What is the difference between functions and procedures?
a)
A.Function are sub-programs defined outside the main program. Whereas, procedures are defined inside the main program.
b)
B.Functions return values but procedures do not return a value.
c)
C.None of the above
43.
5.What parameters are passed to a function, when the control is transferred from main program to function?
a)
A.Input
b)
B.Output
c)
C.Function code
d)
D.None of the above
44.
6.What parameters are returned to main program, when the control is transferred from function to main program?
a)
A.Input
b)
B.Output
c)
C.Function code
d)
D.None of the above
45.
7.Complete this statement: The ………………………….. statement transfers the control from main program to function and vice versa.
a)
A.Function call
b)
B.Input
c)
C.Output
d)
D.Print
46.
8.A function named ‘area’ calculates area of a rectangle. Which of the following is its function call statement in main program?
a)
A.area_rect=area (length, breadth)
b)
B.area=length × breadth
c)
C.print(area_rect)
d)
D.A and C
47.
9.A function named ‘area’ calculates area of a rectangle. Which of the following is a statement of function code?
a)
A.area_rect=area (length, breadth)
b)
B.area=length × breadth
c)
C.print(area_rect)
d)
D.A and B
48.
12.Complete this sentence: Variables and constants declared inside a sub-routine using ……………. keyword are accessible throughout the program.
a)
A.local
b)
B.global
c)
C.Both A and B
49.
1.Complete this sentence: ………………………….. are subprograms that can be called whenever required from the main program.
a)
A.Functions
b)
B.Procedures
c)
C.Both A and B
50.
2.Complete this example: Function is an example of ……………………..
a)
A.Computational thinking
b)
B.Abstraction
c)
C.Generalisation
d)
D.Algorithmic design
51.
3.Which of the following is NOT required to be known by an user?
a)
A.Function name
b)
B.How function works?
c)
C.Inputs and outputs of the function
d)
D.Function code
52.
4.What is the difference between functions and procedures?
a)
A.Function are sub-programs defined outside the main program. Whereas, procedures are defined inside the main program.
b)
B.Functions return values but procedures do not return a value.
c)
C.None of the above
53.
5.What parameters are passed to a function, when the control is transferred from main program to function?
a)
A.Input
b)
B.Output
c)
C.Function code
d)
D.None of the above
54.
6.What parameters are returned to main program, when the control is transferred from function to main program?
a)
A.Input
b)
B.Output
c)
C.Function code
d)
D.None of the above
55.
7.Complete this statement: The ………………………….. statement transfers the control from main program to function and vice versa.
a)
A.Function call
b)
B.Input
c)
C.Output
d)
D.Print
56.
8.A function named ‘area’ calculates area of a rectangle. Which of the following is its function call statement in main program?
a)
A.area_rect=area (length, breadth)
b)
B.area=length × breadth
c)
C.print(area_rect)
d)
D.A and C
57.
9.A function named ‘area’ calculates area of a rectangle. Which of the following is a statement of function code?
a)
A.area_rect=area (length, breadth)
b)
B.area=length × breadth
c)
C.print(area_rect)
d)
D.A and B
58.
12.Complete this sentence: Variables and constants declared inside a sub-routine using ……………. keyword are accessible throughout the program.
a)
A.local
b)
B.global
c)
C.Both A and B
59.
1.Complete this sentence: Arrays are ……………… data structures.
a)
A.Linear, homogenous and static
b)
B.Linear, homogenous and dynamic
c)
C.Non-linear, homogenous and static
d)
D.Non-linear, non-homogenous and dynamic
60.
2.Which of the following is TRUE about arrays?
a)
A.Arrays store data in a certain order
b)
B.All data in an array are of the same data type
c)
C.Each element has a corresponding index value
d)
D.All of the above
61.
3.Complete this sentence: A/An ……………… module is initiated from the Python library to work with arrays.
a)
A.array
b)
B.data structure
c)
C.index
d)
D.none of the above
62.
4.Complete this sentence: The index of an array starts with ………………
a)
A.0
b)
B.1
c)
C.-1
d)
D.2
63.
5.An array number_of_students represents 10 students’ marks which of the following in this array declaration?
a)
A.number_of_students=array('i', range(10))
b)
B.number_of_students=array.array('i', range(1,10))
c)
C.number_of_students=array.array('i', range(10))
d)
D.None of the above
64.
6.A program prompts the user to input values to an array. What programming structure is required for this?
a)
A.Case structures
b)
B.If… else….
c)
C.Iteration
d)
D.None of the above
65.
7.An array studentmark consists of data: [90,85,70,75,80]. What is the output of print(studentmark[3])?
a)
A.70
b)
B.75
c)
C.80
66.
8.A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of print(Array_2d[1])?
a)
A.[1, 2, 3, 4]
b)
B.[5, 6, 7, 8]
c)
C.[9, 10, 11, 12]
d)
D.None of the above
67.
9.A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of print(Array_2d[1][1])?
a)
A.1
b)
B.2
c)
C.5
d)
D.6
68.
11.Which of the following is NOT an array?
a)
A.Numbers=[1,2,3,4,5]
b)
B.Subject=[“Maths”, “Science”, “Geography”, “History”, “7891”]
c)
C.Subject=[“Maths”, “Science”, “Geography”, “History”, 7891]
69.
12.What is common between the elements of a homogeneous data structure?
a)
A.Format
b)
B.Data type
c)
C.Number of characters
70.
13.A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of len(print(Array_2d)?
a)
A.2
b)
B.3
c)
C.4
d)
D.12
71.
14.A two-dimensional array Array_2d consists of data: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]. What is the output of len(print(Array_2d[2])?
a)
A.1
b)
B.3
c)
C.4
d)
D.12
72.
15.Which of the following is FALSE about arrays?
a)
A.Arrays are static data structures.
b)
B.Elements of arrays are of the same data type.
c)
C.Elements of arrays cannot be modified.
d)
D.Arrays are of fixed length.
73.
16.Which of the following is FALSE about records?
a)
A.A record may consist of elements with different data types.
b)
B.The number of fields in a record is always fixed.
c)
C.Elements in a record are related to each other.
74.
17.Which of the following is TRUE about tuples?
a)
A.Tuples represent elements of the same data type.
b)
B.The length of a tuple can be changed.
c)
C.A tuple is a dynamic data structure.
d)
D.Elements of a tuple cannot be modified.
75.
18.Which of the following is the correct representation of a list in Python?
a)
A.(1, 2, ‘three’, 4)
b)
B.[1, 2, ‘three’, 4]
c)
C.{1, 2, ‘three’, 4}
d)
D.(1, 2, 3, 4)
76.
19.Consider a tuple, fruits= (‘apple’, ‘orange’, ‘watermelon’, ‘grapes’, ‘banana’). What is the output for the statement print(fruits[-1])?
a)
A.Apple
b)
B.Orange
c)
C.Banana
d)
D.Error
77.
20.Complete this sentence: A list is a ………………………. data structure.
a)
A.Dynamic
b)
B.Static
c)
C.Homogenous
d)
D.Non-linear
78.
1.Which of the following is a software component of Database management system that updates and deletes data from a database?
a)
A.Query language processor
b)
B.SQL query
c)
C.DBMS engine
d)
D.None of the above
79.
2.Which of the following is a part of query language processor?
a)
A.SQL parser
b)
B.SQL optimiser
c)
C.Query execution engine
d)
D.All of the above
80.
3.What is the function of <> operator?
a)
A.Less than
b)
B.Greater than
c)
C.Equal to
d)
D.Not equal to
81.
4.What is the function of <= operator?
a)
A.Less than
b)
B.Equal to
c)
C.Less than or equal to
d)
D.Not equal to
82.
5.Which of the following statement is used to display all the fields of a table?
a)
A.SELECT * FROM table_name
b)
B.CREATE * FROM table_name
c)
C.DISPLAY * FROM table_name
d)
D.None of the above
83.
6.Which of the following are Boolean operators?
a)
A.AND, OR and NOT
b)
B.ADD, SUB, MULT and DIV
c)
C.LIKE and WHERE
d)
D.None of the above
84.
7.Which of the following is used to select records while displaying results using SELECT statement?
a)
A.UPDATE
b)
B.CREATE TABLE
c)
C.WHERE
d)
D.WHICH
85.
14.Which of the following wildcard character represents zero or more characters?
a)
A.Ampersand(&)
b)
B.Underscore (_)
c)
C.Percentage (%)
86.
15.Which of the following wildcard character represents a single character?
a)
A.Ampersand(&)
b)
B.Underscore (_)
c)
C.Percentage (%)
87.
16.Which of the following statement is used to remove data from table?
a)
A.REMOVE
b)
B.DELETE
c)
C.UPDATE
d)
D.None of the above