We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>


Looking For Something at vustudents.ning.com? Click Here to Search

Assignment No. 03 Semester: Spring 2014 Modern Programming Languages (CS508) ||| Total Marks: 15 Due Date: 09/07/2013

Assignment No. 03
Semester: Spring 2014
Modern Programming Languages  (CS508)

 

Total Marks: 15

 

Due Date:  09/07/2013

 

Instructions:

Please read the following instructions carefully before submitting assignment:

 

  • You will submit your assignment before or on due date on VU-LMS.
  • Assignment should be completed by your own efforts it should not be copied from internet, handouts or books.
  • You should submit your MS Word File via assignment interface at VU-LMS.
  • Assignment sent via Email will not be replied and accepted/graded in any case.
  • If the submitted assignment does not open or file is corrupt, it will not be graded.
  • You will submit solution only in Microsoft Word File.

 

Objectives:

 

To understand and familiarize with Prolog Language.

 

 

For any query about the assignment, contact at cs508@vu.edu.pk or through MDB.

Assignment Questions

 

Suppose you have the following observational data about students of college.

 

  • Zafar is adult and fasting in Ramzaan Ul Mobarak.
  • Rizwan is adult and fasting in Ramzaan Ul Mobarak.
  • Raza is adult and fasting in Ramzaan Ul Mobarak.

 

  • Imran is non adult but fasting in Ramzaan Ul Mobarak.
  • Saqib is non adult but fasting in Ramzaan Ul Mobarak.

 

  • Nazia is Healthy and Adult and Travelling.
  • Ammara is Healthy and Adult and Travelling.

 

  • Shafiq is Healthy and Adult and Travelling.

.

  • Imran is Healthy and non Adult and Travelling.
  • Raza is Healthy and Adult and Travelling.
  • Bushra is Healthy and not Adult and Travelling.

 

  • Bushra is under age and not fasting in Ramzan Ul Mobarak.
  • Nadia is under age and not fasting in Ramzan Ul Mobarak.

 

  • Shafiq has become ill and not fasting in Ramzan Ul Mobarak.
  • Salaman is above eighty and feeble and not fasting in Ramzan Ul Mobarak.

 

  1. 1.      Now being a prolog programmer answer the following questions:

 

Question # 1                                                                                                                              Marks 5     

 

Write the prolog rules for the followings.

 

If one is fasting in Ramzan ul Mobarak then on is Adult.

If one is Fasting in Ramzan ul Mobarak then one is rewarded by ALLAH KARIM.

If one is non adult and fasting in Ramzan ul Mobarak then one is earning greater reward by Allah Karim.

If one is adult and healthy and travelling then one can keep left fasts in travelling after Ramzan ul Mobarak

If one is ill or of very old age feeble can give ransom for left fasts to needy 

 

Question # 2                                                                                                                              Marks 10     

Write the prolog queries for the followings. These queries will be executed according to the facts and rules defined for the above given data and perform all steps to write the output of the given queries.

 

  1. a.      Is there adult X that can keep left fasts? 
  2. b.      Is there Y that can leave fast?
  3. c.       Who is M that earns greater reward by Allah Karim?
  4. d.      Is Bushra Fasting in Ramzan Ul Mobark?
  5. e.       Are Imran and Saqib keeping fast?
  6. f.       Who is Z adult and fasting?

 

Note: In queries where variables are used along with answer write all the possible matches either they are true or not.

 

 

BEST OF LUCK

 

Share This With Friends......

+ Click Here To Join also Our facebook study Group.

This Content Originally Published by a member of VU Students.

+ Prohibited Content On Site + Report a violation + Report an Issue


..How to Join Subject Study Groups & Get Helping Material?..


Views: 1509

See Your Saved Posts Timeline

Attachments:

Replies to This Discussion

Dear Alls... Please share .....

share to kerna pre ga deify warna phir marks kam aian gay. Isha Allah abi se start kertain hain.

  adult(Zafar, fasting, Ramzan_Ul_Mubarak)

  adult(Rizwan, fasting, Ramzan_Ul_Mubarak)

  adult(Raza, fasting, Ramzan_Ul_Mubarak)

not adult(Imran, not fasting, Ramzan_Ul_Mobarak)

not adult(Saqib, not fasting, Ramzan_Ul_Mobarak)

are correct?

friends this assignment not so difficult, this link will help you understand the concepts of Facts, Rules and Queries..

it helped me

http://www.cs.trincoll.edu/~ram/cpsc352/notes/prolog/factsrules.html

yar Assignment kuch  b nahe hay simple is assignment ka matlab hay kay sir rozy rakh rahay hay or un ko rozy lag rahay hay .... :p

Whats the Prolog Rules ? for above statements ?
AND
How to write Queries ?

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.

yar koi idea share kary ga taky start kary solution :)

Take idea from this solution. 

Attachments:

 + §ђȋήȋήğ ஜ๏๏ή + 39 thanks for sharing 

 

