Questions: 51

Answers by our Experts: 19

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

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
I have an assignment to convert from latin to Morse and vice versa, but when i run it it has an error and it says : ./proj1: line 1: syntax error near unexpected token `('

the following code is this :

%hash = (
32, ' ',
33, '..--.',
39, '.----.',
44, '--..--',
46, '.-.-.-',
48, '-----',
49, '.----',
50, '..---',
51, '...--',
52, '....-',
53, '.....',
54, '-....',
55, '--...',
56, '---..',
57, '----.',
58, '---...',
61, '-...-',
63, '..--..',
65, '.-',
66, '-...',
67, '-.-.',
68, '-..',
69, '.',
70, '..-.',
71, '--.',
72, '....',
73, '..',
74, '.---',
75, '-.-',
76, '.-..',
77, '--',
78, '-.',
79, '---',
80, '.--.',
81, '--.-',
82, '.-.',
83, '...',
84, '-',
85, '..-',
86, '...-',
87, '.--',
88, '-..-',
89, '-.--',
90, '--..'
);





print "Please, choose one:\n";
print "1. Convert Latin to Morse Code\n";
print "2. Convert Morse Code to Latin\n";
$choice = <>;


if ($choice == 1)
{
print "Enter file name\n";
$file1 = <>;
open (file, $file1);
.... it continues but i dont hav char left
When I am installing DBD DB2 Driver its giving an error: 'cannot locte extutils/makemaker.pm'. So I installed ExtUtils-MakeMaker-6.31 rpm but now I am getting the following error: 'cant locate MM_Unix.pm'.
sub GetNotReqdCourses {
local (*notreqd_courses) = @_ if @_;
my $query, @notreqd_info, $cmap_san, $item, $tp_san, $class_code, $reqd_flag;

$query = qq | select c.cmap_san, c.tp_san, c.class_code, c.reqd_flag
from hrtraindata.tp_course_map c
where c.reqd_flag = 'N'
|;

@notreqd_info = &GetDBInfo($query);
foreach $item (@notreqd_info)
{
($cmap_san, $tp_san, $class_code, $reqd_flag) = split(/\|/,$item,4);
$notreqd_courses{$tp_san}{$class_code}{'reqd_flag'} = $reqd_flag;
$notreqd_courses{$tp_san}{$class_code}{'cmap_san'} = $cmap_san;
}

}### end GetNotReqdCourses Can you explain what happens after foreach. what are those 3 lines doing? I think the first line | those 4 items, but not sure about last two lines
how to read DTD file and convert the ascii file in to xml on that DTD structure?
How to create an array and printing elements using for each loop...
what is algorithm or pseudo code a program asking user to enter the marks of 6 subjects & calculate the percentage?
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.
Ques 1 :
Sample Code
Code:
INSERT INTO names VALUES ('John')

How do you use the DBI module to execute the above SQL statement? Assume $dbh is the return value from DBI->connect.

Choice 1
my $statement = $dbh->execute("INSERT INTO names VALUES ('John')");
Choice 2
my $statement = $dbh->sql("INSERT INTO names VALUES ('John')");
$statement->execute;
Choice 3
my $statement = $dbh->prepare("INSERT INTO names VALUES ('John')");
$statement->execute;
Choice 4
my $statement = $dbh->run("INSERT INTO names VALUES ('John')");
Choice 5
my $statement = $dbh->insert("INSERT INTO names VALUES ('John')");
$statement->finish;

Ques 2 :
What is the output of the following script?
#!/usr/local/bin/perl
$i = 0; $j = 1;
if ($i = 2) { print $i; }
else { print $j; }
if ($i = 0) { print $i; }
else { print $j; }

(a) 11
(b) 21
(c) 10
(d) 01
(e) It produces an error message.
LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS