-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ff1489
commit 477da20
Showing
6 changed files
with
112 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
+++ | ||
title = "Bitwise operators" | ||
headless = true | ||
time = 120 | ||
facilitation = false | ||
emoji= "📖" | ||
objectives=[ | ||
"Describe the meaning of the &, |, ^, and ~ bitwise operators.", | ||
"Manually perform the function of the &, |, ^, and ~ bitwise operators on two integers.", | ||
] | ||
+++ | ||
|
||
{{<multiple-choice | ||
question="What does the following decimal expression evaluate to?: `9 | 14` (Hint: Convert to binary)" | ||
answers="23 / 15 / 8" | ||
feedback="Not quite - if a bit is set in both numbers, we don't add them. / Right! 1001 | 1110 = 1111 - we take all of the bits that are set in either number. / Not quite - check again what | does." | ||
correct="1" | ||
delimiter="/" | ||
>}} | ||
{{<multiple-choice | ||
question="What does the following decimal expression evaluate to?: `9 & 14` (Hint: Convert to binary)" | ||
answers="16 / 15 / 8" | ||
feedback="Not quite - if a bit is set in both numbers, we don't add them. / Not quite - check again what & does. / Right! 1001 & 1110 = 1000 - we take all of the bits that are set in both numbers." | ||
correct="2" | ||
delimiter="/" | ||
>}} | ||
{{<multiple-choice | ||
question="What does the following decimal expression evaluate to?: `9 ^ 14` (Hint: Convert to binary)" | ||
answers="15 / 7 / 8" | ||
feedback="Not quite - check again what ^ does. / Right! 1001 ^ 1110 = 0111 - we take all of the bits that are set in exactly one of the numbers. / Not quite - check again what ^ does." | ||
correct="1" | ||
delimiter="/" | ||
>}} | ||
{{<multiple-choice | ||
question="What does the following decimal expression evaluate to?: `~9` (Hint: Convert to binary)" | ||
answers="6 / -10 / -9" | ||
feedback="Right! ~1001 flips every bit, which produces 0110 which is 6. / Interesting - how did you come to this answer? If you can't explain why 6 and -10 are both valid answers, learn more about two's complement, truncation, and sign-extension. / Not quite - check again what ~ does." | ||
correct="0" | ||
delimiter="/" | ||
>}} |
38 changes: 38 additions & 0 deletions
38
common-content/en/module/tools/comparing-programming-languages/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
+++ | ||
title = "Comparing programming languages" | ||
headless = true | ||
time = 20 | ||
facilitation = false | ||
emoji= "⚖️" | ||
objectives=[ | ||
"Identify whether variables have fixed types in C, Python, and JavaScript.", | ||
"Identify and explain the differences between a function definition in C and Python.", | ||
"Compare compiled and interpreted languages.", | ||
"Explain one advantage of compiled languages, and one advantage of interpreted languages.", | ||
] | ||
+++ | ||
|
||
Variables are names for memory locations. What's inside the memory location can be changed. | ||
|
||
{{<multiple-choice | ||
question="Which languages allow assigning a new value with a different type to a variable." | ||
answers="All programming languages | Only JavaScript | C and Python | JavaScript and Python | C and JavaScript" | ||
feedback="No - some languages require any new value for a variable has the same type as the old value. | JavaScript does allow this, but it isn't the only language to allow it. | No - one of these languages doesn't allow this. | Right - JavaScript and Python are both dynamically typed languages. C is a statically typed language. | No - one of these languages doesn't allow this." | ||
correct="3" | ||
>}} | ||
{{<note type="Exercise">}} | ||
Write the same function twice, once in C and once in Python. The function should take two numbers as parameters, and return the sum of those two numbers. | ||
|
||
Write down what's different about the two function definitions. | ||
{{</note>}} | ||
|
||
Some programming languages are compiled. Others are interpreted. | ||
|
||
{{<note type="Exercise">}} | ||
Write down an explanation of what it means to be compiled or interpreted. | ||
|
||
List all of the programming languages you know about - is each one compiled or interpreted? | ||
|
||
What are the advantages and disadvantages of being compiled or interpreted? Write them down. | ||
{{</note>}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters