পরীক্ষা আর্কাইভ

৪৯তম বিসিএস ⎯ কম্পিউটার সায়েন্স (CSE) [৯৭১]

পরীক্ষা৪৯তম বিসিএস ⎯ কম্পিউটার সায়েন্স (CSE) [৯৭১]তারিখতারিখ অনির্ধারিতসময়30 minutes
মোট প্রশ্ন৪৭
সিলেবাস
Exam 15 Introduction to compilary; Basic issues; logical analysis; lexical analysis; syntax analyses; Semantic analysis; type cheeking; run-time environments; code generation; code optimization; language theory; Overview of AI; General concepts of knowledge; Introduction to PROLOG; Knowledge representation; Intelligent agents; First order logic; Knowledge organization; Natural language processing; expert systems and computer vision. [Source: Class–13 and relevant books]
ঘনত্ব
উত্তর
উত্তরিতবর্তমানপুনরায় দেখুনঅসম্পূর্ণ

৪৯তম বিসিএস ⎯ কম্পিউটার সায়েন্স (CSE) [৯৭১]

৪৯তম বিসিএস ⎯ কম্পিউটার সায়েন্স (CSE) [৯৭১] · তারিখ অনির্ধারিত · ৪৭ প্রশ্ন

.
A compiler translates a program written in a high-level language into:
  1. Machine code
  2. Assembly code only
  3. Source Code
  4. Bytecode only
সঠিক উত্তর:
Machine code
উত্তর
সঠিক উত্তর:
Machine code
ব্যাখ্যা

Answer: A) Machine code
A) Correct — compiler’s primary goal is to produce executable machine-level instructions (though some compilers target assembly or bytecode as intermediate).

B) — assembly is one possible output but not the only; many compilers produce machine code or intermediate representations.

C) — Source code is computer program that is created by a programmer which needs to be translated for execution

D) Partially correct in some contexts (e.g., Java compilers to bytecode) but not generally; compiler target varies

.
A language for which compilers are easier to write due to simpler syntax is said to be
  1. Ambiguous
  2. Deterministic context-free
  3. Read-only
  4. High-level
সঠিক উত্তর:
Deterministic context-free
উত্তর
সঠিক উত্তর:
Deterministic context-free
ব্যাখ্যা

Answer: B) Deterministic context-free 
A) Ambiguous grammar makes compiling harder.
B) Correct: deterministic CFLs (LR, LL) have parsers that are efficient and predictable.
C) Not related.
D) High-level refers to abstraction, not parsing ease.

.
Which of the following error can a compiler check?
  1.  Syntax Error
  2. Logical Error
  3. Runtime Error
  4.  Both Logical and Syntax Error
সঠিক উত্তর:
 Syntax Error
উত্তর
সঠিক উত্তর:
 Syntax Error
ব্যাখ্যা

Answer: A
Explanation: 

Syntax Error:

·  A syntax error means the program does not follow the grammar of the programming language.
· The compiler can detect this during parsing (syntax analysis).
· So yes, the compiler always detects syntax errors before generating code.

Logical Error:

A logical error means the program compiles successfully but does not behave as intended

· The compiler has no way to know the programmer’s intention, so it cannot detect logical errors.
· These are usually found by testing/debugging

Runtime Error:

Runtime errors occur when the program is running, not at compile-time

Runtime errors are handled by the runtime system or OS, not by the compiler

.
Which of the following is not a duty of a compiler?
  1. Lexical analysis
  2. Memory allocation for processes at runtime
  3. Code optimization
  4. Error reporting
সঠিক উত্তর:
Memory allocation for processes at runtime
উত্তর
সঠিক উত্তর:
Memory allocation for processes at runtime
ব্যাখ্যা

Answer: B) Memory allocation for processes at runtime 

A) Lexical: Core duty.
B) OS/runtime handles process memory allocation at run time; compiler prepares memory layout but not allocate runtime process memory.
C) Code optimization: compiler responsibility.
D) Error reporting: compiler reports syntax/semantic errors.

.
The lexical analyzer (scanner) produces which of the following for the parser?
  1. Tokens
  2.  Parse tree
  3. Symbol table only
  4. Object code
সঠিক উত্তর:
Tokens
উত্তর
সঠিক উত্তর:
Tokens
ব্যাখ্যা

Answer: A) Tokens 
Explanation:
Lexical analyzer: 
→ Lexical analysis = scanning.
→ Breaks the input program into tokens (keywords, identifiers, operators, literals).

Example
:

       int x = 10 + 5;
Lexical analyzer produces tokens like:

   int → keyword

   x → identifier

   = → assignment operator

   10 → constant

   + → operator

   5 → constant


    B) Parse tree produced by parser.
    C) Symbol table maintained but scanner mainly produces tokens.
    D) Object code is later.

.
Regular expressions are used to describe:
  1. Context-free grammars
  2. Semantic rules
  3. Token patterns for lexical analysis
  4. Control-flow of program
সঠিক উত্তর:
Token patterns for lexical analysis
উত্তর
সঠিক উত্তর:
Token patterns for lexical analysis
ব্যাখ্যা

 Answer: C) Token patterns for lexical analysis
Explanation
Regular Expressions:

•    Regular expressions (REs) are formal notations used to describe regular languages (a subset of formal languages).
•    They can specify patterns of strings → which is exactly what we need for token definitions in the lexical analysis phase of a compiler.
For example:
•    Identifier in C: [a-zA-Z_][a-zA-Z0-9_]*
•    Integer literal: [0-9]+
•    Whitespace: [\t\n ]+
The lexical analyzer (scanner) uses these patterns to group characters into tokens like if, while, identifier, number.

.
Which finite automata is used to implement a lexical analyzer?
  1. Pushdown automata
  2. Context-free grammar
  3. Turing machine
  4. Deterministic finite automata (DFA)
সঠিক উত্তর:
Deterministic finite automata (DFA)
উত্তর
সঠিক উত্তর:
Deterministic finite automata (DFA)
ব্যাখ্যা

Answer: D) DFA 
•    Lexical analyzers implement DFA for efficiency.
•    NFA → converted to DFA for fast scanning.
•    PDA → used for syntax analysis (parsing).
•    Turing machine → more powerful (not needed here).

.
Which error is detected by lexical analyzer?
  1.  Missing semicolon
  2. Unrecognized symbol
  3. Type mismatch
  4. Dangling else
সঠিক উত্তর:
Unrecognized symbol
উত্তর
সঠিক উত্তর:
Unrecognized symbol
ব্যাখ্যা

Answer: B) Unrecognized symbol 
    Example: Using @ in C source code.
    A) Syntax error (parser).
    C) Semantic error (semantic analyzer).
    D) Ambiguity in parsing (parser’s job).

.
A DFA in lexical analysis:
  1. Is used to implement token recognition without backtracking
  2. Can have ε-transitions
  3. Requires unlimited memory
  4. Is the same as a Turing machine
সঠিক উত্তর:
Is used to implement token recognition without backtracking
উত্তর
সঠিক উত্তর:
Is used to implement token recognition without backtracking
ব্যাখ্যা

Answer: A) Is used to implement token recognition without backtracking
Explanation
 DFA in Lexical Analysis:

→ The lexical analyzer (scanner) uses DFA to recognize tokens efficiently.

→ DFA reads one character at a time, transitions deterministically, and does not require backtracking.

   That’s why compilers prefer DFA over NFA → speed.

১০.
Which of these is a lexical error?
  1. Syntax error due to missing semicolon
  2.  Invalid character in source (e.g., control char in identifier)
  3.  Type mismatch in expression
  4. Unreachable code after return
সঠিক উত্তর:
 Invalid character in source (e.g., control char in identifier)
উত্তর
সঠিক উত্তর:
 Invalid character in source (e.g., control char in identifier)
ব্যাখ্যা

Answer: B) Invalid character in source (e.g., control char in identifier)
   A) Syntax error — parser.
   B) Correct — scanner should report illegal token.
   C) Semantic error — semantic analyzer.
   D) Semantic/optimizing or warning

১১.
Which approach is used to convert a regular expression to an efficient implementation for lexing?
  1. Directly translate into CFG
  2.  Use Turing machine simulation
  3. Convert RE → NFA → DFA → minimize DFA → table-driven scanner
  4.  Use semantic actions only
সঠিক উত্তর:
Convert RE → NFA → DFA → minimize DFA → table-driven scanner
উত্তর
সঠিক উত্তর:
Convert RE → NFA → DFA → minimize DFA → table-driven scanner
ব্যাখ্যা

Answer: C) Convert RE → NFA → DFA → minimize DFA → table-driven scanner 
A) CFG conversion unnecessary.
B) Overkill.
C) Correct: standard pipeline ensures determinism and speed.
D) Semantic actions supplement recognition.

১২.
A context-free grammar (CFG) consists of:
  1. Terminals, nonterminals, productions, start symbol
  2.  Only terminals and productions
  3. Only regular expressions
  4. Only semantic rules
সঠিক উত্তর:
Terminals, nonterminals, productions, start symbol
উত্তর
সঠিক উত্তর:
Terminals, nonterminals, productions, start symbol
ব্যাখ্যা

 Answer: a) Terminals, nonterminals, productions, start symbol
Explanation
 Context-Free Grammar (CFG):

A CFG is a formal grammar that defines context-free languages (CFLs).

Introduced by Noam Chomsky, CFGs are used to describe the syntax of programming languages (in compiler design, used in parsing phase).

Formally, a CFG is a 4-tuple: G=(V,Σ,R,S)

Where:

V (Nonterminals): Variables representing syntactic categories (e.g., <expr>, <stmt>).

Σ (Terminals): Actual alphabet symbols (tokens) like if, +, id, ;.

R (Productions): Rules of the form A → α where A is a nonterminal and α is a string of terminals and nonterminals.

S (Start Symbol): One distinguished nonterminal from which derivations begin.

১৩.
Ambiguity in a CFG means:
  1. Grammar has no start symbol
  2.  Grammar generates no strings
  3. Grammar only generates ε
  4. Grammar generates strings with multiple leftmost derivations
সঠিক উত্তর:
Grammar generates strings with multiple leftmost derivations
উত্তর
সঠিক উত্তর:
Grammar generates strings with multiple leftmost derivations
ব্যাখ্যা

Answer: D) Grammar generates strings with multiple leftmost derivations 

Ambiguous grammar = at least one string with two or more parse trees.

Example: E → E + E | E * E | id.

String id + id * id has two parses (+ first or * first).

১৪.
FIRST and FOLLOW sets are used in:
  1. Lexical analysis
  2.  Top-down parsing
  3. Bottom-up parsing
  4. Code generation
সঠিক উত্তর:
 Top-down parsing
উত্তর
সঠিক উত্তর:
 Top-down parsing
ব্যাখ্যা

Answer: B) Top-down parsing

FIRST set → first possible terminal from a nonterminal.

FOLLOW set → terminals that can appear immediately after a nonterminal.

Used in LL(1) parser construction

১৫.
Semantic analysis of a program typically performs:
  1. Lexical tokenization
  2. Generating assembly code
  3. Type checking, scope resolution, and building/enriching symbol table with attributes
  4.  Minimizing DFA
সঠিক উত্তর:
Type checking, scope resolution, and building/enriching symbol table with attributes
উত্তর
সঠিক উত্তর:
Type checking, scope resolution, and building/enriching symbol table with attributes
ব্যাখ্যা

Answer: C) Type checking, scope resolution, and building/enriching symbol table with attributes 
A) Lexical tokenization → Done by scanner.
B) Generating assembly code → Code generation later.
C) Correct: semantic phase enforces meaning.
D) Minimizing DFA →Lexical step.

১৬.
Which of the following is typically not part of semantic analysis?
  1. Building the AST
  2.  Type inference and checking
  3.  Constant folding optimization in IR (though often in optimization phase)
  4. Scope resolution and binding names to declarations
সঠিক উত্তর:
 Constant folding optimization in IR (though often in optimization phase)
উত্তর
সঠিক উত্তর:
 Constant folding optimization in IR (though often in optimization phase)
ব্যাখ্যা

Answer: C) Constant folding optimization in IR (though often in optimization phase) 

A/B/D) Semantic duties.
• C) Optimization phase, although early compilers might do some folding earlier.

১৭.
Which data structure is commonly used to handle nested scopes during semantic analysis?
  1. Stack of symbol tables (or hash table with scope links)
  2. Single global array only
  3.  Turing tape
  4. Linked list of tokens only
সঠিক উত্তর:
Stack of symbol tables (or hash table with scope links)
উত্তর
সঠিক উত্তর:
Stack of symbol tables (or hash table with scope links)
ব্যাখ্যা

Answer: A) Stack of symbol tables (or hash table with scope links) 

  A) Correct: push new scope, pop on exit.
  B) Too simplistic.
  C/D) Irrelevant.

১৮.
Which linking technique resolves external references at load time?
  1. Static linking (linker resolves and produces executable)
  2. Dynamic linking (resolve at runtime/loader)
  3.  Lazy binding only during execution of each call
  4. None
সঠিক উত্তর:
Static linking (linker resolves and produces executable)
উত্তর
সঠিক উত্তর:
Static linking (linker resolves and produces executable)
ব্যাখ্যা

Answer: A) Static linking (linker resolves and produces executable)
 
    A) Correct: static linker resolves all at link time.
    B) Dynamic linking resolves at load/runtime via loader or dynamic linker.
   C) Lazy binding is dynamic technique for delaying resolution.
    D) Not correct.

১৯.
Regular languages are recognized by:
  1. Context-free grammars exclusively
  2.  Pushdown automata (PDA)
  3.  Turing machines only
  4. Finite automata (DFA/NFA)
সঠিক উত্তর:
Finite automata (DFA/NFA)
উত্তর
সঠিক উত্তর:
Finite automata (DFA/NFA)
ব্যাখ্যা

Answer: D) Finite automata (DFA/NFA)

Explanation

Regular languages are the simplest class of languages in the Chomsky hierarchy.

They can be:
Described using regular expressions.

Recognized/accepted by finite automata (both Deterministic FA (DFA) and Nondeterministic FA (NFA)).

Example: Language of all strings over {0,1} ending with 01.

Regular expression: (0+1)*01

DFA can be constructed with states tracking whether we’ve seen "01" at the end.

২০.
Which of the following classes is the most powerful in Chomsky hierarchy?
  1.  Regular languages
  2. Context-free languages
  3.  Recursively enumerable languages (Type-0)
  4. Context-sensitive languages
সঠিক উত্তর:
 Recursively enumerable languages (Type-0)
উত্তর
সঠিক উত্তর:
 Recursively enumerable languages (Type-0)
ব্যাখ্যা

Answer: C) Recursively enumerable languages (Type-0) 
A)  Regular languages → Weakest.
B) Context-free languagesMore powerful than regular, less than context-sensitive.
C) Recursively enumerable languages (Type-0) → Type-0 / RE are most general
D) Context-sensitive languages → More powerful than CFLs but less than Type-0.

২১.
Linear bounded automaton (LBA) recognizes which class?
  1. Context-sensitive languages (CSLs)
  2. Regular languages only
  3. Recursively enumerable only
  4. Deterministic finite languages only
সঠিক উত্তর:
Context-sensitive languages (CSLs)
উত্তর
সঠিক উত্তর:
Context-sensitive languages (CSLs)
ব্যাখ্যা

Answer: A) Context-sensitive languages (CSLs)
Explanation

What is an LBA?

An LBA (Linear Bounded Automaton) is a type of Turing Machine (TM).

Restriction: The tape size is limited to a portion linearly bounded by the input size.

i.e., For input of length n, LBA can use at most O(n) tape cells.

Thus, it has limited memory, unlike unrestricted TM which has infinite tape.

 LBA in Chomsky Hierarchy:

Type-0 (Unrestricted Grammars): Recursively enumerable languages (recognized by Turing Machines).

Type-1 (Context-Sensitive Grammars): Context-Sensitive Languages (recognized by LBA).

Type-2 (Context-Free Grammars): Context-Free Languages (recognized by Pushdown Automata).

Type-3 (Regular Grammars): Regular Languages (recognized by Finite Automata).

So:
  LBA = Recognizer for Context-Sensitive Languages (Type-1).

২২.
Which of the following is true about context-free grammars and ambiguity?
  1. All CFLs have unambiguous grammars
  2. Some CFLs are inherently ambiguous (no unambiguous grammar exists for them)
  3.  Ambiguity is irrelevant for compilation
  4. Ambiguity only occurs in regular grammars
সঠিক উত্তর:
Some CFLs are inherently ambiguous (no unambiguous grammar exists for them)
উত্তর
সঠিক উত্তর:
Some CFLs are inherently ambiguous (no unambiguous grammar exists for them)
ব্যাখ্যা

 Answer: B) Some CFLs are inherently ambiguous (no unambiguous grammar exists for them)
Explanation:

 What is Ambiguity in CFG?

A CFG is ambiguous if there exists at least one string in the language that has more than one leftmost derivation, rightmost derivation, or parse tree.

Example (arithmetic grammar):

E → E + E | E * E | id


String: id + id * id

Can be parsed as (id + id) * id OR id + (id * id).

→ Ambiguous grammar.

Ambiguity in CFLs

Some context-free languages (CFLs) can be described by both ambiguous and unambiguous grammars.

E.g., Arithmetic expressions → ambiguous grammar above, but can be rewritten unambiguously with precedence rules:

E → E + T | T  
T → T * F | F  
F → id | (E)


But there exist inherently ambiguous CFLs:

Languages for which no unambiguous grammar exists at all.

Example:

L = { a^i b^j c^k | i = j or j = k }

২৩.
What is the transition function of a DFA?
  1. Q × Σ → Q
  2. Q × Σ → 2^Q
  3. Q × Σ → 2^n
  4.  Q × Σ → Q^n
সঠিক উত্তর:
Q × Σ → Q
উত্তর
সঠিক উত্তর:
Q × Σ → Q
ব্যাখ্যা

 Answer: a) Q × Σ → Q
Explanation:

 Formal definition of DFA:

A DFA (Deterministic Finite Automaton) is a 5-tuple: M= (Q,Σ,δ,q0, F)

Where:

Q = finite set of states.

Σ = finite input alphabet.

δ = transition function.

q₀ ∈ Q = start state.

F ⊆ Q = set of accepting states.

DFA transition function δ: Q × Σ → Q

For each state and each input symbol, DFA specifies exactly one next state.

That’s why it is deterministic.

Example: DFA for strings over {0,1} ending in 1.

States: {q0 (start), q1 (accept)}

Transition function δ:

δ(q0,0) = q0

δ(q0,1) = q1

δ(q1,0) = q0

δ(q1,1) = q1

Here, δ maps from (state, symbol) → single next state.

২৪.
What is Artificial Intelligence (AI)?
  1. The science of making machines think like humans
  2. The study of human psychology
  3. The process of storing data in computers
  4. The hardware design of computer systems
সঠিক উত্তর:
The science of making machines think like humans
উত্তর
সঠিক উত্তর:
The science of making machines think like humans
ব্যাখ্যা

Answer: A 
Explanation:
    AI is the field of computer science that focuses on creating machines capable of performing tasks that normally require human intelligence (reasoning, problem-solving, learning, understanding language, etc.).

২৫.
Which of the following is not a domain of AI?
  1. Machine Learning
  2.  Natural Language Processing
  3.  Data Structures
  4. Computer Vision
সঠিক উত্তর:
 Data Structures
উত্তর
সঠিক উত্তর:
 Data Structures
ব্যাখ্যা

Answer: C 
Explanation:
•    AI domains include ML, NLP, Computer Vision, Robotics, Expert Systems, Knowledge Representation, and Planning.

•    Data Structures is a programming concept, not a core domain of AI.

২৬.
Which of the following is not a component of AI?
  1. Learning
  2. Reasoning
  3. Perception
  4. Disk Fragmentation
সঠিক উত্তর:
Disk Fragmentation
উত্তর
সঠিক উত্তর:
Disk Fragmentation
ব্যাখ্যা

Answer: D 
Explanation:
 Core AI components:
    Learning (ML, Deep Learning)
    Reasoning (logic, inference)
    Perception (vision, speech recognition)
    Problem-solving, Planning, Knowledge Representation

    Disk Fragmentation → OS task, unrelated to AI

২৭.
The "Turing Test" is related to:
  1. Checking memory capacity of computers
  2. Testing machine’s ability to exhibit intelligent behavior
  3. Comparing two algorithms
  4. Measuring computational speed
সঠিক উত্তর:
Testing machine’s ability to exhibit intelligent behavior
উত্তর
সঠিক উত্তর:
Testing machine’s ability to exhibit intelligent behavior
ব্যাখ্যা

Answer: B 

