NEW
Font size
WorksheetsJulia - Quiz 1
Total questions: 24
Worksheet time: 8mins
Who created Julia programming language?
Guido van Rossum
James Gosling
Jeff Bezanson, Stefan Karpinski, and Viral B. Shah
Brendan Eich
What is the file extension for a Julia program?
.jl
.py
.java
.js
What is the syntax for declaring a variable in Julia?
var x = 10
int x = 10
x = 10
declare x = 10
What is the syntax for a while loop in Julia?
while x < 10 do
# code here
end
while x < 10 {
# code here
}
while x < 10:
# code here
while x < 10
# code here
end
What is the syntax for a function in Julia?
function my_function(arg1, arg2)
# code here
end
def my_function(arg1, arg2):
# code here
void my_function(arg1, arg2) {
# code here
}
sub my_function(arg1, arg2) {
# code here
}
x = 5
y = “Hello”
println(“$y, the value of x is $x.”)
$y, the value of x is 5.
Hello, the value of x is $x.
Hello, the value of x is 5.
$y, the value of x is $x.
What is the output of the following Julia code?
x = 1
while x <= 10
println(x)
x += 1
end
1 3 5 7 9
1 2 3 4 5 6 7 8 9 10
10 9 8 7 6 5 4 3 2 1
No output
What is the output of the following Julia code?
function my_function(x)
return x * 2
end
y = my_function(5)
println(y)
2
10
25
5
What is the output of the following Julia code?
a = [1, 2, 3, 4, 5]
println(a[3])
[3]
3
[4]
4
What is the output of the following Julia code?
a = [1, 2, 3, 4, 5]
b = a[2:4]
println(b)
[1, 2, 3, 4, 5]
[3, 4, 5]
[2, 4]
[2, 3, 4]
What is the output of the following Julia code?
a = [1, 2, 3, 4, 5]
b = push!(a, 6)
println(b)
[1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5]
6
No output
What is the output of the following Julia code?
a = [1, 2, 3, 4, 5]
b = map(x -> x * 2, a)
println(b)
[1, 2, 3, 4, 5]
[2, 4, 6, 8, 10]
[1, 4, 9, 16, 25]
No output
Which of the following is not a valid way to declare a string in Julia?
“This is a string”
“””This is also a string”
‘This is not a string’
string(“This”, ” is also a”, ” string”)
What is the output of the following Julia code?
a = [1, 2, 3, 4, 5]
b = [6, 7, 8, 9, 10]
c = a .+ b
println(c)
[7, 9, 11, 13, 15]
[1, 2, 3, 4, 5]
[6, 7, 8, 9, 10]
an error occurs
What is the output of the following Julia code?
a = Dict(“apple” => 1, “banana” => 2, “orange” => 3)
a[“pear”] = 4
println(a)
Dict(“apple” => 1, “banana” => 2, “orange” => 3, “pear” => 4)
Dict(“apple” => 1, “banana” => 2, “orange” => 3)
Dict(“pear” => 4)
an error occurs
What is the syntax for a single-line comment in Julia?
# This is a comment
<!– This is a comment –>
/* This is a comment */
// This is a comment
What is the output of the following Julia code?
x = 5
if x < 10
println(“x is less than 10”)
elseif x == 10
println(“x is equal to 10”)
else
println(“x is greater than 10”)
end
x is less than 10
x is greater than 10
x is equal to 10
No output
Which command is use to enter in package mode?
[
]
]?
)/
Which command is used to check all installed packages in Julia?
statistics
status
show
all
How to use any installed package in Julia?
import <Package Name>
using <Package Name>
None of the above
Both a and b
What is the mean of \ arithmetic operator in Julia?
Divides a to b
Divides b to a
It is an escape sequence
It is used to comment a statement
Which package is used to execute Julia code to Jupyter?
Ijulia
ijulia
Julia
IJulia
Which operator is used to concatenate two strings in Julia?
+
.
*
++
Which function is used to read lines from console in Julia?
readline()
Readline()
Readlines()
readlines()
