Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

All kind of computer program for beginner

Rating
-
Sold
-
Pages
8
Uploaded on
16-07-2022
Written in
2021/2022

All kind of computer program for beginner

Institution
Course

Content preview

PYTHON INTERVIEW QUESTIONS
http://www.tutorialspoint.com/python/python_interview_questions.htm Copyright © tutorialspoint.com



Dear readers, these Python Programming Language Interview Questions have been
designed specially to get you acquainted with the nature of questions you may encounter during
your interview for the subject of Python Programming Language. As per my experience good
interviewers hardly plan to ask any particular question during your interview, normally questions
start with some basic concept of the subject and later they continue based on further discussion
and what you answer −

What is Python?

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is
designed to be highly readable. It uses English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other languages.

Name some of the features of Python.

Following are some of the salient features of python −

It supports functional and structured programming methods as well as OOP.

It can be used as a scripting language or can be compiled to byte-code for building large
applications.

It provides very high-level dynamic data types and supports dynamic type checking.

It supports automatic garbage collection.

It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

What is the purpose of PYTHONPATH environment variable?

PYTHONPATH - It has a role similar to PATH. This variable tells the Python interpreter where to
locate the module files imported into a program. It should include the Python source library
directory and the directories containing Python source code. PYTHONPATH is sometimes preset by
the Python installer.

What is the purpose of PYTHONSTARTUP environment variable?

PYTHONSTARTUP - It contains the path of an initialization file containing Python source code. It is
executed every time you start the interpreter. It is named as .pythonrc.py in Unix and it contains
commands that load utilities or modify PYTHONPATH.

What is the purpose of PYTHONCASEOK environment variable?

PYTHONCASEOK − It is used in Windows to instruct Python to find the first case-insensitive match in
an import statement. Set this variable to any value to activate it.

What is the purpose of PYTHONHOME environment variable?

PYTHONHOME − It is an alternative module search path. It is usually embedded in the
PYTHONSTARTUP or PYTHONPATH directories to make switching module libraries easy.

Is python a case sensitive language?

Yes! Python is a case sensitive programming language.

What are the supported data types in Python?

Python has five standard data types −

Numbers

String

, List

Tuple

Dictionary

What is the output of print str if str = 'Hello World!'?

It will print complete string. Output would be Hello World!.

What is the output of print str[0] if str = 'Hello World!'?

It will print first character of the string. Output would be H.

What is the output of print str[2:5] if str = 'Hello World!'?

It will print characters starting from 3rd to 5th. Output would be llo.

What is the output of print str[2:] if str = 'Hello World!'?

It will print characters starting from 3rd character. Output would be llo World!.

What is the output of print str * 2 if str = 'Hello World!'?

It will print string two times. Output would be Hello World!Hello World!.

What is the output of print str + "TEST" if str = 'Hello World!'?

It will print concatenated string. Output would be Hello World!TEST.

What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?

It will print complete list. Output would be ['abcd', 786, 2.23, 'john', 70.200000000000003].

What is the output of print list[0] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?

It will print first element of the list. Output would be abcd.

What is the output of print list[1:3] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?

It will print elements starting from 2nd till 3rd. Output would be [786, 2.23].

What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?

It will print elements starting from 3rd element. Output would be [2.23, 'john',
70.200000000000003].

What is the output of print tinylist * 2 if tinylist = [123, 'john']?

It will print list two times. Output would be [123, 'john', 123, 'john'].

What is the output of print list + tinylist * 2 if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ] and tinylist =
[123, 'john']?

It will print concatenated lists. Output would be ['abcd', 786, 2.23, 'john', 70.200000000000003,
123, 'john'].

What are tuples in Python?

A tuple is another sequence data type that is similar to the list. A tuple consists of a number of
values separated by commas. Unlike lists, however, tuples are enclosed within parentheses.

What is the difference between tuples and lists in Python?

The main differences between lists and tuples are − Lists are enclosed in brackets [] and their
elements and size can be changed, while tuples are enclosed in parentheses ( ) and cannot be
updated. Tuples can be thought of as read-only lists.

What is the output of print tuple if tuple = ′ abcd ′ , 786, 2.23, ′ john ′ , 70.2?

Connected book

Written for

Course

Document information

Uploaded on
July 16, 2022
Number of pages
8
Written in
2021/2022
Type
Class notes
Professor(s)
Naseem
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
endashaan

Also available in package deal

Get to know the seller

Seller avatar
endashaan Rajarata University Of Sri Lanka
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
4 year
Number of followers
0
Documents
6
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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions