Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding Question Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Example: A man, a plan, a canal:

Coding Question Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.

Example:

"A man, a plan, a canal: Panama" is a palindrome.

"race a car" is not a palindrome.

Return 0 / 1 ( 0 for false, 1 for true ) for this problem

Code will be tested with large test case files please note it, Please don't copy. MCQs with proper explanation needed

1. What is returned by math.expm1(p)?

a) (math.ep) - 1

b) math.e(p - 1)

c) error

d) none of the mentioned

2. Which of these about a dictionary is false?

a) The values of a dictionary can be accessed using keys

b) The keys of a dictionary can be accessed using values

c) Dictionaries aren't ordered

d) Dictionaries are mutable

3. Suppose there is a list such that: l=[2,3,4]. If we want to print this list in reverse order, which of the following methods should be used?

a) reverse(l)

b) list(reverse[(l)])

c) reversed(l)

d) list(reversed(l))

4. What will be the output of the following Python code snippet?

a={1:"A",2:"B",3:"C"}

for i,j in a.items():

print(i,j,end=" ")

a) 1 A 2 B 3 C

b) 1 2 3

c) A B C

d) 1:"A" 2:"B" 3:"C"

5. What does os.getlogin() return?

a) name of the current user logged in

b) name of the superuser

c) gets a form to login as a different user

d) all of the mentioned

6. What will be the output of the following Python code?

re.split(r'(a)(t)', 'Maths is a difficult subject')

a) ['M a t h s i s a d i f f i c u l t s u b j e c t']

b) ['Maths', 'is', 'a', 'difficult', 'subject']

c) 'Maths is a difficult subject'

d) ['M', 'a', 't', 'hs is a difficult subject']

7. Which of the following functions can help us to find the version of python that we are currently working on?

a) sys.version

b) sys.version()

c) sys.version(0)

d) sys.version(1)

8. Which of these is false about recursion?

a) Recursive function can be replaced by a non-recursive function

b) Recursive functions usually take more memory space than non-recursive function

c) Recursive functions run faster than non-recursive function

d) Recursion makes programs easier to understand

9. A class in which one or more methods are only implemented to raise an exception is called an abstract class.

a) True

b) False

10. What will be the output of the following Python code snippet?

d = {"john":40, "peter":45}

print(list(d.keys()))

a) ["john", "peter"]

b) ["john":40, "peter":45]

c) ("john", "peter")

d) ("john":40, "peter":45)

11. What will be the output of the following Python code if the system date is: 6/19/2017

tday=datetime.date.today()

tdelta=datetime.timedelta(days=10)

print(tday+tdelta)

a) 2017-16-19

b) 2017-06-9

c) 2017-06-29

d) Error

12. What will be the output of the following Python expression?

round(4.576)

a) 4.5

b) 5

c) 4

d) 4.6

13. What does the function re.match do?

a) matches a pattern at the start of the string

b) matches a pattern at any position in the string

c) such a function does not exist

d) none of the mentioned

14. What will be the output of the following Python code?

re.split(r'(n\d)=', 'n1=3.1, n2=5, n3=4.565')

a) Error

b) [", 'n1', '3.1, ', 'n2', '5, ', 'n3', '4.565']

c) ['n1', '3.1, ', 'n2', '5, ', 'n3', '4.565']

d) ['3.1, ', '5, ', '4.565']

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions