Week-01 July22
Week-01 July22
QUESTION 1:
a. Inheritance
b. Abstraction
c. Polymorphism
d. Overloading
Correct Answer: b
Detailed Solution:
Abstraction in Java implies defining a class encapsulation both data and method.
____________________________________________________________________________
QUESTION 2:
Correct Answer: d
Detailed Solution:
It is a way of combining both data members and member functions, which operate on those data
members, into a single unit. We call it a class in OOP generally. This feature has helped us
modify the structures used in C language to be upgraded into classes in C++ and JAVA
language.
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
___________________________________________________________________________
QUESTION 3:
Correct Answer: a
Detailed Solution:
The data prone to change in near future is usually encapsulated so that it doesn’t get changed
accidentally. We encapsulate the data to hide the critical working of program from outside world.
___________________________________________________________________________
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 4:
import java.io.*;
class Q
{
public static void swap(int x, int y)
{
int temp;
temp = x;
y = x;
y = temp;
System.out.print(x + " " + y);
}
public static void main(String[] args)
{
int x = 100;
int y = 10;
swap(x, y);
}
}
Correct Answer: d
Detailed Solution:
As per the program, the answer should be 100 100, since the variables are not really swapped
due to an intentional flawed logic.
_________________________________________________________
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 5:
Correct Answer: c
Detailed Solution:
Refer to the lectures
________________________________________________________________________
QUESTION 6:
a. Generic programming and function overloading are very similar to each other.
b. With method overloading you can pass any type of data argument but with generic programming
it is limited.
c. For generic programming to work, multiple functions of the same logic need to be created for
different data types.
d. Method overriding is a fancy name for method overloading.
Correct Answer: a
Detailed Solution:
Refer to the Lecture 2 of Week-1
___________________________________________________________________________
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
QUESTION 7:
class DemoClass<T> {
void genericPrint(_____)
{
System.out.println(t);
}
public static void main (String[] args) {
DemoClass obj = new DemoClass();
obj.genericPrint("HI");
obj.genericPrint(1000);
}
}
Correct Answer: d
Detailed Solution:
Refer to Lecture 2 of week-1
___________________________________________________________________________
QUESTION 8:
Correct Answer: a
Detailed Solution:
Refer to Lecture 2 of Week-1
NPTEL Online Certification Courses
Indian Institute of Technology Kharagpur
___________________________________________________________________________
QUESTION 9:
a. Lower bound
b. Upper bound
c. Middle bound
d. None of the above.
Correct Answer: b
Detailed Solution:
Refer to Lecture 5 of Week-1
___________________________________________________________________________
QUESTION 10:
a. Because it's a really hot topic in this era, like Machine Learning, Deep Learning.
b. Because it's an ancient topic and we should know the history of computers
c. It is essential for developing a large, complex and critical software.
d. Data structures help us organize and access different types of data in the most efficient format
according to our needs.
Correct Answer: c, d
Detailed Solution:
The concept od data structures is essential to develop large, complex and critical software. Also,
data structures help to organize and access different types of data in the most efficient ways.
___________________________________________________________________________
************END************