exam questions

Exam 98-381 All Questions

View all questions & answers for the 98-381 exam

Exam 98-381 topic 1 question 11 discussion

Actual exam question from Microsoft's 98-381
Question #: 11
Topic #: 1
[All 98-381 Questions]

HOTSPOT -
During school holidays, you volunteer to explain some basic programming concepts to younger siblings.
You want to introduce the concept of data types in Python. You create the following three code segments:

You need to evaluate the code segments.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
✑ Code Segment 1: You cannot convert str to int. x1 = "2" is a string. Therefore code will produce an error.
✑ Code Segment 2: b = 1.5, which is a float.
✑ Code Segment 3: c = 2.5, which is a float, not an int.
References: https://www.w3resource.com/python/python-data-type.php

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
s_balla_in
Highly Voted 5 years, 4 months ago
My answer is YES, YES, NO a is '202020' type(a) is str
upvoted 37 times
Vaibhavdhingra24
4 years, 10 months ago
That'll be the case of print("20"*3) will be "202020"
upvoted 1 times
...
Omkarrokee
2 years, 11 months ago
Yes,Yes,No x1="20" y1=3 a=x1*y1 print(a) type(a)
upvoted 1 times
...
...
atxsu
Highly Voted 5 years, 1 month ago
Just to check it, I've wrote out the sample code and the answers are YES YES NO in order: print(a) = "202020" print(type(a)) = <class 'str'>
upvoted 9 times
...
SP_RSA
Most Recent 2 years, 6 months ago
YES, 3 * "20" = "202020", dtype is string YES, NO
upvoted 2 times
...
BeeThree33
2 years, 6 months ago
# Code segment 1 x1 = "20" y1 = 3 a = x1 * y1 print(type(a), a) # Code segment 2 x2 = 6 y2 = 4 b = x2 / y2 print(type(b), b) # Code segment 3 x3 = 2.5 y3 = 1 c = x3 / y3 print(type(c), c) <class 'str'> 202020 <class 'float'> 1.5 <class 'float'> 2.5
upvoted 1 times
...
print_HelloWorld
2 years, 11 months ago
Y, Y, N
upvoted 1 times
...
PavanKumpatlaAccountTwo
3 years, 3 months ago
I thought the answer for the number 1 was NO but after testing it, the answer actually yes. Code:- ---------------------------------------------------------------------------------------------------------------------------------------------------- x1 = "20" y1 = 3 a = x1 * y1 print(a) Output:- 202020 ---------------------------------------------------------------------------------------------------------------------------------------------------- I never knew this. So the answers are actually:- YES, YES, NO
upvoted 1 times
...
sudarchary
3 years, 6 months ago
It should be YES,YES,NO Tested
upvoted 1 times
...
lombanamabel
3 years, 11 months ago
1= Yes > print(type(a)) >> <class 'str'> 2= Yes, 3= NO
upvoted 2 times
...
NamishBansal
4 years, 3 months ago
yes yes no. .. we checked it
upvoted 3 times
...
sana123
4 years, 6 months ago
x="20" y=3 z=x*y print(type(z)) ans: <class 'str'>
upvoted 1 times
...
Viki2405
4 years, 6 months ago
answer is Y,Y,N
upvoted 3 times
...
CERTIFICATION1990
4 years, 7 months ago
ans is YES, YES , NO
upvoted 3 times
...
LiamW28
4 years, 10 months ago
Can anyone confirm how this is marked in a test?
upvoted 2 times
...
SqueakyDeath
5 years, 3 months ago
@s_balla_in i agree, I hope the answer in the test is YES, YES, NO dont wat to give the wrong answer
upvoted 5 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago