Namlatech Campus Drive 2024
Candidate Name: ___________________________________________________________
Degree: ___________________________________________________________________
Contact Number: ____________________________________________________________
Mail id: ____________________________________________________________________
Certifications: _______________________________________________________________
Programming Area of Interest: __________________________________________________
All the Best!
Questions - 45 : Time - 60 Minutes
1. What is the 16-bit compiler allowable range for integer constants?
A) -3.4e38 to 3.4e38, B) -32767 to 32768, C) -32668 to 32667, D) -32768 to 32767
2. What is the output of this statement "printf("%d", (a++))"?
A) The value of (a + 1), B) The current value of a, C) Error message, D) Garbage
3. How many times will the following loop execute?
for(j = 1; j <= 10; j = j-1)
A) Forever, B) Never, C) 0, D) 1
4. A pointer is a memory address. Suppose the pointer variable has p address 1000, and that
p is declared to have type int*, and an int is 4 bytes long. What address is represented by
expression p + 2?
A) 1002, B) 1004, C) 1006, D) 1008
5. What is the result after execution of the following code if a is 10, b is 5, and c is 10?
If ((a > b) && (a <= c))
a = a + 1;
else
c = c+1;
A) a=10, c=10, B) a=11, c=10, C) a=10, c=11, D) a=11, c=11
6. Which one of the following is a loop construct that will always be executed once?
A) for, B) while, C) switch, D) do while
7. How many bytes does "int = D" use?
A) 0, B) 1, C) 2 or 4, D) 10
@ Namlatech India Private Limited
8. Which of the following will copy the null-terminated string that is in array src into array dest?
A) dest = src; B) dest == src; C) strcpy(dest, src); D) strcpy(src, dest);
9. How many instances of a class can be declared?
A) 1, B) 10, C) As per required, D) None of the these
10. What will be the result of the num variable after execution of the following statements?
int num = 58;
num % = 11;
A) 3, B) 5, C) 8, D) 11
11. What does this statement mean? x - = y + 1;
A) x = x - y + 1, B) x = -x - y - 1, C) x = x + y - 1, D) x = x - y - 1
12. Array is a _________ data structure.
A) Non-linear, B) Primary, C) Linear, D) Data type
13. Which of the following statements is correct about the C language?
A) The C language is a binary language with some extra features.
B) The C language is a high-level language with some low features.
C) The C language is a mid-level language with some high features.
D) The C language is a low-level language.
14. A global variable is declared __________.
A) Outside of the function, B) Inside of the function, C) With the function
D) Anywhere in the program
15. Which of the following functions is already declared in the "header file"?
A) User-define function, B) Built-in function, C) C function, D) None of the these
16. Which of the following operations cannot be performed in file handling?
A) Open the file, B) Read the file, C) To write a file, D) None of the these
17. Study the following program:
#include <stdio.h>
int main() {
int i = 5;
printf("%d", i = ++i == 6);
return 0;
}
@ Namlatech India Private Limited
What will be the output of this program?
A) 2, B) 6, C) 4, D) 1
18. In which of the following modes, the user can read and write the file?
A) r, B) w, C) r+, D) B+
19. How many types of variables are there in the C language?
A) 2, B) 4, C) 1, D) 5
20. Which of the following initializations is incorrect in C language?
A) char str [40] = "YUGAL"; B) char str [] = {'Y','U','G','A','L','\ 0'};
C) char str [40] = {'Y','U','G','A','L','\ 0'}; D) None of the these
21. What is the implicit return type of constructor?
A) No return type, B)A class object in which it is defined, C)void, D)None
22. When is the object created with a new keyword?
A) At run time, B) At compile time, C) Depends on the code, D) None
23. Which of the following is not an OOPS concept?
A) Encapsulation, B) Polymorphism, C) Exception, D) Abstraction
24. Which feature of OOPS described the reusability of code?
A) Abstraction, B) Encapsulation, C) Polymorphism, D) Inheritance
25. Which among the following feature is not in the definition of OOPS?
A) Modularity, B) Efficient Code, C) Code reusability, D) Duplicate or Redundant Data
26. Which feature of OOPS derives the class from another class?
A) Inheritance, B) Data hiding, C) Encapsulation, D) Polymorphism
27. A single program of OOPS contains _______ classes?
A) Only 1, B) Only 999, C) Only 100, D) Any number
28. Which operator from the following can be used to illustrate the feature of polymorphism?
A)Overloading << B)Overloading && C)Overloading | | D)Overloading +=
29. Which two features of object-oriented programming are the same?
A) Abstraction and Polymorphism features are the same
B) Inheritance and Encapsulation features are the same
C) Encapsulation and Polymorphism features are the same
D) Encapsulation and Abstraction
@ Namlatech India Private Limited
30. Which of the following definitions is incorrect for polymorphism?
A) Polymorphism helps in redefining the same functionality
B) Polymorphism concept is the feature of object-oriented programming
C) It always increases the overhead of function definition
D) Ease in the readability of the program
31. Which among the following cannot be used for the concept of polymorphism?
A) Static member function, B) Constructor Overloading,
C) Member function overloading, D) Global member function
32. What is false about constructors?
A) Constructors cannot be synchronized in Java
B) Java does not provide default copy constructor
C) Constructor can have a return type
D) “this” and “super” can be used in a constructor
33. Abstract class cannot have a constructor.
A) True, B) False
34. If a class inheriting an abstract class does not define its function then it will be known as?
A) Abstract, B) A simple class, C) Static class, D) None of the mentioned
35. An interface in Java is like a
A) abstract class, B) public class, C) inner class, D) anonymous class
36. Choose a correct statement about Java Interfaces?
A) Interface contains only abstract methods by default.
B) A Java class can implement multiple interfaces
C) An Interface can extend or inherit another Interface,
D) All the above
37. Which among the following best describes encapsulation?
A) It is a way of combining various data members into a single unit
B) It is a way of combining various member functions into a single unit
C) It is a way of combining various data members and member functions into a single unit
which can operate on any data
D) It is a way of combining various data members and member functions that operate on
those data members into a single unit
38. While using encapsulation, which among the following is possible?
A) Code modification can be additional overhead
B) Data member’s data type can be changed without changing any other code
C) Data member’s type can’t be changed, or whole code have to be changed
D) Member functions can be used to change the data type of data members
39. Find which of the following uses encapsulation?
A) void main(){ int a; void fun( int a=10; cout<<a); fun(); }
B) class student{ int a; public: int b;};
C) class student{int a; public: void disp(){ cout<<a;} };
D) struct topper{ char name[10]; public : int marks; }
@ Namlatech India Private Limited
40.A class member declared protected becomes a member of a subclass of which type?
A) public member, B) private member, C) protected member, D) static member
41. An abstract class in Java usually contains one or more abstract ____
A) constructors, B) methods, C) variables, D) None
42.Choose a correct statement about abstract classes?
A) An abstract class can extend a concrete class
B) An abstract class can extend another abstract class
C) An abstract class can implement any number of interfaces.
D) All the above.
43. Which polymorphism concept is applied to inheritance relationships in java programming?
A) Method overloading, B) Constructor overloading, C) Method overriding, D).None
44.What concepts come under Polymorphism in java?
A) Method overloading, B) Constructor overloading, C) Method overriding D).All the above
45.What is the output of the below Java program with an Interface?
interface Bus
{
void move();
}
class ElectricBus implements Bus
{
public void move()
{
System.out.println("Implemented move() method.");
}
}
public class InterfaceTest1
{
public static void main(String[] args)
{
new ElectricBus().move();
}
}
A) No output, B) Implemented move() method, C) Compiler error,
D) None of the above
The End!
@ Namlatech India Private Limited