Interview Questions

Software Interview Preparation

BITA Academy will help students to clear their Interviews, we keep updates our interview questions to keep update and clear your interview questions.

 

Selenium Interview Questions

1) What is Selenium and what is composed of? Selenium is a suite of tools for automated web testing.  It is composed of
  • Selenium IDE (Integrated Development Environment) :  It is a tool for recording and playing back.  It is a firefox plugin
  • WebDriver and RC:  It provide the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver and RC works.
  • Grid: With the help of Grid you can distribute tests on multiple machines so that test can be run parallel which helps in cutting down the time required for running in browser test suites
2) How will you find an element using Selenium? In Selenium every object or control in a web page is referred as an elements, there are different ways to find an element in a web page they are
  • ID
  • Name
  • Tag
  • Attribute
  • CSS
  • Linktext
  • PartialLink Text
  • Xpath etc

Java Interview Questions

Q #1) What is JAVA? Ans: Java is a high-level programming language and is platform independent. Java is a collection of objects. It was developed by Sun Microsystems. There are a lot of applications, websites and Games that are developed using Java. Q #2) What are the features in JAVA? Ans: Features of Java:
  • Oops concepts
    • Object-oriented
    • Inheritance
    • Encapsulation
    • Polymorphism
    • Abstraction
  • Platform independent: A single program works on different platforms without any modification.
  • High Performance: JIT (Just In Time compiler) enables high performance in Java. JIT converts the bytecode into machine language and then JVM starts the execution.
  • Multi-threaded: A flow of execution is known as a Thread. JVM creates a thread which is called main thread. The user can create multiple threads by extending the thread class or by implementing Runnable interface.
Q #3) How does Java enable high performance? Ans: Java uses Just In Time compiler to enable high performance. JIT is used to convert the instructions into bytecodes.

Python Interview Questions

1.What is Python?

  • Python is a high-level and object-oriented programming language with unified semantics designed primarily for developing apps and web.
  • It is the core language in the field of Rapid Application Development (RAD) as it offers options such as dynamic binding and dynamic typing
 2.What are the key features of Python?
  • Python is an interpreted language. That means that, unlike languages like C and its variants, Python does not need to be compiled before it is run. Other interpreted languages include PHP and Ruby.
  • Python is dynamically typed, this means that you don’t need to state the types of variables when you declare them or anything like that. You can do things like x=111 and then x="I'm a string" without error
  • Python is well suited to object orientated programming in that it allows the definition of classes along with composition and inheritance. Python does not have access specifiers (like C++’s public, private).
  • In Python, functions are first-class objects. This means that they can be assigned to variables, returned from other functions and passed into functions. Classes are also first class objects
  • Writing Python code is quick but running it is often slower than compiled languages. Fortunately,Python allows the inclusion of C based extensions so bottlenecks can be optimized away and often are. The numpy package is a good example of this, it’s really quite quick because a lot of the number crunching it does isn’t actually done by Python
  • Python finds use in many spheres – web applications, automation, scientific modeling, big data applications and many more. It’s also often used as “glue” code to get other languages and components to play nice.
3.What are the benefits of Python?
  • Speed and Productivity:
  • Extensive Support for Libraries
  • User-friendly Data Structures
  • Existence of Third Party Modules
  • Easy Learning
4.What type of language is python? Programming or scripting?
  • Python is capable of scripting, but in general sense, it is considered as a general-purpose programming language.
  • To know more about Scripting, you can refer to the Python Scripting Tutorial.
5.How is Python an interpreted language?
  • An interpreted language is any programming language which is not in machine level code before runtime.
6.What are the applications of Python?
  • GUI based desktop applications
  • Image processing applications
  • Business and Enterprise applications
  • Prototyping
  • Web and web framework applications
7.Can Python be used for web client and web server side programming? And which one is best suited to Python?
  • Python is best suited for web server-side application development due to its vast set of features for creating business logic, database interactions, web server hosting etc.
  • However, Python can be used as a web client-side application which needs some conversions for a browser to interpret the client side logic. 
  • Also, note that Python can be used to create desktop applications which can run as a standalone application such as utilities for test automation.
8.What is PEP 8?
  • PEP stands for Python Enhancement Proposal. It is a set of rules that specify how to format Python code for maximum readability. 
9.How is memory managed in Python?
  • Memory management in python is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have access to this private heap. The python interpreter takes care of this instead.
  • The allocation of heap space for Python objects is done by Python’s memory manager. The core API gives access to some tools for the programmer to code.
  • Python also has an inbuilt garbage collector, which recycles all the unused memory and so that it can be made available to the heap space.
