0% 67 Year1st Year2nd Year3rd Year4th YearStateAndhra PradeshArunachal PradeshAssamBiharChhattisgarhGoaGujaratHaryanaHimachal PradeshJharkhandKarnatakaKeralaMadhya PradeshMaharashtraManipurMeghalayaMizoramNagalandOdishaPunjabRajasthanSikkimTamil NaduTelanganaTripuraUttar PradeshUttarakhandWest Bengal 1 / 20 Category: (Java) 1. What will the following program print? java class Test { public static void main(String[] args) { int x = 10; System.out.println(x++ + ++x); } } A) Compilation error B) 21 C) 22 D) 23 2 / 20 Category: ( C++ ) 2. What will be the result of the following program? #include int main() { int arr[] = {1, 2, 3, 4, 5}; std::cout << arr[2]; return 0; } A) 1 B) 3 C) 5 D) Undefined behavior 3 / 20 Category: (Java) 3. Which of the following best represents "hasa" relationships in Java? A) Composition B) Abstraction C) Polymorphism D) Inheritance 4 / 20 Category: ( C++ ) 4. Which type of memory is managed by std::allocator? A) Memory for global variables B) Dynamic heap memory C) Stack memory D) Constant memory 5 / 20 Category: ( C ) 5. What is the output of the following code? #include int main() { int a = 5; int *p = &a; *p = 10; printf("%d", a); return 0; } A) Compilation error B) Garbage value C) 10 D) 5. 6 / 20 Category: ( C++ ) 6. 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; } A) Only prints "Destructor" B) Prints "ConstructorDestructor" C) Only prints "Constructor" D) Compilation error 7 / 20 Category: (Java) 7. A company requires an interface Employee with a calculateSalary() method for different roles like Manager and Engineer. Which concept is used here? A) Multithreading B) Interface C) Static Polymorphism D) Abstract Class 8 / 20 Category: (Java) 8. What does the following code print? java class Test { public static void main(String[] args) { StringBuilder sb = new StringBuilder("Hello"); sb.insert(0, "Java"); System.out.println(sb); } } A) HelloJava B) Compilation error C) JavaHello D) Java 9 / 20 Category: ( C++ ) 9. What does mutable keyword do? A) Declares a variable in a global scope B) Makes a class method const C) Enables the use of const data members D) Allows modification of a member in a const object 10 / 20 Category: (Java) 10. What happens when Thread.sleep(0) is called? A) The thread sleeps indefinitely. B) The thread yields but does not sleep. C) Causes a compilation error. D) It gives control to other threads of the same priority. 11 / 20 Category: ( C ) 11. Which function is used to convert a string to an integer in C? A) atoi() B) sprintf() C) strcpy() D) strcat() 12 / 20 Category: ( C ) 12. What is the size of a pointer in a 64-bit system? A) 16 bytes B) 4 bytes C) 8 bytes D) Depends on the compiler 13 / 20 Category: ( C ) 13. Which of the following statements about enum in C is true? A) The values of enum start from 1 by default B) enum can define symbolic constants C) enum cannot be used in switch cases D) enum variables store strings 14 / 20 Category: ( C ) 14. What is the output of this program? #include int main() { int arr[3] = {10, 20, 30}; printf("%d", *(arr + 1)); return 0; } A) 20 B) 10 C) 30 D) Compilation error 15 / 20 Category: ( C++ ) 15. Which of the following algorithms is NOT part of STL? A) std::find B) std::search_string C) std::sort D) std::count 16 / 20 Category: ( C++ ) 16. What is the output of this program? #include void print(int x) { std::cout << x; } void print(float x) { std::cout << x; } int main() { print(3.5); return 0; } A) 3.5 B) Undefined behavior C) Compilation error D) 3 17 / 20 Category: ( C++ ) 17. What is the output of this code? int a = 5, b = 10; std::swap(a, b); std::cout << a << " " << b; A) 10 5 B) Compilation error C) Undefined behavior D) 10 5 18 / 20 Category: (Java) 18. Which of the following statements about HashMap is true? A) HashMap is synchronized. B) HashMap allows null keys and null values. C) The iteration order of HashMap is predictable. D) HashMap internally uses LinkedList for collision resolution. 19 / 20 Category: ( C ) 19. What is the output of the following code? #include int main() { int x = 5; printf("%d", x = x == 5); return 0; } A) Undefined behavior B) 1 C) 5 D) 0 20 / 20 Category: (Java) 20. What is the output of the following code? java class Test { public static void main(String[] args) { int[][] arr = {{1, 2}, {3, 4}}; System.out.println(arr[1][1]); } } A) IndexOutOfBoundsException B) 2 C) 4 D) Compilation error Your score is LinkedIn Facebook Twitter VKontakte 0%