Gujarat Technological UniversitySummer 2025 examination

GTU 3151108 Python Programming Summer 2025 Question Paper & PDF

B.E. · EC Engineering · Semester 5 · Subject code 3151108
Download official PDFView PDF here
Share with your class
Total
70 marks
To pass
23 marks (33%)
Duration
2.5 Hours 2:30 PM – 5:00 PM
Questions
5 with internal choice
No solutions on this paper yetNeed them for your exam? Ask once. Papers that students ask for are solved first, and we aim to add them within 24 hours.

6 of 25 questions on this paper were also asked in other years. Each is marked below with the years it appeared.See all 15 repeated 3151108 questions, most asked first

Q.1

14 Marks
(a)
3 marks

Write a Python program to compute the sum, difference, product, and quotient of two numbers and print the output for each of them..

(b)
4 marks

What is the significance of setting the environment variable PATH during Python installation? How does it affect running Python from the command line.

(c)
7 marks

Describe the various data types in Python (e.g., integer, float, string, boolean, list, tuple, dictionary). How does Python manage memory allocation for these data types?

Q.2

14 Marks
(a)
3 marks

Explain the difference between = and == in Python. Provide an example where each of these is used.

(b)
4 marks

What is type conversion in Python? Differentiate between implicit and explicit type conversion with examples.

(c)
7 marks

What are bitwise operators in Python? Explain the use of various bitwise operator with examples..

(c)
7 marks

Describe slicing in Python. How does it work with lists, tuples, and strings? Provide examples to illustrate the slicing syntax.

Q.3

14 Marks
(a)
3 marks

What are the restrictions on dictionary keys in Python? Can a dictionary key be mutable? Explain why or why not with an example.

(b)
4 marks
Explain the difference between if, if...else, and elif statements in Python.

Provide an example where each of these statements is used.

(c)
7 marks
Write a Python program to do the following with a list:
  • Create a list with five numbers.
  • Append a new number to the list.
  • Remove the second element.
  • Sort the list in ascending order.
  • Reverse the sorted list.
  • Print the final list.
(a)
3 marks

How do you create a dictionary in Python? Give an example of a dictionary with at least three key-value pairs.

(b)
4 marks

What are the risks of using while loops, and how can you avoid creating an infinite loop? Provide an example of a while loop and explain how to ensure it terminates correctly.

(c)
7 marks
Write a Python program to:
  • Create a tuple with 5 elements.
  • Access and print the first and last elements of the tuple.
  • Slice the tuple to get the middle three elements.
  • Try modifying one element in the tuple and explain why it fails.

Q.4

14 Marks
(a)
3 marks

What is an infinite loop in Python? How can you detect and break out of an infinite loop in your code?

(b)
4 marksAsked in 4 of 4 papers

What are the key differences between lists and tuples in Python? When would you use one over the other?

Also asked in Summer 2026 Q1c, Winter 2025 Q1c, Summer 2024 Q1a

(c)
7 marks

Explain the purpose of defining custom functions in Python. How do functions contribute to code reusability and organization? Provide an example of a function that calculates the factorial of a number.

(a)
3 marksAsked in 2 of 4 papers

Explain the purpose of the break statement in Python. How does it affect the execution of loops? Provide an example where using break is necessary.

Also asked in Winter 2025 Q3a OR

(b)
4 marks

How do you import and use standard and external modules in Python? Explain the difference between import module, from module import name, and import module as alias.

(c)
7 marksAsked in 3 of 4 papers

What is the difference between local and global variables in Python? How do you declare and use each type of variable? Provide an example where both local and global variables are used.

Also asked in Winter 2025 Q4c OR, Summer 2024 Q4a OR

Q.5

14 Marks
(a)
3 marks

Describe the function of the try, except, and raise keywords. How do they contribute to exception handling in Python?

(b)
4 marks

Describe how to read from and write to a text file in Python. What functions and methods are commonly used for these operations?

(c)
7 marksAsked in 3 of 4 papers

What are the key differences between MicroPython and standard Python? Discuss aspects such as memory usage, performance, and supported features.

Also asked in Summer 2026 Q5b OR, Winter 2025 Q5b OR

(a)
3 marks

What is the difference between mutable and immutable data types in Python? Provide examples of each

(b)
4 marksAsked in 3 of 4 papers

What are the different file modes in Python, such as 'r', 'w', 'a', and 'b'? Describe each mode and its typical use case.

Also asked in Summer 2026 Q4b, Summer 2024 Q5a OR

(c)
7 marksAsked in 2 of 4 papers

Explain the significance of MicroPython in the context of embedded systems and IoT (Internet of Things). What advantages does it offer for developing applications on microcontrollers?

Also asked in Winter 2025 Q5a OR

More Python Programming papers

Questions repeat across sessions. Working through two or three papers shows you which topics GTU asks most.

Preparing with friends?

Send this paper to your class group. Every question has its own link.

About this paper

Official Gujarat Technological University (GTU) examination paper for Python Programming (Summer 2025, B.E. · EC Engineering, Sem 5). Features complete 70-mark regular & remedial examination pattern, official marking distribution across all 5 questions, and direct 1-click official PDF download.

Transcribed for student exam preparation from Gujarat Technological University official examination archives. Questions, syllabus guidelines, and curriculum marking schemes remain the intellectual property of Gujarat Technological University.

ViewDownload PDF