String in Python

Qus. 1 : <p>What will be the output of the following Python code snippet?</p><pre><span style="font-size: 14px;">print('a@ 1,'.islower())</span></pre>

  1. True
  2. False
  3. None
  4. Error
Qus. 2 : <p>What will be the output of the following Python code?</p> <pre class="de1" style="border-radius: 0px; padding: 0px; font-family: Consolas, Monaco, "Lucida Console", monospace; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: normal; background: rgb(244, 244, 244); border: 0px; overflow: visible; box-shadow: none; text-align: justify; margin-top: 0px !important; margin-bottom: 0px !important; line-height: 20px !important;"><span class="kw1" style="overflow: visible; padding: 0px; border: 0px; box-shadow: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-wrap: normal; color: rgb(255, 119, 0); font-weight: bold; margin: 0px !important; line-height: 20px !important;">print</span><span class="br0" style="overflow: visible; padding: 0px; border: 0px; box-shadow: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-wrap: normal; color: black; margin: 0px !important; line-height: 20px !important;">(</span><span class="st0" style="overflow: visible; padding: 0px; border: 0px; box-shadow: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-wrap: normal; color: rgb(72, 61, 139); margin: 0px !important; line-height: 20px !important;">'Hello!2@#World'</span>.<span class="me1" style="overflow: visible; padding: 0px; border: 0px; box-shadow: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-wrap: normal; color: black; margin: 0px !important; line-height: 20px !important;">istitle</span><span class="br0" style="overflow: visible; padding: 0px; border: 0px; box-shadow: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-wrap: normal; color: black; margin: 0px !important; line-height: 20px !important;">(</span><span class="br0" style="overflow: visible; padding: 0px; border: 0px; box-shadow: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-wrap: normal; color: black; margin: 0px !important; line-height: 20px !important;">)</span><span class="br0" style="overflow: visible; padding: 0px; border: 0px; box-shadow: none; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; overflow-wrap: normal; color: black; margin: 0px !important; line-height: 20px !important;">)</span></pre>

  1. True
  2. False
  3. None
  4. error
Qus. 3 : <p>What will be the output of the following Python code?</p><pre><span style="font-size: 14px;">print('abcd'.partition('cd'))</span></pre>

  1. (‘ab’, ‘cd’, ”)
  2. (‘ab’, ‘cd’)
  3. error
  4. none of the mentioned
Qus. 4 : <p>What will be the output of the following Python code snippet?</p><pre><span style="font-size: 14px;">print('abef'.replace('cd', '12'))</span></pre>

  1. abef
  2. 12
  3. error
  4. none of the mentioned
Qus. 5 : If wd="Hello World" then which of the following statements will display last five characters of the string object?

  1. wd[4:]
  2. wd[:4]
  3. wd[-5:]
  4. wd[:-4]
Qus. 6 : lstrip() method is used for :

  1. delete all the trailing whitespace characters
  2. delete all the leading whitespace characters
  3. delete all the leading and trailing whitespace characters
  4. delete upper case characters
Qus. 7 : <p>What does the following code print ?</p><pre>x = 'mohan'<br>for i in range (len(x)):<br>&nbsp; &nbsp; &nbsp; &nbsp;x[i].upper()<br>print (x)</pre><div><br></div>

  1. mohan
  2. MOHAN
  3. Error
  4. None of These
Qus. 8 : What is the output of >>>’2’ +’3’

  1. 23
  2. '2+3'
  3. '23'
  4. None of These
Qus. 9 : <p>What will be the output of the following expression?</p><pre><span style="font-size: 14px;">a = 2<br></span><span style="font-size: 14px;">b = 8<br></span><span style="font-size: 14px;">print(a|b )<br></span><span style="font-size: 14px;">print(a &gt;&gt; 1)</span></pre>

  1. 10 0
  2. 10 2
  3. 2 2
  4. 10 1
Qus. 10 : When we open file in append mode the file pointer is at the of the file?

  1. anywhere in between the file
  2. End
  3. beginning
  4. second line of the file
Qus. 11 : which of the following are valid string manipulation function in python

  1. count()
  2. strip()
  3. upper()
  4. उपरोक्त सभी
Qus. 12 : Which predefined Python function is used to find length of String()

  1. length
  2. length()
  3. len()
  4. None
Qus. 13 : Each individual character in a string can be accessed using a technique called _____ .

  1. indexing
  2. Replication
  3. concatenation
  4. None of the Above
Qus. 14 : Python allows ____ operations on string data type .

  1. Concatenation
  2. Membership
  3. Slicing
  4. All of the above
Qus. 15 : Which method is used to access some part of a string or substring.

  1. slicer
  2. Slicing
  3. Membership
  4. None of these-
Qus. 16 : str[11 : 5] will return ____ .

  1. empty string
  2. complete string
  3. string of six characters
  4. None of the above
Qus. 17 : What does the function re.match do?

  1. matches a pattern at the start of the string.
  2. matches a pattern at any position in the string.
  3. such a function does not exist
  4. none of the mentioned
Qus. 18 : str[5 : 11] will return ______ characters.

  1. 5
  2. 6
  3. 11
  4. None
Qus. 19 : What does the function re-search do?

  1. matches a pattern at the start of the string.
  2. matches a pattern at any position in the string.
  3. such a function does not exist
  4. none of the mentioned.
Qus. 20 : Which of the following function returns True if the string is non empty and has all uppercase alphabets.

  1. islower()
  2. isupper()
  3. Islower()
  4. None
Qus. 21 : Which of the following will return reverse string str1?

  1. str1[ : : -1 ]
  2. str1[ : : 1 ]
  3. str1[ : -1 : -1 ]
  4. None