10.What is namespace in Python?
  • A namespace is a naming system used to make sure that names are unique to avoid naming conflicts.
11.What is PYTHONPATH?
  • It is an environment variable which is used when a module is imported. Whenever a module is imported, PYTHONPATH is also looked up to check for the presence of the imported modules in various directories. The interpreter uses it to determine which module to load. 
12.What are local variables and global variables in Python? 
  • Global Variables: Variables declared outside a function or in global space are called global variables. These variables can be accessed by any function in the program. 
  • Local Variables:Any variable declared inside a function is known as a local variable. This variable is present in the local space and not in the global space. 
13.Explain List, Tuple, Set, and Dictionary and provide at least one instance where each of these collection types can be used.
  • List: Collection of items of different data types which can be changed at run time.
  • Tuple: Collection of items of different data types which cannot be changed. It only has read-only access to the collection. This can be used when you want to secure your data collection set and does not need any modification.
  • Set: Collection of items of a similar data type.
  • Dictionary: Collection of items with key-value pairs.
  • Generally, List and Dictionary are extensively used by programmers as both of them provide flexibility in data collection. 
14.How memory management is done in Python?
  • In Python memory management is done using private heap space. The private heap is the storage area for all the data structures and objects. The interpreter has access to the private heap and the programmer cannot access this private heap.
  • The storage allocation for the data structures and objects in Python is done by the memory manager. The access for some tools is provided by core API for programmers to code.
  • The built-in garbage collector in Python is used to recycle all the unused memory so that it can be available for heap storage area.
15.Is python case sensitive? 
  • Yes. Python is a case sensitive language. 
16.What are the built-in types available in Python? 
  • Integer
  • Complex numbers
  • Floating-point numbers
  • Strings
  • Built-in functions
17.Does Python allow you to program in a structured style?
  • Yes. It does allow to code is a structured as well as Object-oriented style.
  • It offers excellent flexibility to design and implement your application code depending on the requirements of your application.
18.What is PIP software in the Python world?
  • PIP is an acronym for Python Installer Package which provides a seamless interface to install various Python modules.
  • It is a command line tool which can search for packages over the internet and install them without any user interaction.
19.Is indentation required in python?
  • Indentation is necessary for Python. It specifies a block of code. All code within loops, classes, functions, etc is specified within an indented block.
  • It is usually done using four space characters. If your code is not indented necessarily, it will not execute accurately and will throw errors as well.
20.What is the difference between Python Arrays and lists?
  • Arrays and lists, in Python, have the same way of storing data.
  • But, arrays can hold only a single data type elements whereas lists can hold any data type elements.
21.What are functions in Python?
  • A function is a block of code which is executed only when it is called. To define a Python function, the def keyword is used. 
22.How does For loop and While loop differ in Python and when do you choose to use them? 
  • For loop is generally used to iterate through the elements of various collection types such as List, Tuple, Set, and Dictionary.
  • While loop is the actual looping feature that is used in any other programming language.
  • This is how Python differs in handling loops from the other programming languages.
23.How are data types defined in Python and how much bytes do integer and decimal data types hold?
  • In Python, there is no need to define a variable's data type explicitly. Based on the value assigned to a variable, Python stores the appropriate data type.
  • In the case of numbers such as Integer, Float, etc, the length of data is unlimited.
24.How do you make use of Arrays in Python?
  • Python does not support Arrays.
  • However, you can use List collection type which can store an unlimited number of elements.
25.How do you implement JSON given that Python is best suited for the server-side application?
  • Python has built-in support to handle JSON objects.
  • You just have to import the JSON module and use the functions such as loads and dumps to convert from JSON string to JSON object and vice versa.
  • It is a straightforward way to handle and exchange JSON based data from the server-side.
26.What are Python Decorators?
  • Decorator is the most useful tool in Python as it allows programmers to alter the changes in the behavior of class or function.
27.Which databases are supported by Python?
  • MySQL (Structured) and MongoDB (Unstructured) are the prominent databases that are supported natively in Python.
  • Import the module and start using the functions to interact with the database.
28.What is the purpose of _init_() function in Python?
  • It is the first function that gets executed when an object of a class is instantiated.This is equivalent to the constructor concept in C++. 
29.How do we find bugs andstatistical problems in Python? 
  • We can detect bugs in python source code using a static analysis tool named PyChecker.
  • Moreover, there is another tool called PyLint that checks whether the Python modules meet their coding standards or not.
30.What is the difference between .py and .pyc files?
  • .py files are Python source files. .pyc files are the compiled bytecode files that are generated by the Python compiler
