0%
67

1 / 20

Category: (Java)

1. A school management system has a Person class with Student and Teacher subclasses. Which Java feature allows calling overridden methods at runtime?

2 / 20

Category: ( C++ )

2. What is the result of this code?

#include

int main() {

int x = 10, y = 20;

std::swap(x, y);

std::cout << x << " " << y; return 0; }

3 / 20

Category: ( C++ )

3. What does std::future provide in C++?

4 / 20

Category: (Java)

4. What is the purpose of the ForkJoinPool class?

5 / 20

Category: (Java)

5. In a concurrent program, which ExecutorService method will block until all submitted tasks are complete?

6 / 20

Category: (Java)

6. Which of the following is not a valid reason to use an interface in Java?

7 / 20

Category: ( C )

7. Which of the following is NOT a valid preprocessor directive?

8 / 20

Category: ( C++ )

8. What happens when you try to delete a null pointer in C++?

9 / 20

Category: ( C++ )

9. What will happen when this code runs?

#include

class A {

public:

A() { std::cout << "Constructor"; } ~A() { std::cout << "Destructor"; } }; int main() { A obj; return 0; }

10 / 20

Category: ( C )

10. What will happen with this code?

#include

int main() {

int a = 5 / 0;

printf("%d", a);

return 0;

}

11 / 20

Category: (Java)

11. What will the following program print?
java
class Test {
public static void main(String[] args) {
int x = 10;
System.out.println(x++ + ++x);
}
}

12 / 20

Category: ( C )

12. What is the output of the following code?

#include

int main() {

int a = 5;

int *p = &a;

*p = 10;

printf("%d", a);

return 0;

}

13 / 20

Category: (Java)

13. In an ecommerce system, you want to hide sensitive user details like passwords. Which OOP principle helps achieve this?

14 / 20

Category: ( C++ )

14. What does the following code snippet indicate?

void foo() noexcept { }

15 / 20

Category: ( C++ )

15. What is the output of this code?

#include

int main() {

int arr[] = {10, 20, 30};

int *ptr = arr;

ptr++;

std::cout << *ptr; return 0; }

16 / 20

Category: ( C++ )

16. What is the output of this code?

#include

void display(int x = 10) {

std::cout << x; } int main() { display(); return 0; }

17 / 20

Category: ( C )

17. What will happen with the following code?

#include

int main() {

char str[5] = "hello";

printf("%s", str);

return 0;

}

18 / 20

Category: (Java)

18. In an inventory system, you want to restrict access to methods that update product quantities to only admin users. How can you achieve this in Java?

19 / 20

Category: ( C )

19. What does the following code print?

#include

int main() {

int x = 10;

int y = 5;

printf("%d", x++ + ++y);

return 0;

}

20 / 20

Category: ( C )

20. What is the purpose of the volatile keyword in C?

Scroll to Top