0% found this document useful (0 votes)
56 views6 pages

Python - IAT QP 1 - Credit FD

This document outlines the Internal Assessment Test for the course 'Python Programming-I with Linux' at the East West Institute of Technology for the academic year 2024-25. It includes multiple-choice questions covering various topics related to Python programming, such as syntax, data types, control structures, and functions. The test is scheduled for January 8, 2025, and consists of 60 questions with a total of 60 marks.

Uploaded by

ms0602487
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views6 pages

Python - IAT QP 1 - Credit FD

This document outlines the Internal Assessment Test for the course 'Python Programming-I with Linux' at the East West Institute of Technology for the academic year 2024-25. It includes multiple-choice questions covering various topics related to Python programming, such as syntax, data types, control structures, and functions. The test is scheduled for January 8, 2025, and consists of 60 questions with a total of 60 marks.

Uploaded by

ms0602487
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

For Distribution

EAST WEST INSTITUTE OF TECHNOLOGY


(An Autonomous Institute under VTU) USN
Internal Assessment Test – I

Dept. of Academic Year: 2024– 25/ ODD


Course Title: PYTHON PROGRAMMING-I WITH LINUX Course Code: Sem: I
Date: 08-01-2025 Time: 2:00PM to 4:PM Duration: 120 Mins
Name of the Course Instructor(s): Max Marks: 60
Instructions: Answer all the questions. Use OMR sheet to answer. Marking two answers for the same question makes the answer invalid.
Good Luck!
Mark
Q No. Multiple choice question RBT CO
s
1. Who developed Python?
1 L CO1
A. Guido van Rossum B. Dennis Ritchie C. James Gosling D. Brendan Eich
2. In which year was Python created?
1 L CO1
A. 1989 B. 1991 C. 2000 D. 1995
3. What type of programming language is Python?
1 L CO1
A. Compiled B. Interpreted C. Both compiled and interpreted D. Assembly
4. Which of the following is NOT a characteristic of Python?
1 L CO1
A. Open-source B. High-level C. Platform-dependent D. Object-oriented
5. Which of the following is a feature of Python?
1 L CO1
A. Easy to learn B. Dynamically typed C. Extensive libraries D. All of the above
6. What does it mean for Python to be dynamically typed?
1
L CO1
A. Variables must be declared before use B. Data type is decided during runtime
C. Variables are strongly typed D. None of the above
7. Which command is used to check the installed Python version?
1 L CO1
A. python3 -v B. python3 –version C. py –v D. pythonversion
8. What is the default extension for Python files?
1 L CO1
A. .pyt B. .py C. . python D. .pt
9. Which of the following is a Python keyword?
1 L CO1
A. def B. return C. lambda D. All of the above
10. How many keywords are there in Python 3.x?
1 L CO1
A. 30 B. 33 C. 35 D. 40
11. Which of the following is NOT a Python keyword?
1 L CO1
A. with B. finally C. switch D. yield
12. Which symbol is used to write comments in Python?
1 L CO1
A. // B.# C. /* */ D. <-- -->
13. What will the following code output?
# print("Hello") L CO1
print("World") 1
A. Hello B. World C. Hello World D. Nothing
14. Which of the following is a mutable data type in Python?
1 L CO1
A. str B. tuple C. list D. int
15. Which of the following correctly declares a variable in Python?
1 L CO1
A. var x = 5 B. x := 5 C. x = 5 D. declare x = 5
For Distribution

16. What is the output of the following code?


1 L CO1
print(type(3.14))

A. <class 'int'> B. <class 'float'> C. <class 'complex'> D. <class 'double'>


17. What will the following code produce?

x = [1, 2, 3]
1 L CO1
print(type(x))

A. <class 'list'> B. <class 'tuple'> C. <class 'set'> D. <class 'dict'>


18. Which function is used to convert a value to an integer?
1 L CO1
A. float() B. int() C. str() D. bool()
19. What does the following code output?

print(int(3.9)) 1 L CO1

A. 4 B. 3 C. 3.9 D. Error
20. What are bitwise operators in Python used for?
1
A. To perform arithmetic operations. L CO1
B. To perform operations on individual bits of numbers.
C. To manipulate strings. D. None of the above.
21. What is the result of the following operation?
1 L CO1
print(4 << 1)

A. 8 B. 4 C. 2 D. 6
22. Which function is used to take user input in Python?
1 L CO1
A. cin B. input() C. scanf() D. read()
23. What is the output of the following code?

x = input("Enter a number: ") 1 L CO1


print(type(x))

A. <class 'int'> B. <class 'float'> C. <class 'str'> D. Error


24. Which of the following can be used for formatted output in Python?
1 L CO1
A. print() B. f-strings C. str.format() D. All of the above
25. What will the following code produce?

print("The value is: ", 42) 1 L CO1

A. The value is: 42 B. The value is: ,42 C. 42 D. Error


26. Which function is used to display output in Python?
1 L CO1
A. write() B. display() C. show() D. print()
27. L CO2
What is the output of the following code?

x = 10
if x > 5:
print("Greater") 1
else:
print("Smaller")
For Distribution

A. Greater B. Smaller C. Error D. None


28. Which of the following is the correct syntax for an if-else statement in Python?
1
L CO2
A. if condition: { } else: { } B. if condition { } else { } C. if condition: else:
D. if condition: ... else:
29. What will the following code produce?

x=5
if x == 5:
print("x is 5")
elif x > 5: 1 L CO2
print("x is greater than 5")
else:
print("x is less than 5")

