Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Python Basic Assessment

The document contains a series of Python programming questions and answers, covering topics such as string manipulation, variable declaration, and generation of microprocessors. It explains the correct outputs and reasoning for each question, including details about string functions and comparisons. Additionally, it provides information on the history of computer generations and concepts like ULSI.

Uploaded by

Usharani K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python Basic Assessment

The document contains a series of Python programming questions and answers, covering topics such as string manipulation, variable declaration, and generation of microprocessors. It explains the correct outputs and reasoning for each question, including details about string functions and comparisons. Additionally, it provides information on the history of computer generations and concepts like ULSI.

Uploaded by

Usharani K
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.What will be the output of above Python code?

str1="6/4"

print("str1")
A. 1
B. 6/4
C. 1.5
D. str1
Answer : D
Explanation: Since in print statement, str1 is written inside double quotes so it
will simply print str1 directly.

2.Which of the following is False?


A. String is immutable.
B. capitalize() function in string is used to return a string by converting the
whole given string into uppercase.
C. lower() function in string is used to return a string by converting the whole
given string into lowercase.
D. None of these.

Answer : B
Explanation: capitalize() function in string gives the output by converting only
the first character of the string into uppercase and rest characters into
lowercase.However, upper() function is used to return the whole string into
uppercase.

3.What will be the output of below Python code?


str1="Aplication"
str2=str1.replace('a','A')
print(str2)
A. application
B. Application
C. ApplicAtion
D. applicAtion
Answer : C
Explanation: replace() function in string is used here to replace all the existing
"a" by "A" in the given string.
4.Which of the following will give "David" as output?

If str1="John,David,Aryan"

A. print(str1[-7:-12])
B. print(str1[-11:-7])
C. print(str1[-11:-6])
D. print(str1[-7:-11])

Answer : C
Explanation: Slicing takes place at one index position less than the given second
index position of the string. So,second index position will be -7+1=-6.

5.What happens when ‘1’ == 1 is executed?


a) we get a True
b) we get a False
c) an TypeError occurs
d) a ValueError occurs
Answer: b
Explanation: It simply evaluates to False and does not raise any exception

6.Which one of the following is the correct way of declaring and initializing
a variable, x with the value 7?

A. declare x=7int x
x=7
B. int x=7
C. x=7
D. declare x=7
Answer : C
Explanation: The correct way of declaring and initializing a variable, x with
the value 7 is x=7.

7. The generation based on VLSI microprocessor.


a) 1st
b) 2nd
c) 3rd
d) 4th
Answer: d
Explanation: The 4th gen was VLSI microprocessor based. The period of fourth
generation: 1972-1990.
8. ULSI stands for?

a) Ultra Large Scale Integration


b) Under Lower Scale Integration
c) Ultra Lower Scale Integration
d) Under Large Scale Integration
Answer: a
Explanation: It stands for Ultra Large Scale Integration. It is a part of the fifth
generation computers
9. The period of ________ generation was 1952-1964.
a) 1st
b) 2nd
c) 5th
d) 4th
Answer: b
Explanation: The period of the 2nd generation is 1952-1964. The period of the
first generation was 1942-1954.
10. Which of the following statements assigns the value 25 to the variable x
in Python:
A. x << 25x ← 25
B. x = 25
C. x := 25
D. int x = 25
E. x << 25
Answer : B

You might also like