Explore topic-wise MCQs in Technical Programming.

This section includes 916 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.

601.

What is the type of the elements of array of objects?

A. Class
B. Void
C. String
D. Null
Answer» B. Void
602.

Which among the following is a mandatory condition for array of objects?

A. All the objects should be of different class
B. All the objects should be of same program classes
C. All the objects should be of same class
D. All the objects should have different data
Answer» D. All the objects should have different data
603.

What is array of objects?

A. An array of instances of class represented by single name
B. An array of instances of class represented by more than one name
C. An array of instances which have more than 2 instances
D. An array of instances which have different types
Answer» B. An array of instances of class represented by more than one name
604.

Which operator can be used to free the memory allocated for an object in C++?

A. Free()
B. delete
C. Unallocate
D. Collect
Answer» C. Unallocate
605.

In java, ____________________ takes care of managing memory for objects dynamically.

A. Free collector
B. Dust collector
C. Memory manager
D. Garbage collector
Answer» E.
606.

If an object is declared in a user defined function __________________

A. Its memory is allocated in stack
B. Its memory is allocated in heap
C. Its memory is allocated in HDD
D. Its memory is allocated in cache
Answer» B. Its memory is allocated in heap
607.

The memory allocated for an object ____________________

A. Can be only dynamic
B. Can be only static
C. Can be static or dynamic
D. Can’t be done using dynamic functions
Answer» D. Can’t be done using dynamic functions
608.

Which operator can be used to check the size of an object?

A. sizeof(objectName)
B. size(objectName)
C. sizeofobject(objectName)
D. sizedobject(objectName)
Answer» B. size(objectName)
609.

Which function is called whenever an object goes out of scope?

A. Destructor function
B. Constructor function
C. Delete function
D. Free function
Answer» B. Constructor function
610.

Which among the following keyword can be used to free the allocated memory for an object?

A. delete
B. free
C. either delete or free
D. only delete
Answer» D. only delete
611.

When is the memory allocated for an object gets free?

A. At termination of program
B. When object goes out of scope
C. When main function ends
D. When system restarts
Answer» C. When main function ends
612.

Which keyword among the following can be used to declare an array of objects in java?

A. new
B. create
C. allocate
D. arr
Answer» B. create
613.

Which of the following function can be used for dynamic memory allocation of objects?

A. malloc()
B. calloc()
C. create()
D. malloc() and calloc()
Answer» E.
614.

Using new is type safe as _______________________

A. It require to be specified with type of data
B. It doesn’t require to be specified with type of data
C. It requires the name of data
D. It allocated memory for the data
Answer» C. It requires the name of data
615.

When is the memory allocated for an object?

A. At declaration of object
B. At compile time
C. When object constructor is called
D. When object is initialized to another object
Answer» D. When object is initialized to another object
616.

Where is the memory allocated for the objects?

A. HDD
B. Cache
C. RAM
D. ROM
Answer» D. ROM
617.

What does memory allocation for objects mean?

A. Actual creation and memory allocation for object members
B. Creation of member functions
C. Creation of data members for a class
D. Actual creation and data declaration for object members
Answer» B. Creation of member functions
618.

Can reference to an object be returned from a method?

A. Yes, always possible
B. Yes, but not always
C. No, never possible
D. No, Not possible because referred element would be destroyed
Answer» C. No, never possible
619.

Invoking a method on a particular object is ____________ sending a message to that object.

A. Different from
B. Same as
C. Somewhat similar
D. Part of
Answer» C. Somewhat similar
620.

Java handles memory dynamically and references are deleted as soon as they are out of scope.

A. True
B. False
Answer» B. False
621.

How many objects can be referenced from same variables?

A. One at a time
B. Many at a time
C. Many using array name
D. 7 at max at same time
Answer» B. Many at a time
622.

How to refer to method of nested class?

A. enclosingClassObject.innerClassObject.method();
B. innerClassObject.method();
C. method();
D. depends on where the method is being called
Answer» E.
623.

Which of the members are referred by this pointer usually (Java)?

A. Members of class where this is used
B. Member of the parent class where this is used
C. Members that are passed as argument to the object
D. Pointers are not applicable in java
Answer» B. Member of the parent class where this is used
624.

If a reference variable is declared final then, _________________

A. It can never be reassigned to refer to a different object.
B. It can be assigned to refer to any object anytime
C. It can never be assigned with any object
D. It can be assigned with 2 or more objects simultaneously
Answer» B. It can be assigned to refer to any object anytime
625.

Can a super class object give reference to a subclass method?

A. No, it is not possible
B. Maybe, it is possible
C. No, it’s not possible
D. No, It’s not possible in few cases only
Answer» D. No, It’s not possible in few cases only
626.

Is there any explicit use of pointers in java that would be applicable to objects?

A. Yes, we use reference for this purpose
B. Yes, we use java arrays for this purpose
C. No, implicit pointing is possible
D. No, direct class names should be used
Answer» D. No, direct class names should be used
627.

Does use of object reference in assignment or passing means copy of the object is being used?

A. No, because the copy would create a new temporary variable
B. No, because the copy would not help to make changes to main object
C. Yes, because the reference directly means using address
D. Yes, because the reference directly means the constructors are involved
Answer» D. Yes, because the reference directly means the constructors are involved
628.

Whenever an object is assigned to a variable or passed to a method, ________________

A. Actually the objects aren’t used
B. Actually only the objects are used
C. Actually a pointer to an object is used
D. Actually copy of object is used
Answer» B. Actually only the objects are used
629.

What is reference to an object?

A. It is address of an object
B. It is address of where the variables and methods of object are stored
C. It is pointer having address of an object
D. It is address of only variables and not the methods of an object
Answer» C. It is pointer having address of an object
630.

Passing an object using copy constructor and pass by value are same.

A. True
B. False
Answer» C.
631.

Is it possible that an object of is passed to a function, and the function also have an object of same name?

A. No, Duplicate declaration is not allowed
B. No, 2 objects will be created
C. Yes, Scopes are different
D. Yes, life span is different
Answer» B. No, 2 objects will be created
632.

If an object is passed by address, will be constructor be called?

A. Yes, to allocate the memory
B. Yes, to allocate the memory
C. No, values are copied
D. No, temporary object is created
Answer» D. No, temporary object is created
633.

How many objects can be passed to a function simultaneously?

A. Only 1
B. Only an array
C. Only 1 or an array
D. As many as required
Answer» E.
634.

It is necessary to return the object if it was passed by reference to a function.

A. Yes, since the object must be same in caller function
B. Yes, since the caller function needs to reflect the changes
C. No, the changes are made automatically
D. No, the changes are made explicitly
Answer» D. No, the changes are made explicitly
635.

How many objects can be returned at once?

A. Only 1
B. Only 1
C. Only 16
D. As many as required
Answer» B. Only 1
636.

How to overcome the problem arising due to destruction of temporary object?

A. Overloading insertion operator
B. Overriding functions can be used
C. Overloading parenthesis or returning object
D. Overloading assignment operator and defining copy constructor
Answer» E.
637.

Is the destruction of temporary object safe (while returning object)?

A. Yes, the resources get free to use
B. Yes, other objects can use the memory space
C. No, unexpected side effects may occur
D. No, always gives rise to exceptions
Answer» D. No, always gives rise to exceptions
638.

When an object is returned by a function, a _______________ is automatically created to hold the return value.

A. Temporary object
B. Virtual object
C. New object
D. Data member
Answer» B. Virtual object
639.

Constructor function is not called when an object is passed to a function, will its destructor be called when its copy is destroyed?

A. Yes, depending on code
B. Yes, must be called
C. No, since no constructor was called
D. No, since same object gets used
Answer» C. No, since no constructor was called
640.

If an object is passed by reference, the changes made in the function ___________

A. Are reflected to the main object of caller function too
B. Are reflected only in local scope of the called function
C. Are reflected to the copy of the object that is made during pass
D. Are reflected to caller function object and called function object alsoAre reflected to caller function object and called function object also
Answer» B. Are reflected only in local scope of the called function
641.

Pass by address passes the address of object _________ and pass by reference passes the address of the object _________

A. Explicitly, explicitly
B. Implicitly, implicitly
C. Explicitly, Implicitly
D. Implicitly, explicitly
Answer» D. Implicitly, explicitly
642.

If an object is passed by value, ____________________

A. A new copy of object is created implicitly
B. The object itself is used
C. Address of the object is passed
D. A new object is created with new random values
Answer» B. The object itself is used
643.

In how many ways can an object be passed to a function?

A. 1
B. 2
C. 3
D. 4
Answer» D. 4
644.

A static nested class is _____________ class in behavior that is nested in another _________ class.

A. Top level, top level
B. Top level, low level
C. Low level, top level
D. Low level, low level
Answer» B. Top level, low level
645.

If a declaration of a member in inner class has the same name as that in the outer class, then ________________ enclosing scope.

A. Outer declaration shadows inner declaration in
B. Inner declaration shadows outer declaration in
C. Declaration gives compile time error
D. Declaration gives runtime error
Answer» C. Declaration gives compile time error
646.

How to create object of the inner class?

A. OuterClass.InnerClass innerObject = outerObject.new InnerClass();
B. OuterClass.InnerClass innerObject = new InnerClass();
C. InnerClass innerObject = outerObject.new InnerClass();
D. OuterClass.InnerClass = outerObject.new InnerClass();
Answer» B. OuterClass.InnerClass innerObject = new InnerClass();
647.

A nested class can have its own static members.

A. True
B. False
Answer» C.
648.

How to access static nested classes?

A. OuterClass.StaticNestedClass
B. OuterClass->StaticNestedClass
C. OuterClass(StaticNestedClass)
D. OuterClass[StaticNestedClass].
Answer» B. OuterClass->StaticNestedClass
649.

Which among the following is correct advantage/disadvantage of nested classes?

A. Makes the code more complex
B. Makes the code unreadable
C. Makes the code efficient and readable
D. Makes the code multithreaded
Answer» D. Makes the code multithreaded
650.

Use of nested class ____________ encapsulation.

A. Increases
B. Decreases
C. Doesn’t affect
D. Slightly decreases
Answer» B. Decreases