You are on page 1of 4

Final Term Examination (spring – 2020)

Student Name: Hussnain Ali

Roll No: 0002-BS-CS-2017

Registration No: 2017-BS-CS-UON-0002

Instructor Name: Sir Waseem

Course Title: Artificial intelligence

Course Code: CS-330

Session: 2020

Semester: 6th

Department Name: CS & IT

Date: 12-08-2020

Student Signature
__________________________
Question No. 01
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
while cap.isOpened():
_, img = cap.read()

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)


faces = face_cascade.detectMultiScale(gray, 1.1, 5)
cv2.imwrite('mypic/p.jpg', faces)
for (x, y , w ,h) in faces:
cv2.rectangle(img, (x,y), (x+w, y+h), (255, 0 , 0), 3)

# Display the output


cv2.imshow('img', img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break

cap.release()

Question No. 02

Action f(n) g(n) h(n)

1 Initial State 380 0 380


2 Expand Oradea
Add Zerind 445 71 374
Add Sibiu 404 151 253
3 Expand Sibiu
Add Oradea 682 151+151 380
Add Arad 657 291 366
Add Rimmnicu Vilcea 424 231 193
Add Fagaras 428 250 178
4 Expand Rimmnicu
Add Sibiu 564 311 253
Add Craiova 537 377 160
Add Pitesti 426 328 98
5 Expand Pitesti
Add Rimmicu Vilcea 618 425 193
Add Craiova 626 466 160
Add Bucharest 429 429 0
6 Expand Bucharest
At Goal State - - -
Tree

Question No. 03
 First order logic can represent individual properties. If we write single sentence FOL can
easily represent that sentence
 FOL can express generalization, specialization and pattern
 FOL use predicated which involve constants, variables, functions and relations
 FOL is a mathematical model for predicates function that map variables to truth values.
Question No. 04 Initial State
1 2 3
4 - 5
7 8 6

1 - 3 1 2 3 1 2 3 1 2 3

4 2 5 4 5 - 4 8 5 - 4 5

7 8 6 7 8 6 7 - 6 7 8 6

- 1 3 1 3 - 1 2 - 1 2 3
4 2 5 4 2 5 4 5 3 4 5 6
7 8 6 7 8 6 7 8 6 7 8 -
Goal State

Question No. 05
 Time
 Space
 Complexity

You might also like