Started on Thursday, 3 October 2024, 6:00 AM
State Finished
Completed on Thursday, 3 October 2024, 6:01 AM
Time taken 1 min 44 secs
Marks 11.00/11.00
Grade 10.00 out of 10.00 (100%)
Question 1
Correct
Mark 1.00 out of 1.00
The following segment of code in Perl produces the ouput 2. This indicates that Perl is:
print 1+"1"
Select one:
a. weakly typed
b. strongly typed
c. dynamically scoped
d. compiled
Question 2
Correct
Mark 1.00 out of 1.00
The following segment of code in Python will produce an error. This indicates that Python tends to be more:
print 1+"1"
Select one:
a. strongly typed
b. weakly typed
c. statically scoped
d. dynamically compiled
Question 3
Correct
Mark 1.00 out of 1.00
What elements will the Perl language @a array consist of?
$_ = ' a b c ';
my @a = split();
Select one:
a. ' ', 'a', ' ', 'b', ' ', 'c', ' '
b. undef, 'a', 'b', 'c', undef
c. 'a', 'b', 'c'
d. ' ', 'a', 'b', 'c'
Question 4
Correct
Mark 1.00 out of 1.00
What output will the following segment of Perl code produce?
my @a = (0, 1, 2);
my $b = @a;
print $b;
Select one:
a. 0
b. 1
c. 2
d. 3
e. 0 1 2
Question 5
Correct
Mark 1.00 out of 1.00
In Perl, to test if the variable $str contains the word “abc” you would use:
Select one:
a. if ($str = ~/abc/)
b. if ($str == “abc”)
c. if ($str = “abc”)
d. if ($str contains “abc”)
Question 6
Correct
Mark 1.00 out of 1.00
In Perl, given the following code, the statement if($var) will evaluate to:
$var = “False”
Select one:
a. True
b. False
Question 7
Correct
Mark 1.00 out of 1.00
In Perl, a scalar variable can hold:
Select one:
a. 256 characters
b. 1024 characters
c. 32768 characters
d. Depends on system specifications
Question 8
Correct
Mark 1.00 out of 1.00
When Perl evaluates $expr = 1 + 2 * 3 – 4 the value of $expr will contain:
Select one:
a. 5
b. -3
c. 3
d. None of these answers
Question 9
Correct
Mark 1.00 out of 1.00
True/False: JavaScript was derived from the Java language.
Select one:
True
False
Question 10
Correct
Mark 1.00 out of 1.00
True/False: The following segment of JavaScript code is valid.
if (how == "reverse")
{
[Link]="[Link]"
}
else
{
[Link]="[Link]"
}
Select one:
True
False
Question 11
Correct
Mark 1.00 out of 1.00
True/False: The following code segment represents a valid declaration of a variable in JavaScript.
var KeepVar;
Select one:
True
False