Questions: 16

Answers by our Experts: 16

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Square the number 15 and print the result.
Write the following expression using a shortcut:
$y = $y + 5;
what are two other ways you could write
$x = $x + 1;
Print the average of three floating point numbers with a precision of two decimal places
Question: What will be printed? Why?

$a="no"; # assign variable

if ($a) { #Loop test for variable $results = "Yes!"; #Success?} else { #or maybe $results = "no"; #Failure}
print $results; #Let's find out
Describe the CSP to solve a map colouring problem using the solver from csp.pl. (Steps: Find a representation for map area adjacency, define a colour domain, run some example maps.)
Computational Intelligence: a logical approach.
% Prolog Code.
% A CSP solver using arc consistency
% Copyright (c) 1998, Poole, Mackworth, Goebel and Oxford University Press.

% csp(Domains, Relations) means that each variable has
% an instantiation to one of the values in its Domain
% such that all the Relations are satisfied.
% Domains represented as list of
% [dom(V,[c1,...,cn]),...]
% Relations represented as [rel([X,Y],r(X,Y)),...]
% for some r
csp(Doms,Relns) :-
ac(Doms,Relns).

% ac(Dom,Relns) is true if the domain constrants
% specified in Dom and the binary relations
% constraints specified in Relns are satisfied.
ac(Doms,Relns) :-
make_arcs(Relns,A),
consistent(Doms,[],A,A).

% make_arcs(Relns, Arcs) makes arcs Arcs corresponding to
% relations R
Ques 1:
my $a == <stdin>;
#if input is given Pardeep
then what is the output of following script?

if($a == "Pardeep")
{
print "match";
}
elsif($a == "pardeep")
{
print "ok"
}
else{
print "not match";
}

a)match
b)not match
c)ok
d)none



Ques 2:
our $a = 8;
our $b = 7;

sub first
{
my $a =4;
local $b = 9;
&second;
}

print " $b ";

sub second
{
print $a;
print$b;
}
&first;


what is the result of above print command?

a)8
b)7
c)4
d)9
Ques 1:
What is -> Symbol in Perl?

a) '->' symbol is used to refer hash values

b) In object oriented PERL the arrow -> symbol is used for creating or accessing a particular object of a class

c) Arrow operator -> is used for dereferencing references to array or hash

e.g $arr = ['1', '2' ,'3', '4'];

To retrieve the value of first element:

$val = $arr->[1];

d) All of the above are correct


Ques 2:
How do you open a file for writing?

a) open (”FH”, “>filename.dat”) || die “Can’t create the file\n”; Later use FH to perform all file related operation.

b) open (”FH”, “<filename.dat”) || die “Can’t create the file\n”; Later use FH to perform all file related operation.

c) open (”FH”, “filename.dat”) || die “Can’t create the file\n”; Later use FH to perform all file related operation.

d) All are same.
1. Which conditional statement is equivalent to "if (!<condition>)"?
a. unless ()
b. failure ()
c. fails ()
d. ifn ()

2. Correct command in Perl script
a. "cp file1 file2"
b. 'cp file1 file2'
c. `cp file1 file2`
d. {cp file1 file2}

3. What is -> Symbol in Perl?
program to prompt the user for number and string ,print string that number of times without using loop
LATEST TUTORIALS
APPROVED BY CLIENTS