Explanation:
The Turing Test is a benchmark for evaluating a machine's ability to exhibit human-like intelligence. Proposed by Alan Turing in 1950, the test involves a human judge engaging in a text-based conversation with both a human and a machine

Criteria for the Turing Test:
The Turing Test does not require the machine to be correct or logical in its responses but rather to be convincing in simulating human conversation. The key criteria include:
Natural Language Processing (NLP): The machine must understand and generate human language fluently.
Knowledge Representation: The machine needs to handle and manipulate knowledge to provide contextually relevant responses.
Reasoning: The machine should demonstrate some form of logical reasoning, even if flawed, to sustain a conversation.
Learning: Ideally, the machine should learn from the interaction, adapting its responses over time

২৮.
Which of the following AI applications uses computer vision?
  1.  Facial recognition system
  2. Online grammar checker
  3. Chatbot conversation
  4. Expert system in medicine
সঠিক উত্তর:
 Facial recognition system
উত্তর
সঠিক উত্তর:
 Facial recognition system
ব্যাখ্যা

Answer: A 
Explanation:
•    Computer vision → enabling machines to "see" and interpret images.
•    B & C → Natural Language Processing.
•    D → Knowledge-based reasoning

২৯.
Declarative knowledge is:
  1. “How-to” procedures (skills)
  2. Facts and relationships about the world (what is), expressible in logic or semantic nets 
  3. The same as sensory data streams only
  4.  Always executable code
সঠিক উত্তর:
Facts and relationships about the world (what is), expressible in logic or semantic nets 
উত্তর
সঠিক উত্তর:
Facts and relationships about the world (what is), expressible in logic or semantic nets 
ব্যাখ্যা

 Answer: (B) Facts and relationships about the world (what is), expressible in logic or semantic nets
Explanation
What is Declarative Knowledge?

Declarative knowledge = “know-what” type knowledge.

It describes facts, truths, and relationships about objects in the world.

Expressed using logic, semantic networks, frames, or ontologies.

Example:

Paris is the capital of France.

“All birds can fly (except some like penguins).

This kind of knowledge does not tell you how to do something, it only tells you what is true.

 Procedural Knowledge vs Declarative Knowledge

Procedural Knowledge = “know-how” (skills, algorithms, procedures).

Example: "How to solve a Rubik’s cube," "Steps to drive a car."

Stored as production rules or algorithms.

Declarative Knowledge = “know-what” (facts, descriptions).

Example: "The cube has six faces," "A car has four wheels."

Quick Comparison Table

৩০.
What are the sectors where Prolog programming language is used?
  1.  Automated reasoning
  2. Machine learning
  3. Robot planning
  4. All of the above
সঠিক উত্তর:
All of the above
উত্তর
সঠিক উত্তর:
All of the above
ব্যাখ্যা

 Answer: (D) All of the above
 Explanation

Prolog (Programming in Logic) is a declarative, logic programming language based on first-order predicate logic.

Instead of writing how to solve a problem, you specify what is true (facts + rules).

The Prolog engine uses resolution and unification to answer queries.

Because of this reasoning ability, Prolog is widely used in AI domains.

? Option Analysis

(A) Automated reasoning 

Prolog was originally designed for automated theorem proving and logical inference.

Example: Proving statements like

Fact: mortal(X) :- human(X).

Query: ?- mortal(socrates).

Answer: Yes, since socrates is a human.

Prolog is excellent for rule-based expert systems and knowledge-based reasoning.

(B) Machine learning 

While modern ML uses Python/R, Prolog is used in symbolic AI and Inductive Logic Programming (ILP).

ILP combines machine learning with logic programming → learning general rules from examples.

Example: Given facts about family trees, Prolog can learn rules like "grandparent(X,Y) :- parent(X,Z), parent(Z,Y)."

(C) Robot planning 

Robots require planning, reasoning, and decision-making.

Prolog excels at search strategies, planning problems, and pathfinding (like STRIPS-based planning).

Example: A robot in a grid environment can use Prolog to infer the sequence of actions: move → pick → place.

৩১.
The main control strategy in Prolog is:
  1.  Breadth-first search
  2. Random search
  3. Depth-first search with backtracking 
  4. Greedy
সঠিক উত্তর:
Depth-first search with backtracking 
উত্তর
সঠিক উত্তর:
Depth-first search with backtracking 
ব্যাখ্যা

Answer: (C) Depth-first search with backtracking
Explanation

 How Prolog Executes Queries:

Prolog uses SLD-resolution (Selective Linear Definite clause resolution) to answer queries.

It always works top-down and left-to-right through goals in the rule body.

The search strategy is:

Pick the first rule (clause) that matches the goal.

Try to satisfy it.

If it fails, backtrack to the last choice point, try the next rule.

This continues until either:

A solution is found.

Or all possibilities are exhausted (query fails).

This is basically depth-first search (DFS) with backtracking.

৩২.
Which of the following is not a feature of PROLOG?
  1. Pattern matching
  2. Recursion
  3.  Non-determinism
  4. Pointers 
সঠিক উত্তর:
Pointers 
উত্তর
সঠিক উত্তর:
Pointers 
ব্যাখ্যা

answer: (D) Pointers

Explanation

Features Prolog does have

A) Pattern Matching 

Prolog is built on unification, which is a more powerful form of pattern matching.

Example:

likes(john,X).
?- likes(john,mary).
Here X = mary is found through unification (pattern matching).

