Interview Questions And Answers

Q: - How can I see whether two arrays contain the same or different elements?

Use a hash. Hashes allow you to do some rather interesting manipulations on arrays quickly and efficiently.

Submitted By:-Amrinder            Email-ID: - amrinder_gill1984@rediff.com

Q: - What's an efficient way to swap the values contained in two scalar variables $a and $b?
$a=$b;
($a,$b)=($b, $a);
$c=$a; $a=$b; $b=$c;
b - ($a,$b)=($b, $a);

Submitted By:-Amrinder            Email-ID: - amrinder_gill1984@rediff.com

Q: - What does the statement $a=@array; assign to the variable $a?
The number of elements in @array
The index of the last element of @array
That syntax is not valid
The number of elements in @array

Submitted By:-Amrinder            Email-ID: - amrinder_gill1984@rediff.com

 

1
2