Long Questions (20*2=40 Marks)

1. What types of machine learning tasks are speech recognition and movie rating prediction, respectively?

  1. Classification and regression

  2. Regression and classification

  3. Clustering and regression

  4. Classification and clustering

Show me the answer

Answer:

  1. Classification and regression

Explanation: Speech recognition is a classification task, where the model classifies audio signals into specific words or phrases. Movie rating prediction, on the other hand, is a regression task because it involves predicting a continuous value (the rating) based on input features.


Question 2: In C++, what is the output of the following code snippet?

  1. A

  2. B

  3. AB

  4. no output

class A {
public:
    virtual void display() {
        cout << "A";
    }
};

class B : public A {
public:
    void display() override {
        cout << "B";
    }
};

int main() {
    A* ptr = new B();
    ptr->display();
    delete ptr;
    return 0;
}
Show me the answer

Answer: 2. B

Explanation: The pointer ptr is of type A* but points to an object of type B. Since display() is a virtual function, the overridden version in class B is called, and the output is "B".

3. What is the value of the current I when v = 12V and v1 = 20V?

  1. 6A

  2. 8A

  3. 2A

  4. 4A

Show me the answer

Answer:

  1. 6A

Explanation: The current through the 10 ohm resistor is given by v110=2A\frac{v1}{10} = 2A.

Applying Kirchhoff's Current Law (KCL) at node 1: i5=i10+i2i5 = i10 + i2 So, i2=i52i2 = i5 - 2.

The voltage drop across the 2 ohm resistor is 2×i22 \times i2.

Given V1=20VV1 = 20V, we have: v2=20(2×i2)v2 = 20 - (2 \times i2) (since v2=vv2 = v as in parallel).

From the equation v=12Vv = 12V, we get: 12=20(2×i2)12 = 20 - (2 \times i2), which simplifies to: i2=4Ai2 = 4A.

Therefore, the total current I=i5=i2+2=6AI = i5 = i2 + 2 = 6A.

4. Given the production rules: Rule 1: S -> aSb and S -> e Rule 2: R -> cRd and R -> e How many production rules start with different alphabets in S union R?

  1. 6A

  2. 8A

  3. 2A

  4. 4A

Show me the answer

Answer: 3. 2A

Explanation: The production rules for S are:

  • S -> aSb

  • S -> e

The production rules for R are:

  • R -> cRd

  • R -> e

In total, there are two different starting alphabets: 'a' for S and 'c' for R. So, there are 2 production rules that start with different alphabets.

5. What is the correct order of precedence for logical operators?

  1. Negation, AND, OR, Implication, Bidirectional

  2. AND, Negation, OR, Implication, Bidirectional

  3. OR, AND, Negation, Implication, Bidirectional

  4. Bidirectional, AND, OR, Implication, Negation

Show me the answer

Answer:

  1. Negation, AND, OR, Implication, Bidirectional

Explanation: The correct order of precedence for logical operators is:

  1. Negation (highest precedence)

  2. AND

  3. OR

  4. Implication

  5. Bidirectional (lowest precedence).


6. In a half adder, which logic gate represents the carry?

  1. OR

  2. AND

  3. NAND

  4. NOT

Show me the answer

Answer: 2. AND

Explanation: In a half adder, the carry output is generated by an AND gate, which computes the carry bit from the two input bits.


7. In the demand paging memory, a page table is held in registers. If it takes 1000 ms to service a page fault and if the memory access time is 10 ms, what is the effective access time for a page fault rate of 0.01?

  1. 12.9 ms

  2. 20.9 ms

  3. 19.9 ms

  4. 0.01 ms

Show me the answer

Answer: 3. 19.9 ms

Explanation: The formula for effective access time is: EAT=(1page fault rate)×memory access time+(page fault rate)×(page fault service time+memory access time)\text{EAT} = (1 - \text{page fault rate}) \times \text{memory access time} + (\text{page fault rate}) \times (\text{page fault service time} + \text{memory access time})

Substituting the given values: EAT=(10.01)×10+0.01×(1000+10)=9.9+10.1=19.9ms\text{EAT} = (1 - 0.01) \times 10 + 0.01 \times (1000 + 10) = 9.9 + 10.1 = 19.9 \, \text{ms}.

8. A company purchases a piece of equipment for $10,000. The equipment has a useful life of 5 years with no salvage value at the end of its useful life. Calculate the annual depreciation percentage.

  1. 9%

  2. 15%

  3. 10%

  4. 20%

Show me the answer

Answer: 4. 20%

Explanation: The annual depreciation is calculated using the straight-line method, which is: Annual Depreciation=Cost of EquipmentSalvage ValueUseful Life\text{Annual Depreciation} = \frac{\text{Cost of Equipment} - \text{Salvage Value}}{\text{Useful Life}}

Given the cost of the equipment is $10,000, the salvage value is $0, and the useful life is 5 years, the annual depreciation is: Annual Depreciation=10,0005=2,000\text{Annual Depreciation} = \frac{10,000}{5} = 2,000

