Ninja
100+ Ninja Interview Questions and Answers
Q51. Features of Django Explain your final year project What is meta class What is transaction
Django is a high-level Python web framework known for its simplicity and flexibility.
Django is known for its built-in features like authentication, URL routing, template engine, and ORM.
Final year project likely involved building a web application using Django.
Meta class in Django is used to define custom behavior for models, forms, and views.
Transactions in Django are used to ensure the atomicity of database operations.
Q52. What is singleton class
A singleton class is a class that can only have one instance created at a time.
Singleton classes are often used for logging, caching, database connections, and thread pools.
They have a private constructor to prevent multiple instances from being created.
They provide a global point of access to the instance.
Q53. What is DBMS?
DBMS stands for Database Management System. It is a software system that manages and organizes data in a database.
DBMS is used to create, modify, and delete databases and their objects.
It provides a way to store and retrieve data efficiently.
Examples of DBMS include MySQL, Oracle, and Microsoft SQL Server.
Q54. what is git and github, how to use it
Git is a version control system that tracks changes in code, while GitHub is a platform for hosting and collaborating on Git repositories.
Git is a distributed version control system used to track changes in code.
GitHub is a web-based platform for hosting Git repositories and collaborating with others.
To use Git, you can initialize a repository, add files, commit changes, create branches, merge branches, and push changes to a remote repository.
GitHub provides features like pul...read more
Q55. 3) What is malloc and calloc?
malloc and calloc are functions used for dynamic memory allocation in C programming language.
malloc() allocates a block of memory of specified size and returns a pointer to the first byte of the allocated memory.
calloc() allocates a block of memory of specified size and initializes all the bytes to zero.
Both functions are used to allocate memory dynamically during runtime.
The memory allocated by these functions must be freed using the free() function to avoid memory leaks.
Q56. SQL Query to create a table of Employees ?
SQL query to create a table of Employees
Use CREATE TABLE statement
Specify column names and data types
Add any constraints like primary key or foreign key if needed
Share interview questions and help millions of jobseekers 🌟
Q57. Polymorphism It's types
Polymorphism refers to the ability of objects to take on multiple forms.
Polymorphism can be achieved through method overloading and method overriding.
Method overloading allows multiple methods with the same name but different parameters.
Method overriding allows a subclass to provide its own implementation of a method already defined in its superclass.
Polymorphism allows for more flexible and reusable code.
Example: Animal class with a method called makeSound(). Subclasses like...read more
Q58. What will be the output of null==null ?
The output of null==null is true.
In Java, comparing two null values using the == operator will return true.
This is because null is a special literal that represents a reference with no value.
Example: Boolean result = (null == null); // result will be true
Ninja Jobs
0Q59. Check if a node is present in level sorted Binary Tree
Check if a node is present in level sorted Binary Tree
Traverse the tree level by level
Use a queue to store the nodes at each level
Check if the node is present in the current level
If not, move to the next level
Repeat until the node is found or all levels are traversed
Q60. what is diff b/w c and c++
C++ is an extension of C with added features like object-oriented programming, templates, and exception handling.
C++ supports object-oriented programming while C does not.
C++ has templates for generic programming while C does not.
C++ has exception handling while C does not.
C++ has a standard library that includes the C standard library.
C++ allows function overloading while C does not.
Q61. Any location preferences?
I prefer locations with a vibrant gaming community and good internet connectivity.
Preferably in a city with a lot of gaming events and tournaments
Good internet connectivity is a must-have for streaming and online gaming
Examples: Los Angeles, Tokyo, Seoul
Q62. What is big data?
Big data refers to large and complex data sets that cannot be processed using traditional data processing methods.
Big data involves the collection, storage, and analysis of massive amounts of data
It requires advanced technologies and tools to process and make sense of the data
Examples of big data include social media data, sensor data, and financial transaction data
Q63. Find the maximum element from a given list
To find the maximum element from a given list.
Iterate through the list and compare each element with a variable storing the maximum value.
Update the variable if a larger element is found.
Return the maximum value at the end.
Q64. what is the computer networking
Computer networking is the practice of connecting devices together to share resources and communicate with each other.
Computer networking involves the use of hardware and software to connect devices together, such as computers, printers, and servers.
Networking protocols, such as TCP/IP, are used to facilitate communication between devices.
Examples of computer networking include local area networks (LANs), wide area networks (WANs), and the internet.
Networking can also involve...read more
Q65. linear search algorithm in python
Linear search algorithm in Python is a simple search algorithm that sequentially checks each element in a list until a match is found or the whole list has been searched.
Iterate through each element in the list
Compare the current element with the target value
Return the index if a match is found, otherwise return -1
Q66. what are hashmaps?
Hashmaps are data structures that store key-value pairs and allow for efficient retrieval of values based on keys.
Hashmaps are also known as dictionaries or associative arrays.
Keys in a hashmap must be unique, but values can be duplicated.
Example: {"apple": 5, "banana": 3, "orange": 7}
Q67. Can you bring it in 3 hours?
Yes, I can bring it in 3 hours.
I have the necessary resources and skills to complete the task within the given time frame.
I will prioritize the task and work efficiently to ensure it is completed on time.
For example, I have successfully completed similar tasks within tight deadlines in the past.
Q68. Why TCS?
TCS is a global IT services company with a strong reputation for innovation and customer satisfaction.
TCS has a proven track record of delivering high-quality IT services to clients around the world.
TCS is known for its innovative approach to technology and its ability to stay ahead of the curve.
TCS has a strong focus on customer satisfaction and works closely with clients to understand their needs and deliver customized solutions.
TCS offers a wide range of services, includin...read more
Q69. Code to write Armstrong number.
Armstrong number is a number that is equal to the sum of its own digits each raised to the power of the number of digits.
Iterate through each digit of the number
Raise each digit to the power of the number of digits
Sum up the results
Check if the sum is equal to the original number
Q70. Difference between C & C++
C++ is an extension of C with object-oriented programming features.
C++ supports classes and objects while C does not.
C++ has better support for polymorphism and inheritance.
C++ has a standard template library (STL) which provides useful data structures and algorithms.
C++ allows function overloading while C does not.
C++ has exception handling while C does not.
Q71. function in python? syntax
Function in Python is a block of reusable code that performs a specific task.
Functions are defined using the 'def' keyword followed by the function name and parentheses.
Functions can take parameters and return values.
Syntax: def function_name(parameters):
Q72. What is virtual memory?
Virtual memory is a memory management technique that allows a computer to use more memory than is physically available.
Virtual memory is a combination of physical memory (RAM) and disk space.
It allows programs to run as if they have more memory than is actually available.
When the physical memory is full, the operating system moves some data from RAM to the hard disk, freeing up space for other programs.
Virtual memory helps in multitasking by allowing multiple programs to run ...read more
Q73. What is object oriented programming?
Object oriented programming is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
Objects are instances of classes, which define the structure and behavior of the objects.
Encapsulation, inheritance, and polymorphism are key principles of object oriented programming.
Example: In a banking system, a 'Customer' class can have data fields like name and account balance, and methods like deposit and...read more
Q74. Explain block diagram of your project?
The block diagram of the project visually represents the flow of information and processes within the system.
The block diagram typically consists of blocks representing different components or processes
Arrows indicate the flow of information or signals between the blocks
Each block may have inputs and outputs that connect to other blocks
Example: In a robotic arm project, blocks could represent sensors, actuators, and control algorithms
Q75. What are pointers?
Pointers are variables that store memory addresses of other variables. They allow direct manipulation of memory.
Pointers are declared using the * symbol.
They can be used to pass variables by reference.
Pointers can be used to dynamically allocate memory.
Example: int *ptr; ptr = # *ptr = 10;
Example: void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; }
Q76. What is an array?
An array is a collection of elements of the same data type, stored in contiguous memory locations.
Arrays can be of any data type, including integers, floats, and objects.
Elements in an array can be accessed using their index number.
Arrays can be multidimensional, with each dimension representing a different set of elements.
Arrays can be dynamically resized in some programming languages.
Example: string[] names = {"John", "Jane", "Bob"};
Q77. program to write character occurance in astring
Program to count character occurrences in a string
Iterate through the string and count occurrences of each character
Use a dictionary to store character counts
Return the dictionary with character counts
Q78. 2) Difference between array and pointer.
Array is a collection of similar data types while pointer is a variable that stores the memory address of another variable.
Array name represents the base address of the array while pointer stores the address of a variable.
Array size is fixed while pointer size depends on the data type it points to.
Array elements can be accessed using index while pointer needs to be dereferenced to access the value.
Example: char arr[5] = {'a', 'b', 'c', 'd', 'e'}; char *ptr = arr;
Example: int ...read more
Q79. What is Inheritance ?
Inheritance is a concept in object-oriented programming where a class can inherit properties and methods from another class.
Allows a class to use properties and methods of another class
Promotes code reusability and reduces redundancy
Types of inheritance include single, multiple, multilevel, and hierarchical
Example: Class 'Car' can inherit properties and methods from class 'Vehicle'
Q80. What is OOPS concept?
OOPS concept stands for Object-Oriented Programming System. It is a programming paradigm based on the concept of objects.
OOPS focuses on creating objects that contain data in the form of attributes and code in the form of methods.
Encapsulation, inheritance, polymorphism, and abstraction are the four main principles of OOPS.
Example: Inheritance allows a class to inherit properties and behavior from another class, promoting code reusability.
Q81. merge sort program in python
Merge sort is a popular sorting algorithm that divides the array into two halves, sorts them separately, and then merges them back together.
Divide the array into two halves recursively until each subarray has only one element
Merge the sorted subarrays back together in a sorted manner
Time complexity of merge sort is O(n log n)
Example: def merge_sort(arr): ...
Q82. What is dbms , Sql query
DBMS stands for Database Management System. SQL is a programming language used to manage and manipulate data in a DBMS.
DBMS is a software system that allows users to create, manage, and manipulate databases.
SQL is used to communicate with a DBMS and perform tasks such as querying, inserting, updating, and deleting data.
Examples of popular DBMS include MySQL, Oracle, and Microsoft SQL Server.
Examples of SQL queries include SELECT, INSERT, UPDATE, and DELETE statements.
Q83. What is negative indexing?
Negative indexing is accessing an array from the end instead of the beginning.
Negative indexing starts from -1 and goes backwards.
It is useful when you want to access the last element of an array without knowing its length.
Example: arr[-1] returns the last element of the array arr.
Example: arr[-2] returns the second last element of the array arr.
Q84. Write a program on reverse of number?
A program to reverse a given number.
Take input number from user
Initialize a variable to store the reversed number
Extract the last digit of the input number using modulo operator and add it to the reversed number
Remove the last digit from the input number using integer division
Repeat the above two steps until input number becomes zero
Print the reversed number
Q85. Polymorphism examples
Polymorphism is the ability of an object to take on many forms. It allows objects of different classes to be treated as the same type.
Polymorphism is achieved through method overriding and method overloading.
Example of method overriding: a superclass Animal with a method 'makeSound', and subclasses Dog and Cat that override the 'makeSound' method.
Example of method overloading: a class Calculator with multiple methods named 'add' that accept different parameters.
Polymorphism p...read more
Q86. Give me unique values in a column (sql)
Use the DISTINCT keyword in SQL to retrieve unique values in a column.
Use the SELECT DISTINCT statement followed by the column name to retrieve unique values.
For example, SELECT DISTINCT column_name FROM table_name;
You can also use GROUP BY to get unique values in a column.
Q87. How to create a table in SQL
To create a table in SQL, you can use the CREATE TABLE statement.
Use the CREATE TABLE statement followed by the table name and column definitions
Specify the data type for each column
Add any constraints such as primary key or foreign key
Example: CREATE TABLE employees (id INT PRIMARY KEY, name VARCHAR(50), department_id INT)
Q88. Swap 2 numbers without 3rd variable
To swap two numbers without a third variable, use arithmetic operations.
Use addition and subtraction to swap the numbers
Example: a = 5, b = 10. a = a + b (a = 15), b = a - b (b = 5), a = a - b (a = 10)
Q89. Explain project , write code for arrays in c++
Code for arrays in C++
Declare an array using data type and size
Access array elements using index
Loop through array using for loop
Example: int arr[5] = {1, 2, 3, 4, 5};
Example: for(int i=0; i<5; i++) { cout << arr[i] << endl; }
Q90. Http https difference
HTTP is unsecured protocol while HTTPS is secured with SSL/TLS encryption.
HTTP stands for Hypertext Transfer Protocol and is used for transmitting data over the internet.
HTTPS stands for Hypertext Transfer Protocol Secure and adds a layer of security using SSL/TLS encryption.
HTTPS is used for secure online transactions, login pages, and any other sensitive data.
HTTP is vulnerable to attacks like man-in-the-middle, while HTTPS provides secure communication.
Example: HTTP://exam...read more
Q91. Explain what are OOPs ?
OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects, which can contain data and code.
OOPs focuses on creating objects that interact with each other to solve problems
It involves concepts like classes, objects, inheritance, polymorphism, and encapsulation
Example: In a banking system, you can have classes like Account, Customer, and Transaction, each with their own properties and methods
Q92. What is inheritance? Explain
Inheritance is a concept in object-oriented programming where a class inherits properties and behaviors from another class.
Inheritance allows for code reuse and promotes modularity.
The class that is being inherited from is called the superclass or base class.
The class that inherits from the superclass is called the subclass or derived class.
The subclass inherits all the public and protected members of the superclass.
Inheritance can be single, where a subclass inherits from on...read more
Q93. What is generators in python?
Generators are functions that return an iterable sequence of items, one at a time, instead of returning a complete list.
Generators use the 'yield' keyword to return values one at a time.
They are memory efficient as they don't store the entire sequence in memory.
They can be used to generate an infinite sequence of values.
Example: def countdown(n): while n > 0: yield n n -= 1
Example: for i in countdown(5): print(i)
Q94. Write a program to find prime number
A program to find prime numbers in a given range.
Iterate through numbers in the given range
Check if each number is divisible by any number other than 1 and itself
If not divisible, it is a prime number
Q95. what is runtime polymorphism
Runtime polymorphism is the ability of a function to behave differently based on the object it is called with at runtime.
Runtime polymorphism is achieved through method overriding in object-oriented programming.
It allows a subclass to provide a specific implementation of a method that is already provided by its superclass.
The actual method that gets called is determined by the type of object at runtime.
Example: Animal class has a method 'makeSound', Dog and Cat classes overri...read more
Q96. example of function overriding
Function overriding is when a subclass provides a different implementation of a method that is already defined in its superclass.
The method in the subclass must have the same name, return type, and parameters as the method in the superclass.
The method in the subclass must have a higher or same level of access as the method in the superclass.
Example: class Animal { void makeSound() { System.out.println('Animal sound'); } } class Dog extends Animal { void makeSound() { System.o...read more
Q97. What is a Constructor
A constructor is a special type of method in a class that is automatically called when an object of that class is created.
Constructors have the same name as the class they belong to
They are used to initialize the object's state
They can have parameters to customize the initialization process
Q98. What is class and object
A class is a blueprint for creating objects, while an object is an instance of a class.
A class defines the properties and behaviors of objects.
An object is a specific instance of a class.
Classes can be used to create multiple objects with similar characteristics.
Objects can interact with each other by calling methods defined in their class.
Example: Class 'Car' defines properties like 'color' and behaviors like 'drive'. An object 'myCar' can be created from this class.
Q99. Write a Plindrome Code
A palindrome code reads the same forwards and backwards.
Create a function that compares the original string with its reverse
Use built-in functions like reverse() or loop through the string to create the reversed version
Handle cases where spaces or punctuation may be present in the string
Q100. 2) how to reverse a string
To reverse a string, iterate through it in reverse order and append each character to a new string.
Create an empty string to store the reversed string
Iterate through the original string in reverse order using a loop
Append each character to the new string using the += operator
Return the reversed string
Top Interview Questions for Ninja Related Skills
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month