Question 11
EasyWhat is the output of this code?
print('Hello'.upper())
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Data Structures and Algorithms
What is the output of this code?
print('Hello'.upper())
H
HELLO
HELLO HELLO
Error
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
print(len('data'.replace('a', 'aa')))
4
6
8
5
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
print('mississippi'.count('s'))
4
11
3
2
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
print('a,b,c'.split(','))
abc
['a', ',', 'b', ',', 'c']
['a,b,c']
['a', 'b', 'c']
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
print('-'.join(['x', 'y', 'z']))
-x-y-z
x-y-z
xyz
['x', 'y', 'z']
Sign up free to see the answer and a step-by-step explanation.
What is the ASCII code of the capital letter 'A'?
48
65
97
1
Sign up free to see the answer and a step-by-step explanation.
Which character has the ASCII code 97?
@
a
z
0
Sign up free to see the answer and a step-by-step explanation.
In C, how is the end of a string marked?
By a space
By the null character '\0'
By a newline
By the string's length stored in front
Sign up free to see the answer and a step-by-step explanation.
What does strcmp(s1, s2) return in C when the two strings are equal?
1
The length of the strings
−1
0
Sign up free to see the answer and a step-by-step explanation.
How can you check in O(n) time whether two strings are anagrams?
Check whether they have the same first letter
Compare every pair of characters
Count how often each character appears in both and compare the counts
Reverse one string and compare
Sign up free to see the answer and a step-by-step explanation.