wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Julia - Quiz 1

Total questions: 24

Worksheet time: 8mins

Name
Class
Date
1.

Who created Julia programming language?

a)

Guido van Rossum

b)

James Gosling

c)

Jeff Bezanson, Stefan Karpinski, and Viral B. Shah

d)

Brendan Eich

2.

What is the file extension for a Julia program?

a)

.jl

b)

.py

c)

.java

d)

.js

3.

What is the syntax for declaring a variable in Julia?

a)

var x = 10

b)

int x = 10

c)

x = 10

d)

declare x = 10

4.

What is the syntax for a while loop in Julia?

a)

while x < 10 do
# code here
end

b)

while x < 10 {
# code here
}

c)

while x < 10:
# code here

d)

while x < 10
# code here
end

5.

What is the syntax for a function in Julia?

a)

function my_function(arg1, arg2)
# code here
end

b)

def my_function(arg1, arg2):
# code here

c)

void my_function(arg1, arg2) {
# code here
}

d)

sub my_function(arg1, arg2) {
# code here
}

6.

x = 5
y = “Hello”
println(“$y, the value of x is $x.”)

a)

$y, the value of x is 5.

b)

Hello, the value of x is $x.

c)

Hello, the value of x is 5.

d)

$y, the value of x is $x.

7.

What is the output of the following Julia code?

x = 1
while x <= 10
println(x)
x += 1
end

a)

1 3 5 7 9

b)

1 2 3 4 5 6 7 8 9 10

c)

10 9 8 7 6 5 4 3 2 1

d)

No output

8.

What is the output of the following Julia code?

function my_function(x)
return x * 2
end
y = my_function(5)
println(y)

a)

2

b)

10

c)

25

d)

5

9.

What is the output of the following Julia code?

a = [1, 2, 3, 4, 5]
println(a[3])

a)

[3]

b)

3

c)

[4]

d)

4

10.

What is the output of the following Julia code?

a = [1, 2, 3, 4, 5]
b = a[2:4]
println(b)

a)

[1, 2, 3, 4, 5]

b)

[3, 4, 5]

c)

[2, 4]

d)

[2, 3, 4]

11.

What is the output of the following Julia code?

a = [1, 2, 3, 4, 5]
b = push!(a, 6)
println(b)

a)

[1, 2, 3, 4, 5, 6]

b)

[1, 2, 3, 4, 5]

c)

6

d)

No output

12.

What is the output of the following Julia code?

a = [1, 2, 3, 4, 5]
b = map(x -> x * 2, a)
println(b)

a)

[1, 2, 3, 4, 5]

b)

[2, 4, 6, 8, 10]

c)

[1, 4, 9, 16, 25]

d)

No output

13.

Which of the following is not a valid way to declare a string in Julia?

a)

“This is a string”

b)

“””This is also a string”

c)

‘This is not a string’

d)

string(“This”, ” is also a”, ” string”)

14.

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)

a)

[7, 9, 11, 13, 15]

b)

[1, 2, 3, 4, 5]

c)

[6, 7, 8, 9, 10]

d)

an error occurs

15.

What is the output of the following Julia code?

a = Dict(“apple” => 1, “banana” => 2, “orange” => 3)
a[“pear”] = 4
println(a)

a)

Dict(“apple” => 1, “banana” => 2, “orange” => 3, “pear” => 4)

b)

Dict(“apple” => 1, “banana” => 2, “orange” => 3)

c)

Dict(“pear” => 4)

d)

an error occurs

16.

What is the syntax for a single-line comment in Julia?

a)


# This is a comment

b)

<!– This is a comment –>

c)

/* This is a comment */

d)

// This is a comment

17.

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

a)

x is less than 10

b)

x is greater than 10

c)

x is equal to 10

d)

No output

18.

Which command is use to enter in package mode?

a)

[

b)

]

c)

]?

d)

)/

19.

Which command is used to check all installed packages in Julia?

a)

statistics

b)

status

c)

show

d)

all

20.

How to use any installed package in Julia?

a)

import <Package Name>

b)

using <Package Name>

c)

None of the above

d)

Both a and b

21.

What is the mean of \ arithmetic operator in Julia?

a)

Divides a to b

b)

Divides b to a

c)

It is an escape sequence

d)

It is used to comment a statement

22.

Which package is used to execute Julia code to Jupyter?

a)

Ijulia

b)

ijulia

c)

Julia

d)

IJulia

23.

Which operator is used to concatenate two strings in Julia?

a)

+

b)

.

c)

*

d)

++

24.

Which function is used to read lines from console in Julia?

a)

readline()

b)

Readline()

c)

Readlines()

d)

readlines()