wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Ethical Hacking Kali Linux Part 3

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the correct shebang line to start a Bash script?

a)

#!/usr/bin/python

b)

#!/bin/bash

c)

#!/bin/sh

d)

#!/bash

2.

What is the correct way to define a variable in Bash?

a)

name = "Alex"

b)

name: Alex

c)

name="Alex"

d)

$name = Alex

3.

What will the following script output?

x=5

echo $x

a)

$x

b)

x

c)

5

d)

x=5

4.

Which conditional statement is used for multiple conditions?

a)

elseif

b)

elif

c)

else if

d)

ifelse

5.

What does the if block below check?

if [ $num -eq 10 ]; then

echo "Ten"

fi

a)

If num is less than 10

b)

If num is equal to 10

c)

If num is a string

d)

If num is undefined

6.

Which loop executes a set of commands for a given range?

a)

until loop

b)

while loop

c)

for loop

d)

case loop

7.

What is the output of the script?

for i in {1..3}; do

echo $i

done

a)

123

b)

1 2 3

c)

1 2 3 on one line

d)

1 (newline) 2 (newline) 3 (newline)

8.

How do you define a function in Bash?
function greet() { echo "Hi"; }

a)

function greet[]

b)

greet = function()

c)

function greet() { echo "Hi"; }

d)

define greet() => {}

9.

Which command makes a script executable?

a)
b)

chmod 777 script.sh

c)

chmod +x script.sh

d)
10.

What does $1 refer to in a Bash script?

a)

The number of variables

b)

The script name

c)

The script line number

d)

The first argument passed to the script