B) Recursion

Since Prolog doesn’t have loops (for, while), recursion is the natural way to express repetition.

Example:
factorial(0,1).
factorial(N,F) :- N > 0, N1 is N-1, factorial(N1,F1), F is N*F1.


Query ?- factorial(5,F). → returns F = 120.

C) Non-determinism 

Prolog doesn’t commit to just one solution; it can explore multiple possible answers using backtracking.

Example:

color(red).
color(blue).
color(green).

Query:

?- color(X).

Prolog answers:
X = red ; X = blue ; X = green. (all possible solutions, non-determinism).

Pointers (D) 

Pointers are a feature of imperative languages like C, C++.

৩৩.
Which of the following generates new information from the given information? 
  1. Inheritable knowledge 
  2. Relational knowledge 
  3. Inferential knowledge
  4. Procedural knowledge
সঠিক উত্তর:
Inferential knowledge
উত্তর
সঠিক উত্তর:
Inferential knowledge
ব্যাখ্যা

Answer: C) Inferential knowledge
Explanation:
Inferential knowledge refers to the set of mechanisms or rules that produce new information from existing facts — e.g., logical inference rules, production rules, or transformation operators. It’s literally the “how to derive” knowledge.
Example: Modus ponens: from P and P → Q infer Q. That inference rule is inferential knowledge: it generates Q from given information.

Other options:
A) Inheritable knowledge
— typically refers to properties inherited through hierarchical structures (like class inheritance in frames/ontologies). It passes down existing properties but doesn’t in itself derive brand-new facts beyond inheritance semantics.

B) Relational knowledge — describes relationships between entities (parent(A,B), located_in(city,country)). It is descriptive; it doesn’t by itself perform inference (though relational facts can be inputs to inference).

D) Procedural knowledge — is how-to knowledge (algorithms, recipes). It tells you how to perform tasks; it can lead to new outcomes when executed, but in KR taxonomy the phrase “generates new information from given information” more precisely matches inferential knowledge (rules/inference engines).

৩৪.
Any instance in which two different objects are compared is a … type of knowledge
  1. inheritable 
  2. relational 
  3. inferential 
  4. procedural
সঠিক উত্তর:
relational 
উত্তর
সঠিক উত্তর:
relational 
ব্যাখ্যা

Answer: B) Relational

Explanation:

Relational knowledge encodes relationships among entities — comparisons are a special case of relations (e.g., greater than(a,b), similar_to(x,y), near(city1,city2)). When you compare two objects, you are expressing a relation between them.
Example comparisons: Alice > Bob (score), color_of(obj1) = red vs color_of(obj2) = blue — these are relational facts

Inferential Adequacy = ability to derive new knowledge from old.
Inferential Knowledge = the rules/mechanisms that generate new information.
Procedural Knowledge = programs/directions/recipes (how-to).
Relational Knowledge = comparisons / relations between objects.

৩৫.
What is the primary function of an intelligent agent?
  1. To perform tasks on behalf of a user 
  2. To store large amounts of data
  3. To enhance hardware performance
  4.  To provide network security
সঠিক উত্তর:
To perform tasks on behalf of a user 
উত্তর
সঠিক উত্তর:
To perform tasks on behalf of a user 
ব্যাখ্যা

Answer: (A) To perform tasks on behalf of a user
Explanation:
      Intelligent agents act autonomously to accomplish tasks, often in complex environments.
     Example: A personal assistant AI (like Siri) schedules meetings for you.
Others option:
    Data storage (b): Storage isn’t their purpose, though they may use memory.
    Hardware (c): Improving hardware isn’t the job of agents.
    Security (d): Some agents may do security tasks, but that’s just one application.

৩৬.
Which of the following is a key characteristic of an intelligent agent?
  1. Redundancy
  2. Autonomy 
  3. Complexity
  4. Inflexibility
সঠিক উত্তর:
Autonomy 
উত্তর
সঠিক উত্তর:
Autonomy 
ব্যাখ্যা

 Answer: (B) Autonomy
Explanation:
    Intelligent agents must be autonomous: able to make decisions and act without constant human intervention.
    Example: A vacuum-cleaning robot that senses dirt and cleans rooms without being micromanaged.
   
Others option:
    Redundancy: Not a core characteristic — may be desirable in systems for fault-tolerance, but not defining for agents.
   Complexity: Agents can be complex, but complexity itself isn’t the defining feature.
   Inflexibility: Opposite of what we want! Intelligent agents must adapt, not be rigid.

৩৭.
Which AI concept involves an agent improving its performance by observing and mimicking human behavior?
  1.  Supervised learning
  2. Cognitive modeling 
  3.  Neural networking
  4.  Reinforcement learning
সঠিক উত্তর:
Cognitive modeling 
উত্তর
সঠিক উত্তর:
Cognitive modeling 
ব্যাখ্যা

 Answer: (B) Cognitive modeling
   Explanation:
    Cognitive modeling simulates or mimics human thought processes.
   Involves building agents that learn tasks by observing humans and replicating their reasoning/behavior.
   Example: AI systems that learn to solve problems the way psychologists' model human cognition.

Others option:
    Supervised learning (a): Learns from labeled data, not directly from human behavior.
    Neural networking (c): A model type, not specifically about mimicking humans.
Reinforcement learning (d): Improves by trial and error via rewards/punishments, not by direct imitation

