0
Alien head

programming languages Online Quiz - 124

Description: programming languages Online Quiz - 124
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

my $val = ‘x’; print ref($val);

  1. scalar

  2. any decimal value

  3. empty value

  4. x


Correct Option: C

my %hash = ( 'hi' => {'hello' => 'all'}, 'bye' => {'later' => 'gone'} ); print $hash{'hi'};

  1. hello

  2. 0

  3. hello => all

  4. HASH(0x??????) where ?????? is a group of hex digits.

  5. error


Correct Option: D

$data = “Welcome Perl” =~ /(.*)/; print $data;

  1. 0

  2. 1

  3. Welcome

  4. Perl

  5. Welcome Perl


Correct Option: B

$string = “GoodWorld”; $string =~ s/o*/i/; The value of $string is?

  1. iGoodWorld

  2. GidWirld

  3. GidWorld

  4. Gioworld

  5. GoodWorld


Correct Option: A

Which is the best way to delete an element in an associative array?

  1. Delete

  2. Push

  3. Pop

  4. Shift

  5. Unshift


Correct Option: A

Which of the following is not a predefined subroutine?

  1. BEGIN

  2. END

  3. DEFAULT

  4. AUTOLOAD

  5. NONE OF THE ABOVE


Correct Option: C

The purpose of ?: in this is /(?: [a-z]+/ is?

  1. To enclose a subpattern in parenthesis without storing it in memory.

  2. To define a boundary condition

  3. To enclose a pattern within pattern

  4. None of the above


Correct Option: A

$input = “abdce”; $output = $input =~ tr/abc/123; print $input; print $output

  1. 12d3e 3

  2. 12d3e 5

  3. 12d3e 1

  4. Error

  5. 12d3e null string


Correct Option: A

/d[^oO]g/ matches?

  1. dog

  2. dOg

  3. doOg

  4. dig


Correct Option: D

What operator is used to check whether the file is empty or not

  1. -e'

  2. -s'

  3. -z'

  4. -x'


Correct Option: C

@array = (100, 80, 70); @sort_arr = sort(@array); print @sort_arr;'

  1. 70 80 100

  2. 100 80 70

  3. 100 70 80

  4. 1 2 3


Correct Option: C

$scalar = (10,20,30); print $scalar;

  1. 10

  2. 20

  3. 30

  4. 3


Correct Option: C

@array = (1,2,3,4,5) $scalar1, $scalar2 = @array; print “Scalar1 value is $scalar1”; print “Scalar2 value is $scalar2”;

  1. 1 2

  2. 4 5

  3. 4 4

  4. 4 0


Correct Option: A

if(143 lt 34) { print “If is true”; } else { print “If is false”; }

  1. If is true

  2. If is false

  3. Error

  4. No output


Correct Option: A

$string = "Hello World"; substr($string,6)="Perl"; print $string;

  1. Hello Perl

  2. Hello Perl World

  3. Hello

  4. Perl World


Correct Option: A

. '@array = (“cat”, “rat”, “mat”); chop(@array); print @array;'

  1. ca ra ma

  2. cat rat ma

  3. cat rat

  4. cat rat mat


Correct Option: A

@array = (10,30,20); sort(@array); print @array;'

  1. 10 20 30

  2. 10 30 20

  3. 30 20 10

  4. 1 2 3


Correct Option: B

@array = (1,2,3); $scalar = $array[3]; print “$scalar”;

  1. 3

  2. 0

  3. Error:Array value out of bound

  4. Null value


Correct Option: D

pop (@array);

  1. splice (@array, 0, 1);

  2. splice (@array, @array-1, 1);

  3. splice (@array, scalar(@array), 0, @sublist);

  4. splice (@array, 0, 0, @sublist);


Correct Option: B

shift (@array);

  1. splice (@array, 0, 1);

  2. splice (@array, @array-1, 1);

  3. splice (@array, scalar(@array), 0, @sublist);

  4. splice (@array, 0, 0, @sublist);


Correct Option: A
+ View questions