1. | What is the output of the code snippet shown below?
|
a. | 00000hi |
b. | 000hi |
c. | hi000 |
d. | error |
View Answer Report Discuss Too Difficult! |
Answer: (d).error
|
2. | Consider the snippet of code shown below and predict the output.
|
a. | 56 blank spaces before compsci-bits |
b. | 56 blank spaces before compsci and bits |
c. | 56 blank spaces after compsci-bits |
d. | no change |
View Answer Report Discuss Too Difficult! |
Answer: (a).56 blank spaces before compsci-bits
|
3. | What is the output of the following expression if x=456?
|
a. | 000456 |
b. | 456000 |
c. | 456 |
d. | error |
View Answer Report Discuss Too Difficult! |
Answer: (c).456
|
4. | What is the output of the following expression if X=345?
|
a. | 345000 |
b. | 000345 |
c. | 000000345 |
d. | 345000000 |
View Answer Report Discuss Too Difficult! |
Answer: (b).000345
|
5. | Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’? |
a. | print(“-ns”%S) |
b. | print(“-ns”%S) |
c. | print(“%ns”%S) |
d. | print(“%-ns”%S) |
View Answer Report Discuss Too Difficult! |
Answer: (d).print(“%-ns”%S)
|
6. | What is the output of this expression if X= -122?
|
a. | -000122 |
b. | 000122 |
c. | –00122 |
d. | -00122 |
View Answer Report Discuss Too Difficult! |
Answer: (c).–00122
|
7. | What is the output of the following expression if the value of x is 34?
|
a. | 34.00 |
b. | 34.0000 |
c. | 34.000000 |
d. | 34.00000000 |
View Answer Report Discuss Too Difficult! |
Answer: (c).34.000000
|
8. | What is the result of the expression shown below if x=56.236?
|
a. | 56.00 |
b. | 56.24 |
c. | 56.23 |
d. | 0056.236 |
View Answer Report Discuss Too Difficult! |
Answer: (b).56.24
|
9. | What is the output of this expression if x=22.19?
|
a. | 22.1900 |
b. | 22.00000 |
c. | 22.19 |
d. | 22.20 |
View Answer Report Discuss Too Difficult! |
Answer: (c).22.19
|
10. | The expression shown below results in an error. State whether this statement is true or false.
|
a. | True |
b. | False |
c. | May be |
d. | Can't say |
View Answer Report Discuss Too Difficult! |
Answer: (b).False
|