ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Scripts  >>  CGI Perl
 
 


 

 
 PHP interview questions  PHP Interview Questions
 ASP interview questions  ASP Interview Questions
 CGI Perl interview questions  CGI Perl Interview Questions
 JavaScript interview questions  JavaScript Interview Questions
 VB Script interview questions  VB Script Interview Questions
 JSP interview questions  JSP Interview Questions
 Shell Script interview questions  Shell Script Interview Questions
 Python interview questions  Python Interview Questions
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 AJAX interview questions  AJAX Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
 Scripts AllOther interview questions  Scripts AllOther Interview Questions
Question
What is a hash? 
 Question Submitted By :: Nimy
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is a hash?
Answer
# 1
Hash is an associative array where data is stored in 
"key"->"value" pairs.

Eg : fruits is a hash having their names and price
%fruits = ("Apple", "60", "Banana", "20", "Peers", "40");
 
Is This Answer Correct ?    1 Yes 0 No
Bhavani
 
  Re: What is a hash?
Answer
# 2
Hash/Associative array is the one in which all
the values are stored in terms of keys and values.

i.e., the values are indexed with the help of keys.
You cannot get back the values in a correct order as it 
happens in normal array. because in this values are stored 
in random positions. The only way to get in a correct order 
is to sort that array.

ex: %hash = {"Name","Raghav","Age","26"};
$hash{'Name'} will give "Raghav"
$hash{'Age'} will give "26"
 
Is This Answer Correct ?    0 Yes 0 No
Raghav
 
 
 
  Re: What is a hash?
Answer
# 3
Hash is a specific datatype in PERL and it contains KEYS 
and VALUES. Values are referred with the help of keys.
 
Is This Answer Correct ?    0 Yes 0 No
Sam
 
  Re: What is a hash?
Answer
# 4
Hash or "Associative Array" is an unordered list of scalar 
data. The data of the hash is depicted as key and a value 
pair.

Eg: %h=("kar","blr","ap","hyd","tn","che");

To print the entire hash : print %h; --returns entire hash 
(the order may be different)
To print only one value : print $h{"kar"}; -->returns blr
 
Is This Answer Correct ?    0 Yes 0 No
Savitha Sridhar
 
  Re: What is a hash?
Answer
# 5
As friends said above, its otherwise called as associative
array. It has lot of advantages over perl.

Here we can keep the values in a structured way, that
structured way comes from key-value pairs.

Eg: (The syntax given above are also correct, but the below
representation is much better in look and feel)

my %hash_example = ( a => 10,
                     b => 20,
                     c => 30 );  
keys   : a,b,c
values : 10,20,30

Features of Hash :
##################
1) Keys should always be unique where as values may not be
unique

(Right)
my %hash_example = ( a => 10,
                     b => 10,
                     c => 10 );

(wrong)
my %hash_example = ( a => 10,
                     a => 20,
                     a => 30 );

2) keys (%hash_example) will return an array containing only
keys

my @keys = keys(%hash);

3) similary for values
my @values = keys(%values);
 
Is This Answer Correct ?    0 Yes 0 No
Prabhath Kota
 

 
 
 
Other CGI Perl Interview Questions
 
  Question Asked @ Answers
 
Can any1 tell me 2 write the script using perl script 2 looking at a log file 2 see wheather the test has passed or not. TCS2
I have created a CGI-based page,after entering all the values in to the fields, How to get the output on the web browser using Perl  4
Why do you program in Perl?  1
how to install a package in perl ????  1
What is a hash? Satyam5
Name an instance where you used a CPAN module? TCS3
How can you create an object of a class in a package? IBM2
How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environment ?  4
Write a script for 'count the no.of digits using regular expressions in perl.. AppLabs4
What does the command "use strict" do and why should you use it? TCS2
what is the procedure to define a user define module in your perl application? IBM1
Write a simple regular expression to match an IP address, e-mail address, city-state-zipcode combination.  4
What is the Common Gateway Interface?  1
What?s your favorite module and why?  1
How would you replace a char in string and how do you store the number of replacements?  2
When would you not use Perl for a project?  1
What is the difference between for & foreach, exec & system? Photon3
What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?  1
Explain the difference between use and require?  2
What are the characteristics of a project that is well suited to Perl?  1
 
For more CGI Perl Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com