wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

FUNCTIONAL VS LOGIC

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

Functional paradigm is based on ____________

a)

predicate lambda

b)

predicate calculus

c)

lambda calculus

d)

list calculus

2.

Logic programs are ____________ which means that only the specifications of the desired results are stated rather than detailed procedures for producing them.

a)

non procedural

b)

procedural

c)

declarative

d)

functional

3.

The function (car (cdr (cdr (cdr ‘ ( Allah Melihat Anda Jangan! Meniru! ))))) in Scheme will return

a)

Melihat

b)

Anda

c)

Meniru!

d)

Jangan!

4.

A compound term with two parameters is called as __________

a)

2-tuple

b)

bi-tuple

c)

dwi-tuple

d)

twin-tuple

5.

What will be the output of the following Scheme expressions?


(- 100 + ((* 6 5) (* 8 3)))

a)

-46

b)

-154

c)

46

d)

154

6.

Choose the right output for below statement


(sqr (car (cdr( cdr ‘(1 2 3 4)))))

a)

3

b)

6

c)

9

d)

12

7.

Choose the FALSE statement about logic paradigm

a)

Unification is a process of attempting to re-satisfy goals by finding alternative

b)

A term can be constant, variable or structure

c)

Variable is similar to constant except that it starts with uppercase letter

d)

Instantiation is allowing temporary value being assigned to variable

8.

Given the following Prolog statements. What is the value of printN(3)?


printN(N):- M is N + 3 * 2, write(M).

a)

7

b)

8

c)

9

d)

10

9.

The meaning of the given proposition can be concisely determined from the statement itself is called _____________

a)

appropriate predicate

b)

declarative semantics

c)

compound term

d)

general statement

10.

Give up the attempt to use this particular clause and try another clause instead is the process in the ___________

a)

unification

b)

backtracking

c)

instantiation

d)

matching

11.

Which of the following statement is FALSE about functional programming?

a)

Mathematic calculus is functional programming basic

b)

Function is defined to solve mathematical problem

c)

Functional programming relies on recursion to perform loops or iterative operations

d)

Selection control structures are available in functional programming

12.

A function that takes another function as an argument or computes another function as its result is a __________

a)

recursive function

b)

user-defined function

c)

built-in function

d)

higher-order function

13.

Which of the following statement is FALSE about logic programming paradigm?

a)

It uses the declarative semantic method

b)

It consists of declarations rather than assignment and control flow statements

c)

It is used when the application needs to match certain patterns with backtracking search

d)

It is based on the lambda-calculus expression

14.

In Prolog, a(n) _________________ is a string of letters, digits and underscores that begins with an uppercase letter

a)

variable

b)

atom

c)

structure

d)

list

15.

Functional programming applies ____________

a)

normal-order evaluation

b)

eager evaluation

c)

lazy evaluation

d)

strict evaluation