A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

21. What is the output when following statement is executed ?
>>>chr(ord('A'))
a. A
b. B
c. a
d. Error
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).A

22. What is the output when following statement is executed ?
>>>print(chr(ord('b')+1))
a. a
b. b
c. c
d. A
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).c

23. Which of the following statement prints hello\example\test.txt ?
a. print(“hello\example\test.txt”)
b. print(“hello\\example\\test.txt”)
c. print(“hello\”example\”test.txt”)
d. print(“hello”\example”\test.txt”)
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).print(“hello\\example\\test.txt”)

24. Suppose s is “\t\tWorld\n”, what is s.strip() ?
a. \t\tWorld\n
b. \t\tWorld\n
c. \t\tWORLD\n
d. World
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).World

25. The format function, when applied on a string returns :
a. Error
b. int
c. bool
d. str
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).str

26. What is the output of “hello”+1+2+3 ?
a. hello123
b. hello
c. Error
d. hello6
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Error

27. What is the output when following code is executed ?
>>>print("D", end = ' ')
>>>print("C", end = ' ')
>>>print("B", end = ' ')
>>>print("A", end = ' ')
a. DCBA
b. A, B, C, D
c. D C B A
d. D, C, B, A will be displayed on four lines
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).D, C, B, A will be displayed on four lines

28. What is the output when following statement is executed ?(python 3.xx)
>>>print(format("Welcome", "10s"), end = '#')
>>>print(format(111, "4d"), end = '#')
>>>print(format(924.656, "3.2f"))
a. Welcome# 111#924.66
b. Welcome#111#924.66
c. Welcome#111#.66
d. Welcome   # 111#924.66
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).Welcome   # 111#924.66

29. What will be displayed by print(ord(‘b’) – ord(‘a’)) ?
a. 0
b. 1
c. -1
d. 2
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).1

30. Say s=”hello” what will be the return value of type(s) ?
a. int
b. bool
c. str
d. String
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).str

Page 3 of 13