A. x is 5 B. x is greater than 5 C. x is less than 5 D. Error


30. Which function generates a sequence of numbers for a loop in Python?
1 L CO2
A. sequence() B. range() C. loop() D. numbers()
31. Which of the following can be used to iterate over a list in Python?
1
L CO2
A. for B. while C. Both for and while D. None of the above

32. What will the following code output?

for i in range(0, 10, 3): L CO2


1
print(i, end=", ")
A. 0, 1, 2, 3, B. 0, 3, 6, 9, C. 3, 6, 9, D. 0, 3, 6,
33. What is the output of the following code?

i=0
while i < 3: 1 L CO2
print(i)
i += 1

A. 0 1 2 B. 1 2 3 C. 0 1 2 3 D. Error
34. What does the continue statement do in a loop?
L CO2
A. Ends the loop. B. Skips the current iteration and proceeds to the next. 1
C. Repeats the current iteration. D. Causes an error.
35. What will the following code produce?
for i in range(3):
if i == 1:
break 1 L CO2
print(i)

A. 0 1 B. 0 C. 1 2 D. Error
36. Which of the following is TRUE about control structures in Python?
L CO2
A. Indentation is mandatory. B. Curly braces {} define blocks of code. 1
C. Control structures are optional. D. None of the above
37. What is the purpose of the pass statement?
1
L CO2
A. It skips the current iteration. B. It ends a loop or function.
C. It is a placeholder that does nothing. D. None of the above
38. L CO3
How do you define a function in Python?
1
A. function myFunction(): B. def myFunction():
For Distribution

C. define myFunction(): D. func myFunction():


39. What is the correct way to pass a list my_list as an argument to a function myFunction()?

A. myFunction(my_list) B. myFunction(list=my_list) L CO3


1
C. myFunction[my_list] D. myFunction{my_list}

40. In Python, what is the purpose of the *args parameter in a function?

A. To pass a fixed number of arguments


B. To pass a variable number of arguments as a tuple L CO3
1
C. To pass a variable number of arguments as a dictionary
D. To pass only string arguments

41. What will be the output of the following code snippet?

a=3
b=1
print(a, b) 1
L CO1
a, b = b, a
print(a, b)

A. 3 1 1 3 B. 3 1 3 1 C. 1 3 1 3 D. 1 3 3 1

42. How is a code block indicated in Python?


1 L CO3
A. Brackets B. Indentation C. Key D. None of the above
43. What is the output of the following code?
def my_function(x, y=5):
return x + y
1 L CO3
print(my_function(10))

A. 5 B. 10 C. 15 D. Error
44. What will the following code output?
def my_function(a, b=2, c=3):
return a + b + c
1 L CO3
print(my_function(1, c=10))

A. 6 B. 13 C. 12 D. Error
45. What will be the output of the following Python code?
def sayHello():
print('Hello World!')
sayHello()
sayHello()

A. Hello World! 1
L CO3
Hello World!
B. 'Hello World!'
'Hello World!'
C. Hello
Hello
D. None of the mentioned

46. What is the command to install the python in linux? L CO1

A. sudo apt install python3 1


B. pip install python3
C. sudo install python3
D. none of the above
For Distribution

47. What is the order of precedence in python?

A. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction


L CO1
B. Exponential, Parentheses, Division, Multiplication, Addition, Subtraction 1
C. Parentheses, Exponential, Multiplication, Addition, Division, Subtraction
D. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
48. What is the correct term for arguments passed to a function in Python?
L CO3
A. Variables B. Parameters C. Attributes D. Keywords
1
49. Which of the following is true about the break statement in Python?

A. It is used to pause the loop execution 1 L CO2


B. It is used to break out of the current loop
C. It skips the rest of the code inside the loop for the current iteration
D. It restarts the loop from the beginning
50. What will the following code output?

def func(a, b=5, c=10):

return a + b + c L CO3
1
print(func(1, 2))

A. 18 B. 16 C. 13 D. Error

51. What will be the output of the following Python expression?

4 ** 2 + 6 // 3 1 L CO1
A. 52 B. 16.67 C. 18 D. 19

52. Which keyword is used to define a function in Python?


L CO3
A. func B. define C. function D. def 1

53. Which of these has the highest precedence in Python?

1 L CO1
A. Comparison operators (<, >, ==) B. Logical operators (and, or)
C. Unary operators (+x, -x, not x) D. Assignment operators (=)
54. What will be the output of the following code snippet?
print(2**3 + (5 + 6)**(1 + 1))
1 L CO1
A. 129 B. 8 C. 121 D. None of the above

55. What will be the datatype of the var in the below code snippet?

var = 10
print(type(var))
var = "Hello" 1 L CO1
print(type(var))

A. str and int B. int and int C. str and str D.int and str
56. What will be the output of the following code snippet?
print(type(5 / 2))
print(type(5 // 2)) 1
L CO1
A. float and int B. int and float C. float and float D. int and int
For Distribution

57. Which statement is used to exit a function and return a value?


L CO3
A. break B. exit C. return D. stop 1

58. Which of the following types of loops are not supported in Python?
1 L CO2
A. for B. while C. do-while D. None of the above
59. As what datatype are the *args stored, when passed into a function?
1
L CO3
A. List. B. Tuple. C. Dictionary. D. None of the above.

60. What is the purpose of a while loop?

A. To execute a block of code only once


L CO2
B. To execute a block of code a specific number of times 1
C. To execute a block of code as long as a condition is true
D. To execute a block of code until a condition is false

You might also like