The depreciation percentage is calculated as: Depreciation Percentage=Annual DepreciationCost of Equipment×100\text{Depreciation Percentage} = \frac{\text{Annual Depreciation}}{\text{Cost of Equipment}} \times 100 Depreciation Percentage=2,00010,000×100=20%\text{Depreciation Percentage} = \frac{2,000}{10,000} \times 100 = 20\%.

9. What does the C function call fwrite(str, strlen(str) + 1, 1, filePointer) do?

a) Prints all string characters including the null character b) Prints all string characters except the null character c) Writes the length of the string to the file d) Writes the string length plus one to the file

Show me the answer

Answer: a) Prints all string characters including the null character

Explanation: The fwrite function in C writes the specified number of bytes from str to the file. By using strlen(str) + 1, the null terminator \0 is included, so it writes the entire string, including the null character.

10. What do building codes and bylaws primarily represent?

a) Design standards b) Construction materials c) Environmental regulations d) Safety procedures

Show me the answer

Answer: a) Design standards

Explanation: Building codes and bylaws primarily define design standards, specifying how buildings and structures should be constructed to ensure safety, accessibility, and environmental compatibility.

11. For a 4M-bit chip with 19 external connectors and 8-bit data lines, how many address lines are there?

a) 8 b) 16 c) 19 d) 20

Show me the answer

Answer: a) 8

Explanation: Chip organization: 4M-bit

  • Total external connections: 19

  • Data lines: 8

  • A 4M-bit chip has 2222^{22} bits (since 4M = 4 * 1024 * 1024 = 2222^{22}). The number of address lines required to access 2222^{22} bits is 22.

  • Out of the 19 external connections, 8 are data lines, leaving 11 for address lines and control signals.

  • Since 8 data lines require 3 bits to represent 232^3 = 8 possible values, subtracting 3 from the 11 remaining connections gives 8 address lines.

12. What is the result of 64 mod 23?

a) 18 b) 20 c) 21 d) 23

Show me the answer

Answer: a) 18

Explanation: The modulus operation returns the remainder of a division. 64mod23=64(23×2)=6446=1864 \mod 23 = 64 - (23 \times 2) = 64 - 46 = 18.

13. In a class B amplifier, what happens to voltage gain and impedance when capacitance is added to the emitter terminal?

a) Both voltage gain and impedance increase b) Voltage gain increases, impedance decreases c) Voltage gain decreases, impedance increases d) Both voltage gain and impedance decrease

Show me the answer

Answer: a) Both voltage gain and impedance increase

Explanation: When capacitance is added to the emitter terminal of a class B amplifier, it reduces the bypass effect, which can increase both the voltage gain and the impedance.

14. In a tree traversal problem, which node is visited last in postorder when converting from preorder 30, 20, 10, 15, 25, 23, 39, 35, 42?

a) 10 b) 15 c) 23 d) 30

Show me the answer

Answer: d) 30

Explanation: In postorder traversal, nodes are visited in the order: left subtree, right subtree, and then the root.

15. In which region of a positively biased circuit does the Q-point typically lie?

  1. Saturation

  2. Active

  3. Cut-off

  4. Center

Show me the answer

Answer: 4. Center

Explanation: In a positively biased circuit, the Q-point typically lies at the center of the load line to allow maximum signal swing without distortion.

16. What are the three main phases of object-oriented development?

  1. Analysis, Design, Testing

  2. Object-oriented analysis, object-oriented design, object-oriented programming

  3. Requirement gathering, Implementation, Deployment

  4. Planning, Execution, Maintenance

Show me the answer

Answer: 2. Object-oriented analysis, object-oriented design, object-oriented programming

Explanation: The three main phases of object-oriented development are:

  • Object-oriented analysis: Identifying the objects and their relationships.

  • Object-oriented design: Defining the object model and design structure.

  • Object-oriented programming: Implementing the design using object-oriented languages.

17. What are the key components of a search problem in artificial intelligence?

  1. Initial state, successor function, goal state, path cost

  2. Initial state, successor function, goal path, goal test

  3. Initial state, actions, goal state, search space

  4. Initial state, goal state, heuristic function, solution

Show me the answer

Answer: 2. Initial state, successor function, goal path, goal test

Explanation: A search problem in AI typically consists of:

  • Initial state: The starting point of the search.

  • Successor function: A function that generates the possible next states.

  • Goal path: The path from the initial state to the goal.

  • Goal test: A method to check if the current state is the goal state.

18. What is the default access specifier for data members in a C++ class?

  1. Public

  2. Protected

  3. Private

  4. None

Show me the answer

Answer: 3. Private

Explanation: In C++, if no access specifier is provided, the default access specifier for data members of a class is private.

19. What concept in object-oriented programming allows objects of different classes to be treated as objects of a common base class?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

Show me the answer

Answer: 3. Polymorphism

Explanation: Polymorphism allows objects of different classes to be treated as objects of a common base class, enabling dynamic method invocation.

20. Which is not a property of representation of knowledge?

  1. Representational Verification

  2. Completeness

  3. Consistency

  4. Efficiency

Show me the answer

Answer:

  1. Representational Verification

Explanation: Properties of knowledge representation include completeness, consistency, and efficiency, but "representational verification" is not a standard property.

Last updated