aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • PERL Fundamentals: Variables and Data Structures
  • Which of the following does not print the size of the arr...
Multiple choice

Which of the following does not print the size of the array @My_array = (1..10);

  1. print scalar @My_array

  2. $my_arr_size = @My_array print $my_arr_size
  3. print $#My_array
  4. print 0+@My_array

  5. print $#My_array + 1
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Yes, It returns the maximum index of the array, i.e. one less than the size of the array.

Keep practicing — related questions

  • Which of the following syntax will return the size of the array @My_array @My_array = ("Jan", "Feb", "Mar",...
  • @array = (1,2,3,4,5) $scalar1, $scalar2 = @array; print “Scalar1 value is $scalar1”; print “Scalar2 value i...
  • @array = (1,2,3,4,5) $scalar1, $scalar2 = @array; print “Scalar1 value is $scalar1”; print “Scalar2 value i...
  • How do you get the size of an array?
  • What will be the value of $size after executing the following code?my @a = (0, 1, 2);$#a = 0;my $size = @a;
  • What will be the output of the following function? # define DIM1(array,type) sizeof(array)/sizeof(type) int...
  • What will be printed by the code below? my @a = (0, 1, 2); my ($b) = @a; print $b;
  • What is the output of the following code snippet ?? void main() { printf("%d", sizeof(2.0)); }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy