Networking and Scripting - Python Interview Questions-2
Networking and Scripting - Python Interview Questions-2
1. What is Python?
PYTHONPATH - It has a role similar to PATH. This variable tells the Python
interpreter where to
TOTAL PAGEVIEWS
locate the module files imported into a program. It should
include the Python source library directory
4 3 3 8 3
and the directories containing
Python source code. PYTHONPATH is sometimes preset by the Python
installer.
SEARCH THIS BLOG
MY POSTS
PYTHONSTARTUP - It contains the path of an initialization file containing
Python source code. It is
"DHCP SNOOPING" " DA
executed every time you start the interpreter. It is
named as .pythonrc.py in Unix and it contains
ARP “Working Example &
commands that load utilities or
modify PYTHONPATH.
BGP "IMP" NOTES
BGP Attributes
BGP MCQ
BGP Overview
5. What are the supported data types in Python?
BGP Q&A
Python has five standard data types −
BGP Scenarios Based Q&
CCNA 200-125 Tips 1: Po
Numbers
Dictionary
Cisco VPN and ASA Note
DHCP Interview Question
DHCP OPTION 82
6. What are tuples in Python?
DNS: Why and How It Wo
A tuple is another sequence data type that is similar to the list. A tuple
consists of a number of values Dynamic Host Configurat
separated by commas. Unlike lists, however,
tuples are enclosed within parentheses.
EAP: Extensible Authenti
Enabling MD5-Challenge
Ethernet interview questio
7. What is the difference between tuples and lists in Python?
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 1/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
Python:IMP Programs to
set(s) − Converts s to a set.
Python:Lambda Expressi
Python:Module & Packag
RIB Vs FIB
Rapid Spanning Tree Pro
22. How will you convert an integer to a character in python?
Routing Basics
chr(x) − Converts an integer to a character.
STP NOTES
STP Vs RSTP
STP-BPDU GAURD AND
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 2/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
STP-ROOT GUARD
Scenarios Based Q&A
24.How will you convert an integer to hexadecimal string in python?
Spanning Tree Interview
hex(x) − Converts an integer to a hexadecimal string.
Spanning Tree Protocol
Spanning Tree Protocol:P
Spirent [STC] points to re
25.What is the purpose of // operator?
TCL PROC
break statement − Terminates the loop statement and transfers execution to the
statement immediately
TCL String
following the loop.
TCL-Arrays with Example
TCL-Regular Expression
VRRP-Explanation with E
Virtual Private Network:V
30.How can you get a random number in python?
What happens when you
random() − returns a random float r, such that 0 is less than or equal to r and
r is less than 1.
Writing Test Cases:Basic
▼
2017
(70)
►
January
(14)
32.How will you check in a string that all characters are digits?
►
February
(13)
isdigit() − Returns true if string contains only digits and false otherwise.
►
March
(3)
►
August
(13)
isalnum() − Returns true if string has at least 1 character and all characters
are alphanumeric and false ▼
October
(12)
BGP Attributes
otherwise.
Python Dictionaries
& Dictionaries
Programs
34.How will you check in a string that all characters are in
lowercase?
Python
islower() − Returns true if string has at least 1 cased character and all cased
characters are in Script:Generate
Running Config
lowercase and false otherwise.
Python Interview
isspace() − Returns true if string contains only whitespace characters and
false otherwise.
Questions-1
Python Interview
Questions-2
37.How will you check in a string that it is properly titlecased?
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 3/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
►
November
(9)
join(seq) − Merges (concatenates) the string representations of elements in
sequence seq into a string,
►
2018
(24)
with separator string.
►
2019
(1)
CCNA Tutorial
lstrip() − Removes all leading whitespace in string.
Cisco Certification Books
Cisco Dreamer
42.How will you replaces all occurrences of old substring in string
with new string?
Cisco Easy
CISCO-FMC-FTD
replace(old, new [, max]) − Replaces all occurrences of old in string with new
or at most max
Coding Online
occurrences if max given.
Dumps
FAQ:IP Routing
43.How will you remove all leading and trailing whitespace in
string?
Firewall.CX
Python Tutorial-Python-
3.
Site
Python-Coding Standard
Python-Download
46.What is the output of [1, 2, 3] + [4, 5, 6]?
Python-Regex-Practise
[1, 2, 3, 4, 5, 6]
Regexp
SNMP-Wiki
TCL Tutorial
Tutorialspoint
48.What is the output of 3 in [1, 2, 3]?
True
NON-TECHNICAL LINKS
ACT
Bangalore One
49.What is the output of for x in [1, 2, 3]: print x?
EPF
1 2 3
IELTS
ITR
50.What is the output of L[2] if L = [1,2,3]?
Lecture-PPT
PF-Passbook
3, Offsets start at zero.
SkillSet
Sphere Social
51.What is the output of L[-2] if L = [1,2,3]?
TAX-Information
L[-1] = 3, L[-2]=2, L[-3]=1
TDS
UAN-PF
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 4/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
56. How will you get the min valued item of a list?
True
>>> print(target_color_name)
FireBrick
>>> print(first_color_name)
FireBrick
>>>
import sys
def count_words(filename):
results[word] = results.setdefault(word, 0) + 1
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 5/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
count_words(sys.argv[1])
story_words = []
story_words.append(word)
print(story_words)
count = 0
def show_count():
def set_count(c):
count = c
import sys
def main(filename):
for line in f:
sys.stdout.write(line)
f.close()
if __name__ == '__main__':
main(sys.argv[1])
def add_numbers(*args):
total = 0
total += a
add_numbers(3)
add_numbers(3, 42)
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 6/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
print(answer)
data = [27,20,0]
health_calculator(data[0],data[1],data[2])
health_calculator(*data)
numbersTaken = [2,5,12,33,17]
for n in range(1,20):
if n in numbersTaken:
continue
print(n)
def get_gender(sex='Unknown'):
print(sex)
get_gender('m')
get_gender('f')
get_gender()
for f in foods:
print(f)
print(len(f))
cisco()
def bitcoin_to_usd(btc):
print(amount)
bitcoin_to_usd(3.85)
name = "Lucy"
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 7/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
if name is "Manish":
else:
def dumb_sentence(name='manish',action='ate',item='tuna'):
print(name,action,item)
dumb_sentence()
for x in range(10):
print(x)
print(x)
def allowed_dating_age(my_age):
Age_limit = allowed_dating_age(34)
allowed_dating_age(34)
print(groceries)
if 'milk' in groceries:
else:
#a = 1514
def test1():
a = 1514
print(a)
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 8/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
def test2():
print(a)
test1()
test2()
print(myDict)
print(myDict['manish'])
print(myDict["manish"])
"India."
if num%2 == 0:
#break
else:
x = range(2,9)
print(x)
print(names)
x = names.keys()
print(x)
print(names['c'])
def fib(n):
fib(3)
letter = 'o'
else:
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 9/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
rows = range(1,4)
cols = range(1,3)
print(cell)
def document_it(func):
def add_ints(a,b):
return a + b
add_ints(3,5)
cooler_add_ints = document_it(add_ints)
cooler_add_ints(3,5)
#ALITER
@document_it
def add_ints(a,b):
return a + b
add_ints(3,5)
86. You can have more than one decorator for a function
def square_it(func):
@document_it
@square_it
def add_ints(a,b):
add_ints(3,5)
87. Inheritance
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 10/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
class Car():
pass
##sub class
class Yugo(Car):
pass
give_me_a_car = Car()
give_me_a_yugo = Yugo()
class Car():
class Yugo(Car):
pass
## make one object from each class and call the exclaim method
give_me_a_car = Car()
give_me_a_yugo = Yugo()
give_me_a_car.exclaim()
give_me_a_yugo.exclaim()
##over-ride a method
class Car():
class Yugo(Car):
give_me_a_yugo = Yugo()
give_me_a_car.exclaim()
give_me_a_yugo.exclaim()
#super class
class Person():
class EmailPerson(Person):
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 11/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
print(manish.name)
print(manish.email)
import re
print(result)
#or
m = re.match('You', source)
if m:
m = re.match('^You', source)
if m:
print(m.group())
m = re.match('Frank', source)
if m:
print(m.group())
m = re.search('Frank', source)
if m:
print(m.group())
m = re.search('.*Frank', source)
if m:
print(m.group())
m = re.findall('n', source)
print(m)
m = re.findall('n.', source)
print(m)
m = re.findall('n.?', source)
print(m)
m = re.split('n', source)
print(m)
print(m)
n1 = '902'
n2 = '100'
n3 = '666'
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 12/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
else:
mod = num % 2
if mod > 0:
else:
new_list = []
for i in a:
print(new_list)'''
import datetime
now = datetime.datetime.now()
import os.path
open('abc.txt', 'w')
print(os.path.isfile('abc.txt'))
import struct
print(struct.calcsize("P")*8)
import os
import os
print('**********************')
print(os.environ)
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 13/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
print(os.environ['HOME'])
print(os.environ['PATH'])
import getpass
print(getpass.getuser())
x = 30
print(format(x, '02x'))
x = 4
print(format(x, '02x'))
import socket
addr = '127.0.0.2561'
try:
socket.inet_aton(addr)
except socket.error:
100. Factorial
def fact(x):
if x == 0:
x = int(input())
print(fact(x))'''
'''
Also please include simple test function to test the class methods.
'''
class InputOutString(object):
strObj = InputOutString()
strObj.getString()
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 14/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
strObj.printString()
s = input()
d = {"DIGITS": 0, "LETTERS": 0}
for c in s:
if c.isdigit():
else:
print("LETTERS", d["LETTERS"])
print("DIGITS", d["DIGITS"])
'''
103. Define a class, which have a class parameter and have a same
instance parameter.
class Person:
manish = Person("manish")
bidsar = Person()
bidsar.name = "bidsar"
print(Sum(1,2))
105. Define a class named American and its subclass New Yorker.
class American(object):
pass
class NewYorker(American):
pass
anAmerican = American()
aNewYorker = NewYorker()
print(anAmerican)
print(aNewYorker)
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 15/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
class Circle(object):
aCircle = Circle(2)
print(aCircle.area())
import re
def check_specific_char(string):
print(check_specific_char("ABCDEFabcdef123456780"))
print(check_specific_char("*&%#!}{"))
import re
def text_match(txt):
else:
print(text_match('python exercise'))
'''
class str_reverse:
print(str_reverse().reverse_words('hello.py'))
'''
''' this is
...a
...multiline
...string.'''
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 16/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
print(m)
print(n)
b = []
b.append(1.64)
print(b)
b.append(3)
print(b)
def square(x):
print(square(5))
varInteger = 32
varLong = 12345
varFloat = 1290.60
print(varString)
print(varInteger)
print(varLong)
print(varFloat)
print(varList)
print(varTuple)
print(varDictionary)
Posted by
Manish Bidsar
at
00:40
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 17/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
Labels:
Python Interview Questions-2
26 comments:
Replies
Reply
Core Python interview questions and answers for freshers and 1 to 5 years experience candidate.Learn tips and tricks for cracking
python interviews.Coding tag will guide you the best e-learning website that cover all technical and learn technical tutorial based on
different languages.
Reply
Reply
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 18/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
machine learning projects in the near future.
Projects assist you with improving your applied ML skills rapidly while allowing you to investigate an intriguing point. Furthermore, you can
include projects into your portfolio, making it simpler to get a vocation, discover cool profession openings, and Final Year Project Centers in
Chennai even arrange a more significant compensation.
Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are
generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business
choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply
that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills,
including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point
center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing,
promoting and account.
Reply
Reply
https://nareshit.com/python-online-training/
Reply
Reply
Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great
job Man learn Python Online Course
Reply
The blog is absolutely fantastic! Lot of great information which can be helpful about benefits of developing website. Keep updating the
blogs.
Reply
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 19/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
Web Designing Course in Chennai
Reply
Reply
angular js training
Reply
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 20/21
11/14/21, 10:58 AM Networking And Scripting : Python Interview Questions-2
Thanks for sharing an information to us.
Reply
Reply
Comment as:
Google Accoun
Publish Preview
Subscribe to:
Post Comments (Atom)
https://bidsarmanish.blogspot.com/2017/10/python-interview-questions-2.html 21/21