31.How do you invoke the Python interpreter for interactive use?
  • By using python or pythonx.y we can invoke Python interpreter. where x.y is the version of the Python interpreter.
32.Define String in Python?
  • String in Python is formed using a sequence of characters. Value once assigned to a string cannot be modified because they are immutable objects. 
  • String literals in Python can be declared using double quotes or single quotes. 
  • Example: 1 2          print("Hi") print('Hi')
33.What do you understand by the term namespace in Python?
  • A namespace in Python can be defined as a system that is designed to provide a unique name for every object in python. Types of namespaces that are present in Python are Local namespace, Global namespace and Built-in namespace
  • Scope of an object in Python: Scope refers to the availability and accessibility of an object in the coding region.
34.What is the significance of ‘self' parameter in an object method? Should we always name this parameter as ‘self'?
  • Parameter ‘self' is used to refer to the object properties of a class. ‘self' parameter is supposed to be prefixed to the class object properties.
  • The answer to the second part of the question is No. ‘self' parameter can have any name.
35.How does Lambda function differ from a normal function in Python?
  • Lambda is similar to the inline function in C programming. It returns a function object. It contains only one expression and can accept any number of arguments. 
  • In case of a normal function, you can define a function name, pass the parameter and mandatorily have a return statement.
  • The Lambda function can be typically used for simple operations without the use of function names. It can also be used in the place of a variable.
36.How is Exception Handling done in Python?
  • There are 3 main keywords i.e. try, except and finally which are used to catch exceptions and handle the recovering mechanism accordingly. Try is the block of a code which is monitored for errors. 
  • Except block gets executed when an error occurs. The beauty of the final block is to execute the code after trying for error. This block gets executed irrespective of whether an error occurred or not.
  • Finally block is used to do the required cleanup activities of objects/variables.
37.How does break, continue and pass work?
  • Break-Allows loop termination when some condition is met and the control is transferred to the next statement.
  • Continue-Allows skipping some part of a loop when some specific condition is met and the control is transferred to the beginning of the loop.
  • Pass-Used when you need some block of code syntactically but you want to skip its execution.This is basically a null operation.Nothing happens when this is executed.
38.What is the difference between range &xrange?
  • For the most part, xrange and range are the exact same in terms of functionality. They both provide a way to generate a list of integers for you to use, however you please. The only difference is that range returns a Python list object and x range returns an xrange object. 
  • This means that xrange doesn’t actually generate a static list at run-time like range does. It creates the values as you need them with a special technique called yielding. This technique is used with a type of object known as generators. That means that if you have a really gigantic range you’d like to generate a list for, say one billion, xrange is the function to use.
  • This is especially true if you have a really memory sensitive system such as a cell phone that you are working with, as range will use as much memory as it can to create your array of integers, which can result in a Memory Error and crash your program. It’s a memory hungry beast.
39.How do you write comments in python?
  • Comments in Python start with a # character. However, alternatively at times, commenting is done using docstrings(strings enclosed within triple quotes). Example: 
  • #Comments in Python start like this print("Comments in Python start with a #") Output:  Comments in Python start with a #
40.What is pickling and unpickling?
  • Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump function, this process is called pickling.
  • While the process of retrieving original Python objects from the stored string representation is called unpickling.
41.What are the generators in python?
  • Functions that return an iterable set of items are called generators.
42.How will you capitalize the first letter of string?
  • In Python, the capitalize() method capitalizes the first letter of a string. If the string already consists of a capital letter at the beginning, then, it returns the original string.
43.How will you convert a string to all lowercase?
  • To convert a string to lowercase, lower() function can be used.
44.How does a function return values?
  • Functions return values using the return statement.
45.Define slicing in Python?
  • Slicing is a procedure used to select a particular range of items from sequence types such as Strings, lists, and so on.
46.Name some of the built-in modules in Python?
  • sys module
  • OS module
  • random module
  • collection module
  • JSON
  • Math module
47.Do we need to call the explicit methods to destroy the memory allocated in Python?
  • Garbage collection is an in-built feature in Python which takes care of allocating and deallocating memory.
  • This is very similar to the feature in Java. Hence, there are very fewer chances of memory leaks in your application code.
48.Does the same Python code work on multiple platforms without any changes?
  • Yes. As long as you have the Python environment on your target platform (Linux, Windows, Mac), you can run the same code.
49.What is the use of Assertions in Python?
  • Assert statement is used to evaluate the expression attached. If the expression is false, then python raised AssertionError Exception.
50.What is the difference between ‘match’ and ‘search’ in Python?
  • Match checks for the match at the beginning of the string whereas search checks for the match anywhere in the string