Difference between revisions of "User:Praveer-mathur-9f3d@uni-bonn.de"

From HPC Wiki
Jump to navigation Jump to search
(Test.)
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Test page.
+
=== Short Quiz: Variable Assignment === <!--T:5--> 
 +
 
 +
What values do the two variables "mass" and "age" have in the following lines?
 +
 
 +
{{hidden begin
 +
|title = <code>mass = 47.5 <br> print(mass)</code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>47.5</code>
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>age = 122 <br> print(mass, age)</code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>47.5 122</code>
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>mass = mass * 2.0 <br> print(mass, age)</code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>95.0 122</code>
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>age = age - 20 <br> print(mass, age)</code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>95.0 102</code>
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
=== Short Quiz: Data Types === <!--T:5-->
 +
 
 +
{{hidden begin
 +
|title = <code>planet = 'Earth'</code> <br> What datatype does the variable planet have?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
- Integer
 +
|| Explanation: Wrong
 +
+ String
 +
|| Explanation: Correct
 +
- Boolean
 +
|| Explanation: Wrong
 +
- Float
 +
|| Explanation: Wrong
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>apples = 5</code> <br> What datatype does the variable apples have?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
- Integer
 +
|| Explanation: Correct
 +
+ String
 +
|| Explanation: Wrong
 +
- Boolean
 +
|| Explanation: Wrong
 +
- Float
 +
|| Explanation: Wrong
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>distance = 10.5</code> <br> What datatype does the variable distance have?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
- Integer
 +
|| Explanation: Wrong
 +
+ String
 +
|| Explanation: Wrong
 +
- Boolean
 +
|| Explanation: Wrong
 +
- Float
 +
|| Explanation: Correct
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>false = 7 > 2</code> <br> What datatype does the variable false have?
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
- Integer
 +
|| Explanation: Wrong
 +
+ String
 +
|| Explanation: Wrong
 +
- Boolean
 +
|| Explanation: Correct
 +
- Float
 +
|| Explanation: Wrong
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
=== Short Quiz: Boolean Operations === <!--T:5-->
 +
 
 +
<code>var1 = True <br> var2 = False</code>
 +
What is the value of each variable after each of the following print statements?
 +
 
 +
{{hidden begin
 +
|title = <code>print(var1, var2)</code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>True False</code>
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>var2 = var1 or var2 <br> print(var1, var2)</code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>True True</code>
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>var1 = var1 and not var2 <br> print(var1, var2)/code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>False True</code>
 +
</quiz>
 +
{{hidden end}}
 +
 
 +
{{hidden begin
 +
|title = <code>var1 = not(var1 and not var1) <br> print(var1, var2)</code>
 +
}}
 +
<quiz display=simple>
 +
{
 +
|type="()"}
 +
+  Click and submit to see the answer
 +
|| <code>True True</code>
 +
</quiz>
 +
{{hidden end}}

Latest revision as of 14:21, 6 March 2026

Short Quiz: Variable Assignment

What values do the two variables "mass" and "age" have in the following lines?

mass = 47.5
print(mass)

Click and submit to see the answer

age = 122
print(mass, age)

Click and submit to see the answer

mass = mass * 2.0
print(mass, age)

Click and submit to see the answer

age = age - 20
print(mass, age)

Click and submit to see the answer

Short Quiz: Data Types

planet = 'Earth'
What datatype does the variable planet have?

Integer
String
Boolean
Float

apples = 5
What datatype does the variable apples have?

Integer
String
Boolean
Float

distance = 10.5
What datatype does the variable distance have?

Integer
String
Boolean
Float

false = 7 > 2
What datatype does the variable false have?

Integer
String
Boolean
Float

Short Quiz: Boolean Operations

var1 = True
var2 = False
What is the value of each variable after each of the following print statements?

print(var1, var2)

Click and submit to see the answer

var2 = var1 or var2
print(var1, var2)

Click and submit to see the answer

var1 = var1 and not var2
print(var1, var2)/code>

Click and submit to see the answer

var1 = not(var1 and not var1)
print(var1, var2)

Click and submit to see the answer