BCA III Semester QP answers
BCA III Semester QP answers
o A class can inherit only one abstract class but can implement
multiple interfaces.
csharp
Copy code
csharp
Copy code
switch (x) {
Example:
csharp
Copy code
class Program {
Here, the Child class inherits the Greet method from the Parent class without
redefining it. This reduces duplication and simplifies maintenance.
Example:
csharp
Copy code
class Complex {
};
class Program {
Example:
csharp
Copy code
class Animal {
Console.WriteLine("Animal sound");
Console.WriteLine("Bark");
class Program {
Here, the Speak method in Dog overrides the Speak method in Animal to
provide a specific behavior for dogs.
html
Copy code
<script>
function validate() {
</script>
<button onclick="validate()">Submit</button>
php
Copy code
<?php
$name = $_POST['name'];
?>
Both scripting types are essential for modern web applications to handle
frontend and backend tasks.
csharp
Copy code
int i = 0;
csharp
Copy code
csharp
Copy code
csharp
Copy code
o continue: Skips the current iteration and moves to the next one.
Example:
csharp
Copy code
interface IAnimal {
void Speak();
Console.WriteLine("Bark");
class Program {
Here, Dog implements the IAnimal interface by defining the Speak() method.
Interfaces allow flexibility and decouple method definitions from
implementations.
Example:
csharp
Copy code
class Program {
try {
int x = 10, y = 0;
} finally {
Console.WriteLine("Execution completed.");
Output:
vbnet
Copy code
Execution completed.
csharp
Copy code
class Calculator {
csharp
Copy code
Example:
csharp
Copy code
class Program {
string s1 = "Hello";
string s2 = "World";