0
Alien head

programming languages Online Quiz - 149

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

ss = 5 while ss > 0 puts ss ss -= 2 if ss == 1 ss += 5 end end The output will be 5 3 6 4 2 7

  1. True

  2. False


Correct Option: A

ss = 5 while ss > 0 puts ss ss -= 2 if ss == 1 ss += 5 end end Output=> 5 3 6 4 2

  1. True

  2. False


Correct Option: A

for ss in 1...10 print ss, " Hello\n";end => Find output? 1 Hello 2 Hello 3 Hello 4 Hello 5 Hello 6 Hello 7 Hello 8 Hello 9 Hello

  1. True

  2. False


Correct Option: A

my_array = ["alpha", "beta", "gamma"] puts my_array.collect { |word| word.capitalize } Output => Alpha Beta Gamma

  1. True

  2. False


Correct Option: A

my_array = ["alpha", "beta", "gamma"] puts my_array.collect do |word| word.capitalize End==> output? alpha beta gamma

  1. True

  2. False


Correct Option: A

0.upto(10) { |i| puts i} Output will be=> 0 1 2 3 4 5 6 7 8 9 10

  1. True

  2. False


Correct Option: A

0.upto(10) { |i| puts I} Output will be=> 1 2 3 4 5 6 7 8 9 10

  1. True

  2. False


Correct Option: B

i = 0 10.times do i += 1 puts i End The output will be => 1 2 3 4 5 6 7 8 9 10

  1. True

  2. False


Correct Option: A

The correct way to find index of an array element.days = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] is days.index(“Saturday”).

  1. True

  2. False


Correct Option: A

“name” is an array.Which of the following are correct way to find size of a ruby array? Select all that apply.

  1. name.length

  2. name.size

  3. size(name)

  4. length(name)


Correct Option: A,B

which is among the following is not a loop a) For b) foreach c)map d) until e) switch

  1. a

  2. b

  3. c

  4. d

  5. e


Correct Option: E

What will be the value of $keys? my %hash; $hash{undef} = undef; $hash{''} = ''; my $keys = keys(%hash);

  1. undef

  2. 0

  3. 1

  4. 2

  5. the code is ill-formed


Correct Option: D

which one of the below is correct with respect to string repeatation a) print "TEST" X 10; b) print "TEST" x 10; c) print 10 X "TEST"; d) print 10 x "TEST";

  1. a

  2. b

  3. c

  4. d

  5. b and d


Correct Option: B

Which of the above is valid variable name?

  1. $_4x

  2. $10thLine

  3. $line.No

  4. count

  5. $lineNo!


Correct Option: C

Which of the following is used in perl?

  1. else if

  2. elseif

  3. elsif

  4. elif


Correct Option: C

Which of the following is NOT a comment line in a Perl program?

  1. This is a comment

  2. #! This is a comment

  3. Comment Line

  4. ##########################################################


Correct Option: B

my $txt = 'I am learning Perl'; $txt =~ /(\w+)$/; What is value of $txt?

  1. Perl

  2. I

  3. I am learning Perl

  4. undef

  5. empty string


Correct Option: C

$val = 'a\b\n';print $val;What gets printed?

  1. ab(newline)

  2. a\b(newline)

  3. a\b\n

  4. a\b(newline)

  5. a\b\n


Correct Option: C

In Perl, which of the following are file handles?

  1. stdquit

  2. stdend

  3. stdin

  4. stdout

  5. c&d


Correct Option: E

The printf format "%6.2f" displays a number

  1. At least six columns wide in total, with two figures after the decimal place

  2. Exactly six digits before the decimal place, and two digits after

  3. At least six digits before the decimal place, and two digits after

  4. Exactly six columns wide in total, with two figures after the decimal place


Correct Option: C
+ View questions