Qus. 22 : Which function returns the exact copy of the string with the first letter in uppercase.

  1. find()
  2. copy()
  3. upper()
  4. capitalize()
Qus. 23 : split( ) function returns the _____ of words delimited by the specified substring.

  1. List
  2. Tuple
  3. Dictionary
  4. None
Qus. 24 : If no delimiter is given in split() function then words are separated by

  1. space
  2. colon
  3. semi colon
  4. None
Qus. 25 : Which of the following function returns the index value of first occurrence of substring occurring in the given string.

  1. index()
  2. find()
  3. Both of the above
  4. None of the above
Qus. 26 : <p>what will the output of following code</p><pre><span style="font-size: 14px;">my_string="Hello,world"<br></span><span style="font-size: 14px;">print(my_string[-6:-1])</span></pre>

  1. ',worl'
  2. 'worl'
  3. 'world'
  4. 'oworld'
Qus. 27 : <p>What will be the output of the following Python code?</p><pre><span style="font-size: 14px;">&gt;&gt;&gt;max("what are you")</span></pre>

  1. what
  2. y
  3. a
  4. Error
Qus. 28 : "hello,world"[-6], what value print?

  1. White Space
  2. ,
  3. e
  4. S

Programs

python program to find the 2nd largest number from the list of the numbers entered through keyboard.

View Solution


python program that creates a list of numbers from 1 to 20 that are divisible by 4

View Solution


python program to define a list of countries that are a member of BRICS Check whether a county is member of BRICS or not

View Solution


Python program to read marks of six subjects and to print the marks scored in each subject and show the total marks

View Solution


Python program to read prices of 5 items in a list and then display sum of all the prices product of all the prices and find the average

View Solution


Python program to count the number of employees earning more than 1 lakh per annum

View Solution


python program to create a list of numbers in the range 1 to 10 Then delete all the even numbers from the list and print the final list

View Solution


python program to generate in the Fibonacci series and store it in a list Then find the sum of all values

View Solution


python program to swap two values using tuple assignment

View Solution


python program using a function that returns the area and circumference of a circle whose radius is passed as an argument

View Solution


python program that has a list of positive and negative numbers Create a new tuple that has only positive numbers from the list

View Solution


Python Program that generate a set of prime numbers and another set of even numbers

View Solution


python program to find minimum element from a list of elements along with its index in the list

View Solution


Python program to calculate mean of a given list of numbers

View Solution


Python program to search for an element in a given list of numbers

View Solution


python program to count frequency of a given element in a list of numbers

View Solution


python program to calculate the sum of integers of the list

View Solution


python program to reverses an array of integers

View Solution


python program to creates a third list after adding two lists

View Solution


python program to store the product information in dictionary

View Solution


python program to create a dictionary whose keys are month names and values are their corresponding number of days

View Solution


python program that input a list, replace it twice and then prints the sorted list in ascending and descending order

View Solution


python program to check if the maximum element of the list lies in the first half of the list or in the second half

View Solution


python program to display the maximum elements from the two list along with its index in its list

View Solution


python program to swap list elements with even and locations

View Solution


python program to rotate list elements with next elements

View Solution


python program to find maximum and minimum values in tuple

View Solution


python program to interchange the values of two tuple

View Solution


python program to interchange the values of two tuple

View Solution


python program to increment the elements of list

View Solution


python program to enter a list containing number between 1 and 12 then replace all the entries in the list that are greater than 10 with 10

View Solution


python program that reverse the list of integers in place

View Solution


python program to input two list and create third list which contains all elements of the first elements followed by all elements of second list

View Solution


python program to inter list of string and create a new list that consist of those strings with their first characters removed

View Solution


python program to create a list using for loop which consist of integers 0 through 49

View Solution


python program to create a list using for loop which consist square of the integers 1 through 50

View Solution


python program to create a list using for loop which consist a bb ccc dddd that ends with 26 copies of the letter z.

View Solution


python program that takes any two list L and M of the same size and adds their elements together in another third list

View Solution


python program to rotates the elements of list so that fist elements move to second and second to the third

View Solution


python program to move all duplicate element to the end of list

View Solution


python program to display the maximum and minimum values form specified range of indexes of a list

View Solution


python program to compare two equal sized list and print the first index where they differ

View Solution


python program to enter names of employees and their salaries as input and store them in a dictionary

View Solution


python program to count the number of times a character appears in a given string

View Solution


python program to convert a number entered by the user into its corresponding number in words

View Solution


python program Repeatedly ask the user to enter a team name

View Solution


python program that repeatedly asks the user to enter product names and prices

View Solution


Python Program to Create a dictionary whose keys are month name and whose values are number of days in the corresponding month

View Solution


python program to store the detail of 10 students in a dictionary at the same time

View Solution


python program to Create a dictionary with the opposite mapping

View Solution


python program that lists the over lapping keys of the two dictionaries if a key of d1 is also a key of d2 the list it

View Solution


python program that checks if two same values in a dictionary have different keys

View Solution


python program to check if a dictionary is contained in another dictionary

View Solution


python program to create a new dictionary D2 having same keys as D1 but values as the sum of the list elements

View Solution


python program to create a dictionary has three keys assets liabilities and capital

View Solution


python program that create a tuple storing first 9 terms of Fibonacci series

View Solution


python program that receives the index and return the corresponding value

View Solution


Python program that receives a Fibonacci series term and returns a number telling which term it is

View Solution


python program to create a nested tuple to store roll number name and marks of students

View Solution


python program that interactively creates a nested tuple to store the marks in three subjects for five students

View Solution


Python Program to accept three distinct digits and print all possible combinations from the digits

View Solution


Python Program to find the successor and predecessor of the largest element in list

View Solution


Python function that takes a string as parameter and returns a string with every successive repetitive character replaced

View Solution


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad