Help for the VSCode editor.
-
Which of the following languages are statically typed?
- Java
- C
- C++
- Python
Reveal
A, B, C
-
Which of the following languages are dynamically typed?
- C++
- Python
- Javascript
- PHP
Reveal
B, C, D
-
Choose the correct statements...
- Type checking process occurs at compile time for static typed languages.
- Type checking process occurs at runtime for static typed languages.
- Type checking process occurs at compile time for runtime typed languages.
- Type checking process occurs at runtime for dynamic typed languages.
Reveal
A, D
-
In dynamic typing, a variable is allowed to change its data type...
- Depends on the data type
- True
- False
- Only if it is an integer
Reveal
True
-
In static typing, a variable is allowed to change its data type...
- Depends on the data type
- True
- False
- Only if it is an integer
Reveal
False
-
A sample go program is stored under /root/code/simple-project. Inspect it.
What is the data type assigned to the variable called title?You can run this program from the integrated terminal like so
cd simple-project go run main.go
float
int
string
Sir
Reveal
string
Examine line 7 of the code.
title := "Sir"
Recall that when
:=
is used to create a variable, the type of the new variable is inferred from what follows:=
."Sir"
is a string constant, therefore the variabletitle
will be of typestring
.