0% found this document useful (0 votes)
4 views3 pages

Python Programming Concepts and Exercises

The document contains a series of questions and programming tasks related to Python, covering topics such as Python architecture, variable types, instance methods, object creation, case sensitivity, code compilation, keywords, mathematical expressions, code blocks, and outputs of specific code snippets. Each question is assigned a specific mark value indicating its weight in an assessment. The document serves as an examination or practice sheet for evaluating knowledge and skills in Python programming.

Uploaded by

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

Python Programming Concepts and Exercises

The document contains a series of questions and programming tasks related to Python, covering topics such as Python architecture, variable types, instance methods, object creation, case sensitivity, code compilation, keywords, mathematical expressions, code blocks, and outputs of specific code snippets. Each question is assigned a specific mark value indicating its weight in an assessment. The document serves as an examination or practice sheet for evaluating knowledge and skills in Python programming.

Uploaded by

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

[Link] python architecture with diagram. (4 Marks)...

[Link] a python program to demonstrate all the two types of variables (2 Marks)

[Link] a python program with 2 instance methods and invoke one instance method in another.

E.g. Student goes to School and plays in the School. (2 Marks)

[Link] a python program to create an object of an employee and pass employeeId,


employeeName, employeeRole and employeeSalary via constructor (2 marks)

[Link] python case sensi ve when dealing with Iden fiers (1 Mark)

a) No
b) Yes
c) Depends on machine
d) Depends on programmer

[Link] python code compiled or interpreted (1 Mark)

a) It is both compiled and interpreted


b) It is neither compiled or interpreted
c) Python code is only compiled
d) Python code is only interpreted

[Link] the keywords in python are in (1 Mark)

a) Capitalized
b) Uppercase
c) CamelCase
d) None of the above

[Link] is the value of the following mathema cal expression in python (1 Mark)

4+3%5

a) 7
b) 2
c) 4
d) 1

[Link] of the following is used to define a block of code in python (1 Mark)

a) Indenta on
b) Single Space
c) Brackets
d) All of the above
[Link] is the output of the python code: (2 Marks)

class Tester:

def __init__(self, id):

[Link]=str(id);

id = “224”;

temp = Tester(12);

print([Link]);

[Link] is the output of the following code: (2 Marks)

x=50;

def display(x):

print(‘x is ‘, x);

x=2;

print(“Changed the value of x to”, x);

display(x);

print(“The value of x is “, x);

[Link] of the statement is Invalid: (1 Mark)

a) abc = 1,000,000
b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000
d) a_b_c = 1,000,000

[Link] a python program to demonstrate Hybrid Inheritance (2 Marks)

14. What is the output of the following code: (1 Marks)

def f(): x=4

x=1

f()

print(x)
15. What is the output of the following code: (1 Marks)

def f1():

x=100

print(x)

x = x+1;

f1()

a) error
b) 100
c) 101
d) 99

16. What is the output of the following code: (1 Marks)

def test(x):

print(x+1);

x = -2;

x = 4;

test(12);

a) 13
b) 10
c) 2
d) 5

You might also like