৩৮.
What is Natural Language Processing (NLP) primarily concerned with?
  1. Analyzing and understanding human languages 
  2. Improving network communication speeds
  3. Developing new programming languages
  4. Enhancing graphical user interfaces
সঠিক উত্তর:
Analyzing and understanding human languages 
উত্তর
সঠিক উত্তর:
Analyzing and understanding human languages 
ব্যাখ্যা

Answer: (A) Analyzing and understanding human languages

Explanation:
Natural Language Processing (NLP) is a branch of artificial intelligence that enables computers to understand, interpret, and generate human language, facilitating seamless interaction between humans and machines.

Key Applications:
NLP is widely used in various applications, including:
Chatbots and Virtual Assistants: Tools like Amazon's Alexa and Apple's Siri utilize NLP to understand and respond to user queries. 
Text Translation: Services like Google Translate use NLP to convert text from one language to another. 
Sentiment Analysis: Businesses use NLP to analyze customer feedback and social media interactions to gauge public sentiment. 
Speech Recognition: NLP enables voice-operated systems to convert spoken language into text, facilitating hands-free operation. 
Document Summarization: NLP techniques can automatically summarize long documents, making it easier for users to digest information quickly.

৩৯.
What does "stemming" in NLP involve?
  1. Visualizing text data
  2.  Removing affixes from words to get the root form 
  3. Encrypting text data for secure transmission
  4. Generating synthetic speech
সঠিক উত্তর:
 Removing affixes from words to get the root form 
উত্তর
সঠিক উত্তর:
 Removing affixes from words to get the root form 
ব্যাখ্যা

Answer: (B) Removing affixes from words to get the root form
    Explanation:
    Stemming reduces words to their base stem by chopping off prefixes/suffixes.
    Example:
    “playing” → “play”
    “studies” → “studi” (not always a valid word, just a stem).
    Stemming helps treat words with the same meaning as one.
Others option:
    (a) Visualization is data analysis, not stemming.
    (c) Encryption is cryptography, not NLP.
    (d) Synthetic speech → that’s speech generation (Text-to-Speech).

৪০.
A "chatbot" in NLP is designed to:
  1. Store and retrieve large databases of text
  2. Translate text between different programming languages
  3.  Simulate conversational interaction with humans 
  4. Perform image recognition tasks
সঠিক উত্তর:
 Simulate conversational interaction with humans 
উত্তর
সঠিক উত্তর:
 Simulate conversational interaction with humans 
ব্যাখ্যা

 Answer: C) Simulate conversational interaction with humans
    Explanation:
    Chatbots use NLP to understand queries and generate responses that mimic human conversation.
    Example: Siri, Alexa, ChatGPT.
    Why others are wrong:
    (a) Storage/retrieval is database work, not chatbot’s purpose.
    (c) Translating programming languages is compiler theory.
    (d) Image recognition is computer vision, not NLP

৪১.
In NLP, "lemmatization" is the process of:
  1. Encrypting text data
  2. Grouping similar words into clusters
  3. Reducing words to their base or dictionary form
  4.  Extracting entities from text
সঠিক উত্তর:
Reducing words to their base or dictionary form
উত্তর
সঠিক উত্তর:
Reducing words to their base or dictionary form
ব্যাখ্যা

Answer: (C) Reducing words to their base or dictionary form
Explanation:
    Lemmatization uses vocabulary + grammar to return the dictionary (lemma) form of a word.
    Example:
    “running” → “run”
    “better” → “good” (uses dictionary knowledge).
    More accurate than stemming (which just chops endings).\

Why others are wrong:
    (a) Encryption ≠ lemmatization.
    (b) Grouping is clustering, not lemmatization.
    (d) Extracting entities is Named Entity Recognition (NER).

৪২.
The primary goal of "speech recognition" in NLP is to:
  1.  Recognize and interpret human speech 
  2.  Improve the quality of digital audio
  3. Translate spoken language into another language
  4. Generate human-like speech from text
সঠিক উত্তর:
 Recognize and interpret human speech 
উত্তর
সঠিক উত্তর:
 Recognize and interpret human speech 
ব্যাখ্যা

Answer: (A) Recognize and interpret human speech
Explanation:
    Speech recognition = Speech-to-Text (STT): converting spoken words into text for processing.
    Example: Dictating to Google Docs → it converts voice into written words.
Why others are wrong:
    (b) Improving audio quality = signal processing.
    (c) Translating speech into another language = speech translation, a higher-level task that uses recognition but is not identical.
    (d) Generating human-like speech = Text-to-Speech (TTS), not recognition

৪৩.
What is an Expert System in the context of Artificial Intelligence?
  1. A system that enhances internet speeds 
  2. A system that manages large databases 
  3. A system designed to emulate human expert decision-making 
  4. A system used for computer hardware improvement
সঠিক উত্তর:
A system designed to emulate human expert decision-making 
উত্তর
সঠিক উত্তর:
A system designed to emulate human expert decision-making 
ব্যাখ্যা

Answer: C) A system designed to emulate human expert decision-making 
T
An Expert System is a branch of AI designed to mimic the decision-making ability of a human expert in a specific domain (e.g., medicine, engineering, troubleshooting).

It consists of:

