Long Questions (20*2=40 Marks)
1. What types of machine learning tasks are speech recognition and movie rating prediction, respectively?
- Classification and regression
- Regression and classification
- Clustering and regression
- Classification and clustering
Show me the answer
Answer:
- 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?
- A
- B
- AB
- 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?
- 6A
- 8A
- 2A
- 4A
.png)
Show me the answer
Answer:
- 6A
Explanation:
The current through the 10 ohm resistor is given by .
Applying Kirchhoff’s Current Law (KCL) at node 1:
So, .
The voltage drop across the 2 ohm resistor is .
Given , we have:
(since as in parallel).
From the equation , we get:
, which simplifies to:
.
Therefore, the total current .
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?
- 6A
- 8A
- 2A
- 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?
- Negation, AND, OR, Implication, Bidirectional
- AND, Negation, OR, Implication, Bidirectional
- OR, AND, Negation, Implication, Bidirectional
- Bidirectional, AND, OR, Implication, Negation
Show me the answer
Answer:
- Negation, AND, OR, Implication, Bidirectional
Explanation:
The correct order of precedence for logical operators is:
- Negation (highest precedence)
- AND
- OR
- Implication
- Bidirectional (lowest precedence).
6. In a half adder, which logic gate represents the carry?
- OR
- AND
- NAND
- 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?
- 12.9 ms
- 20.9 ms
- 19.9 ms
- 0.01 ms
Show me the answer
Answer:
3. 19.9 ms
Explanation:
The formula for effective access time is:
Substituting the given values:
.
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.
- 9%
- 15%
- 10%
- 20%
Show me the answer
Answer:
4. 20%
Explanation:
The annual depreciation is calculated using the straight-line method, which is:
Given the cost of the equipment is 0, and the useful life is 5 years, the annual depreciation is:
The depreciation percentage is calculated as:
.
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 bits (since 4M = 4 * 1024 * 1024 = ). The number of address lines required to access 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 = 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.
.
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.
Given the preorder traversal 30, 20, 10, 15, 25, 23, 39, 35, 42
, the root node in this case is 30
. In postorder, we will visit all its descendants first, and the last node visited will be the root.
Hence, the last node visited in postorder traversal is 30
.
15. In which region of a positively biased circuit does the Q-point typically lie?
- Saturation
- Active
- Cut-off
- 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?
- Analysis, Design, Testing
- Object-oriented analysis, object-oriented design, object-oriented programming
- Requirement gathering, Implementation, Deployment
- 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?
- Initial state, successor function, goal state, path cost
- Initial state, successor function, goal path, goal test
- Initial state, actions, goal state, search space
- 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?
- Public
- Protected
- Private
- 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?
- Encapsulation
- Inheritance
- Polymorphism
- 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?
- Representational Verification
- Completeness
- Consistency
- Efficiency
Show me the answer
Answer:
- Representational Verification
Explanation:
Properties of knowledge representation include completeness, consistency, and efficiency, but “representational verification” is not a standard property.