Font size
WorksheetsPerl and Tcl Quiz
Total questions: 40
Worksheet time: 34mins
What is the correct way to define an array in Perl?
$data = (1,2,3);
@data = (1,2,3);
%data = (1,2,3);
array data = (1,2,3);
The keyword used to exit a loop in Perl is ___________.
break
exit
stop
last
Which of the following correctly assigns a variable in Tcl?
x = 10
set x 10
$x = 10
assign x 10
Which operator is used for string comparison in Perl?
==
=
eq
!=
What is the correct way to call a subroutine named display?
display;
call display;
sub display;
@display();
Which function in Perl terminates the program after printing an error message?
exit()
die()
stop()
quit()
Which symbol is used to prefix hash variables in Perl?
$
@
%
&
In Perl, which symbol is used to prefix scalar variables?
@
%
$
&
Which data structure in Perl supports key-value mapping?
Array
Hash
Scalar
List
Given the code snippet in Tcl: if { $n == 0 } { puts "Zero" } ______ { puts "Non-zero" } Which keyword should fill the blank to execute the "Non-zero" block when $n is not zero?
else
elseif
otherwise
default
11. Tcl stands for ________________________________________________
11. The command used to append elements to a list is ________________________.
Event-driven programming in Tcl/Tk is supported through (a) .
Perl-Tk is an extension that allows creating (a) interfaces in Perl
The last keyword in a loop is equivalent to the (a) statement in C.
The chmod() function changes file (a) .
The security feature -T in the shebang line enables (a) mode.
Complete the given code snippet.
set name "TCL"
puts "Hello (a) "
Hash variables in Perl are prefixed by the symbol (a) .
The die() function terminates the program after printing an (a) message.
In Tk, events and user interactions are handled by (a) .
The “Nuts and Bolts” Internet programming in Tcl refers to low-level (a) handling.
The command to assign a value to a variable is (a) .
The function stat() retrieves file (a) information.
(a) keyword is used to associate a reference with a class.
(a) data structure supports the key-value mapping in PERL.
Scalar variables in Perl start with the symbol (a) .
The split() function divides a string into a (a) .
(a) keyword used to exit a loop in PERL.
The loop keyword used to skip to the next iteration is (a) .
Which function can be used to find the length of a string?
strlen()
length()
size()
count()
Which command is used to print output to the console in Python?
echo
print()
output()
write()
What is the correct way to create a list in JavaScript?
var list = list();
var list = new List();
var list = {};
var list = [];
In Perl, which operator is used for string concatenation?
||
+
.
&
What is the purpose of the 'use strict;' pragma in Perl?
To optimize performance
To enable warnings
To enforce variable declaration
To import modules
Which function is used to read a line from a file in Perl?
fetchLine
lineRead
getLine
readline
Which operator is used to access elements in an array in Perl?
{}
[]
!
->
What is the correct way to declare a hash in Perl?
declare %hash = (key => value);
%hash = (key => value);
hash = (key => value);
hash %hash = (key => value);
Which function is used to split a string into a list in Perl?
separate()
divide()
break()
split()
What is the output of $x = 5 + "10cats"; ?
15
Error
510cats
510