Knowledge Base → Contains facts and rules of the domain.
Inference Engine → Applies reasoning to draw conclusions from the knowledge base.
User Interface → Allows users to interact with the system.
Example: MYCIN (medical diagnosis), DENDRAL (chemical analysis).
These systems are used when human expertise is scarce or expensive.

৪৪.
In Expert Systems, the component responsible for drawing conclusions is called the:
  1.  Database Manager
  2. Inference Engine
  3.  Network Coordinator
  4. Data Encryption Tool
সঠিক উত্তর:
Inference Engine
উত্তর
সঠিক উত্তর:
Inference Engine
ব্যাখ্যা

Answer: B) Inference Engine 

The Inference Engine is the “brain” of the Expert System.
It applies logical reasoning techniques (like forward chaining or backward chaining) to the Knowledge Base in order to draw conclusions.
Functions of an inference engine:
→ 
Match facts with rules in the knowledge base.
→ Deduce new facts or make decisions.
→ Resolve conflicts when multiple rules are applicable (rule conflict resolution).
Example: In the medical Expert System MYCIN, the inference engine uses medical rules to suggest possible diagnoses and treatments.

(a) Database Manager
A Database Manager is responsible for handling storage, retrieval, and updating of large datasets.
It is part of a DBMS (Database Management System), not an Expert System.
While an Expert System might access databases, the Database Manager doesn’t perform reasoning or decision-making.
 
(c) Network Coordinator
A Network Coordinator would handle tasks like communication, routing, or synchronization in a distributed system or computer network.
It has nothing to do with Expert System reasoning.
Networking and Expert Systems are different domains of computer science.

 (d) Data Encryption Tool
A Data Encryption Tool secures information using cryptographic techniques.
Example: AES, RSA, or SSL protocols.
While encryption ensures data privacy, it does not help in drawing conclusions or reasoning in an Expert System.

৪৫.
Which technology is commonly used in building the knowledge base of an Expert System?
  1. Neural Networks 
  2. Genetic Algorithms 
  3.  Rule-based Systems
  4. Quantum Computing
সঠিক উত্তর:
 Rule-based Systems
উত্তর
সঠিক উত্তর:
 Rule-based Systems
ব্যাখ্যা

 Answer: C) A system designed to emulate human expert decision-making 

An Expert System is a branch of AI designed to mimic the decision-making ability of a human expert in a specific domain (e.g., medicine, engineering, troubleshooting).
It consists of:

Knowledge Base → Contains facts and rules of the domain.
Inference Engine → Applies reasoning to draw conclusions from the knowledge base.
User Interface → Allows users to interact with the system.
Example: MYCIN (medical diagnosis), DENDRAL (chemical analysis).
These systems are used when human expertise is scarce or expensive.

(a) A system that enhances internet speeds
Enhancing internet speeds is related to network optimization and communication protocols (e.g., TCP/IP tuning, congestion control), not Expert Systems.
Expert Systems deal with reasoning and decision-making, not with bandwidth management or network throughput.
 
(b) A system that manages large databases
Managing large databases is the role of Database Management Systems (DBMS) like Oracle, MySQL, or MongoDB.
While an Expert System may use a database to store facts, it is not primarily concerned with database storage, retrieval, or query optimization.
Its main focus is on knowledge representation and inference, not raw data management.
 
 (d) A system used for computer hardware improvement
Hardware improvement is part of computer engineering (like making faster CPUs, GPUs, memory, etc.).
Expert Systems focus on knowledge-based reasoning, not on designing or optimizing hardware circuits.

৪৬.
Computer Vision primarily deals with:
  1.  Making computers understand human languages
  2. Enabling machines to interpret and analyze visual information from the world
  3. Improving network speed
  4. Encrypting visual data
সঠিক উত্তর:
Enabling machines to interpret and analyze visual information from the world
উত্তর
সঠিক উত্তর:
Enabling machines to interpret and analyze visual information from the world
ব্যাখ্যা


Answer: (B) Enabling machines to interpret and analyze visual information from the world
Explanation:
          Computer Vision (CV) is a branch of Artificial Intelligence (AI) that Enabling machines to interpret and analyze visual information from the world much like humans. This tutorial is designed for both beginners and experienced professionals and covers key concepts such as Image Processing, Feature Extraction, Object Detection, Image Segmentation and other core techniques in CV.
 
 A) Making computers understand human languages is →Natural Language Processing (NLP).
 C) is networking, not CV.
 D) relates to cryptography/security, not CV.

৪৭.
Which technique is widely used in Computer Vision for feature extraction?
  1. Convolutional Neural Networks (CNNs)
  2.  Fourier Transform
  3. RSA Algorithm
  4.  Bubble Sort
সঠিক উত্তর:
Convolutional Neural Networks (CNNs)
উত্তর
সঠিক উত্তর:
Convolutional Neural Networks (CNNs)
ব্যাখ্যা

Answer: A) Convolutional Neural Networks (CNNs)
Explanation:
A Convolutional Neural Network (CNN) is a specialized type of artificial neural network designed to process and analyze data with a grid-like structure, such as images. CNNs are widely used in computer vision tasks like image classification, object detection, and facial recognition due to their ability to automatically extract hierarchical features from raw data

B) Fourier Transform → Used in signal/image frequency analysis, but not the modern backbone of CV.
C) RSA → Encryption algorithm, unrelated.
D) Bubble Sort → Sorting algorithm, not CV.