Assignment No. 03
Semester: Fall 2013
Modern Programming Languages  (CS508)

 

Total Marks: 15

 

Due Date:  23/01/2014

 

Instructions:

Please read the following instructions carefully before submitting assignment:

 

  • You will submit your assignment before or on due date on VU-LMS.
  • Assignment should be completed by your own efforts it should not be copied from internet, handouts or books.
  • You should submit your MS Word File via assignment interface at VU-LMS.
  • Assignment sent via Email will not be replied and accepted/graded in any case.
  • If the submitted assignment does not open or file is corrupt, it will not be graded.
  • You will submit solution only in Microsoft Word File.

 

Objectives:

 

To understand and familiarize with Prolog Language.

 

 

For any query about the assignment, contact at cs508@vu.edu.pk or through MDB.

Assignment Questions

 

Suppose you have the following observational data about sports students.

 

  • Nadia Plays Basket Ball.
  • Maheen Plays Basket Ball.
  • Sameena Plays Basket Ball.

 

  • Raheel Plays Basket Ball.
  • Fawaz Plays Basket Ball.

 

  • Noureen Plays Badminton.
  • Fahmeeda Plays Badminton.

 

  • Zafar Plays Cricket.
  • Fahad Plays Cricket.
  • Noureen Plays Cricket.
  • Imran Khan Plays Cricket.

 

 

  • Fahad Plays Badminton.
  • Sameena Plays Badminton.
  • Raheel Plays Badminton.
  • Zafar Plays Badminton.

 

Above formal data help us to define the following database  rules in prolog:

 

Plays(Nadia, BasketBall).

Plays(Maheen, BasketBall).

Plays(Sameena, BasketBall).

 

Plays(Raheel,BasketBall).

         Plays(Fawaz, BasketBall).

 

Plays(Noureen,Badminton).

Plays(Fahmeeda, Badminton).

 

Plays(Zafar,Cricket).

Plays(Fahad,Cricket).

Plays(Noureen ,Cricket).

Plays(Imran Khan, Cricket).

 

Plays( Fahad ,Badminton).

Plays(Sameena, Badminton).

Plays(Raheel, Badminton).

Plays(Zafar, Badminton).

 

 

 

  1. 1.      Now being a prolog programmer answer the following questions:

 

Question # 1                                                                                                                              Marks 5     

 

Write the prolog rules for the followings.

 

 

  1.                                                         I.      If one Plays Basket, Ball and Badminton then one likes Football.

 

  1.                                                      II.      If  one Plays Cricket and Badminton then one likes Football and Polo.

 

  1.                                                    III.      If one Plays only Cricket then one likes Polo.

 

  1.                                                   IV.      If one Plays Cricket and Basket Ball then one is Smart.

 

  1.                                                      V.      If one Plays Basket Ball then one is Active.

 

Solution:

 

Likes( Z,FootBall):-Plays(Z, BasketBall), Plays(Z, Badminton).

 

Likes(Z, Football &Polo):- PLays(Z,Cricket), Plays(Z,Badminton)

 

 

Or

 

Likes(Z, Football &Polo ):- Likes(Z,Football), Plays(Z,Cricket).

 

Likes(Z,Polo):-Plays(Z,Cricket).

 

Smart(Z):- Plays(Z,Cricket), Plays( Z,BasketBall).

 

Active(Z):-Plays(Z, BasketBall)

 

 

Question # 2                                                                                                                              Marks 10     

Write the prolog queries for the followings. These queries will be executed according to the facts and rules defined for the above given data and perform all steps to write the output of the given queries.

 

  1. a.      Who is  P that likes Football ?
  2. b.      Who is Q  that likes Football and Polo?
  3. c.       Who is R that  likes polo ?
  4. d.      Does Raheel play Basket Ball?
  5. e.      Do zafar and Imran Khan play Cricket?
  6. f.        Does X play Basketball and Badminton?

 

Note: In queries where variables are used along with answer write all the possible matches either they are true or not.

 

Solution

 

 

?- Likes( P,FootBall)

P=Sameena

P=Raheel

 

?- Likes(Q, Football &Polo )

Q=Noureen

Q=Zafar

Q=Fahad

 

?-Likes(R,Polo)

R =Imran Khan

 

?- Plays(Raheel,Basket Ball)

 Yes

 

?- Plays(Zafar, Cricket) , Plays(Imran Khan, Cricket).

Yes

 

?- Plays(X, BasketBall) , Plays(X, Badminton).

X=Sameena

X=Raheel

 

 

 

 

BEST OF LUCK

 

 

  • Zafar is adult and fasting in Ramzaan Ul Mobarak.
  • Rizwan is adult and fasting in Ramzaan Ul Mobarak.
  • Raza is adult and fasting in Ramzaan Ul Mobarak.


Which one is correct please suggest it, time is very short?

            1- fasting(adult, zafar) ? 

            2- adult(fasting Zafar) ?

Please help any body else whats the facts of rule ???

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service