100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

python programming language model paper:-02

Rating
-
Sold
-
Pages
22
Uploaded on
01-04-2023
Written in
2022/2023

I will give you the nice python programming notes so you can easy to learn and improve you coding skills and also give you the all basic coding notes if you guys want to learn easy then perched my notes. I was full struggle for this notes and I have full experience you guys have any daut the DM me.

Show more Read less
Institution
Course










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Course

Document information

Uploaded on
April 1, 2023
Number of pages
22
Written in
2022/2023
Type
Class notes
Professor(s)
Dr. bhaviya
Contains
All classes

Subjects

Content preview

MODEL QUESTION PAPER-3


Time: 2 1/2 Hours Max Marks 60
Instruction Answer any Question from each Part
PART-A (4x2=8)
I. Answer any Four questions. Each question carries 2 Marks.
1. Why Python is called as Dynamic and Strongly Types Language?
Dynamically-typed means that, unlike other programming languages, in Python, we
need not declare the data type of a variable explicitly. The data type of the variable
is decided at the run time. Apart from this one variable can be used to store different
types of data at different instances in the program.
Strong typing means that variables do have a type and that the type matters when
performing operations on a variable. Due to strong typing, types need to be
compatible with respect to the operand when performing operations. For example
Python allows one to add an integer and a floating point number, but adding an
integer to a string produces error.


2. How to read and write data in Python?
 Read Only (‘r’) : Open text file for reading. The handle is positioned at the
beginning of the file. If the file does not exists, raises the I/O error. This is
also the default mode in which a file is opened.
 Read and Write (‘r+’): Open the file for reading and writing. The handle is
positioned at the beginning of the file. Raises I/O error if the file does not
exist.
 Write Only (‘w’) : Open the file for writing. For the existing files, the data is
truncated and over-written. The handle is positioned at the beginning of the
file. Creates the file if the file does not exist.
 Write and Read (‘w+’) : Open the file for reading and writing. For an existing
file, data is truncated and over-written. The handle is positioned at the
beginning of the file.

,3. Write the syntax of while and for loop
While loop :
Syntax :
While expression:
Statement(s)


For loop :
Syntax:
For iterator_var in sequence:
Statements(s)


4. How to traverse a dictionary?
 Iterating through keys directly
 Iterating using keys()
 Iterating using values()
 Iterating using items ()


5. What is Pickling and Unpickling?
Pickling or Serialization: The process of converting a Python object into a byte
stream representation using the pickle module is called pickling or serialization.
The pickle.dump() method is used to store the python object to the file.


Unpickling or Deserialization: The process of converting a byte stream
representation back into a Python object using the pickle module is called
unpickling or deserialization. The pickle.load() method is used to retrieve pickled
data from the file.

, 6. What is JSON?
JSON stands for JavaScript Object Notation, which is a text-based, human-
readable format for presenting structured data. It’s used to transmit data
between a server and a client, or between dient applications.




PART-B
II. Answer any Four questions. Each question carries 5 marks. 14×5=20
7. Explain different string formatting methods in Python




8. Explain continue and break statements with an example.
The Break Statement : The break statement or keyword is used to terminate the
loop The break can automatically put a stop to the execution of a looping
statement, even if the logical expression has not become False, or even When
iterating the sequence of items in a sequence has not been completely finished.
$7.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
ajeetkumar2

Get to know the seller

Seller avatar
ajeetkumar2 Surana Degree College Bangalore University
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions