April 2023

  • Why java is platform independent?

    The most unique feature of java is platform independent. In any programming language source code is compiled in to executable code . This cannot be run across all platforms. When javac compiles a java program it generates an executable file called .class file. Class file contains byte codes. Byte codes are interpreted only by JVM’s…

  • What is the difference between abstract class and interface ?

    Abstract Class VS Interface Sr. Abstract Class Interface 1 Abstract class can contain abstract methods, concrete methods or both Interface contains only abstract methods 2 Except private we can have any access specifier for methods in abstract class. Access Specifiers for methods in interface must be public 3 Except private variables can have any access…

  • Difference between method overloading and method overriding in java ?

    Method Overloading VS Method Overriding Sr. Method Overloading Method Overriding 1 Method Overloading occurs within the same class Method Overriding occurs between two classes superclass and subclass 2 Since it involves with only one class inheritance is not involved. Since method overriding occurs between superclass and subclass inheritance is involved. 3 In overloading return type…

  • What is super keyword in java ?

    Variables and methods of super class can be overridden in subclass . In case of overriding , a subclass object call its own variables and methods. Subclass cannot access the variables and methods of superclass because the overridden variables or methods hides the methods and variables of super class. But still java provides a way…

  • What is method overriding in java ?

    If we have methods with same signature (same name, same signature, same return type) in super class and subclass then we say subclass method is overridden by superclass. When to use overriding in java If we want same method with different behavior in superclass and subclass then we go for overriding. When we call overridden…

  • How to call one constructor from the other constructor ?

    With in the same class if we want to call one constructor from other we use this() method. Based on the number of parameters we pass appropriate this() method is called. Restrictions for using this method : 1)this must be the first statement in the constructor 2)we cannot use two this() methods in the constructor

  • What are static blocks and static initializers in Java?

    Static blocks or static initializers are used to initialize static fields in java. We declare static blocks when we want to initialize static fields in our class. Static blocks gets executed exactly once when the class is loaded. Static blocks are executed even before the constructors are executed

  • JAVA INTERVIEW QUESTIONS

    JAVA INTERVIEW QUESTIONS

  • HOW TO CREATE A DATABASE IN SQL?

  • THE 12 JYOTIRLINGS OF LORD SHIVA

    The 12 Jyotirlings of Lord Shiva A Jyotirlinga (Sanskrit: ज्योतिर्लिङ्ग, romanized: Jyotirliṅga, lit. ’lingam of light’) or Jyotirlingam, is a devotional representation of the Hindu god Shiva. The word is a Sanskrit compound of jyotis (‘radiance’) and linga (‘sign’). The Legend of the “Jyotirlinga” is mentioned in the Vishnu Purana. When Lord Vishu and Lord Shiva…

  • TOP 5 EXPENSIVE CITIES OF INDIA

    TOP 5 EXPENSIVE CITIES OF INDIA ARE- Expensive cities in India are determined by a few factors such as housing prices, food, lifestyle of people, transport, buying property and the rapid development of the area. Many people in India want to shift from rural to urban areas for jobs and education opportunities. It is important…

  • If you have data with name of customers and their location, which data type will you use to store it in Python?

    In Python, we can use dict data type to store key value pairs. In this example, customer name can be the key and their location can be the value in a dict data type. Dictionary is an efficient way to store data that can be looked up based on a key.

  • What is the output of calling a list variable with a index range in Python?

    Python code output Even though the list has only 2 elements, the call to thelist with index 3 does not give any index error.

  • What are the popular Python libraries used in Data analysis?

    Some of the popular libraries of Python used for Data analysis are: I. Pandas: Powerful Python Data Analysis Toolkit II. SciKit: This is a machine learning library in Python. III. Seaborn: This is a statistical data visualization library in Python. IV. SciPy: This is an open source system for science, mathematics and engineering implemented in…

  • How will you execute a Python script in Unix?

    To execute a Python script in Unix, we need to have Python executor in Unix environment. In addition to that we have to add following line as the first line in a Python script file. #!/usr/local/bin/python This will tell Unix to use Python interpreter to execute the script.

  • What is the improvement in enumerate() function of Python?

    In Python, enumerate() function is an improvement over regular iteration. The enumerate() function returns an iterator that gives (0, item[0]). E.g. >>> thelist=[‘a’,’b’] >>> for i,j in enumerate(thelist): print i,j 0 a 1 b

  • How can we do Functional programming in Python?

    In Functional Programming, we decompose a program into functions. These functions take input and after processing give an output. The function does not maintain any state. Python provides built-in functions that can be used for Functional programming. Some of these functions are: I. Map() II. reduce() III. filter() Event iterators and generators can be used…

  • How will you share variables across modules in Python?

    We can create a common module with variables that we want to share. This common module can be imported in all the modules in which we want to share the variables. In this way, all the shared variables will be in one module and available for sharing with any new module as well.

  • What is the difference between ‘is’ and ‘==’ in Python?

    We use ‘is’ to check an object against its identity. We use ‘==’ to check equality of two objects. E.g. >>> lst = [10,20, 20] >>> lst == lst[:] True >>> lst is lst[:] False

  • How do you profile a Python script?

    Python provides a profiler called cProfile that can be used for profiling Python code. We can call it from our code as well as from the interpreter. It gives use the number of function calls as well as the total time taken to run the script. We can even write the profile results to a…