Amdocs
400+ Moody's Interview Questions and Answers
A friend function in C++ is a function that is not a member of a class but has access to the private and protected members of the class.
Friend functions are declared inside a class with the keyword 'friend'.
They can access private and protected members of the class they are friends with.
Friend functions are not member functions of the class.
Example: friend void displayDetails(Student);
Q102. what are smart pointers
Smart pointers are objects that manage the lifetime of dynamically allocated memory in C++.
Smart pointers automatically deallocate memory when it is no longer needed.
They prevent memory leaks and dangling pointers.
Examples of smart pointers in C++ are unique_ptr, shared_ptr, and weak_ptr.
Q103. How redux work store, reducer and action
Redux is a state management library for JavaScript applications.
Redux uses a single source of truth called the store to manage the application state.
Reducers are pure functions that specify how the state should change based on the actions dispatched.
Actions are plain JavaScript objects that describe the type of change to be made to the state.
When an action is dispatched, the store passes the current state and the action to the reducer, which returns the new state.
Redux follow...read more
Q104. Name any 3 annotations and how they work
Annotations in Java are used to provide metadata about a program, which can be used by the compiler or at runtime.
1. @Override - Indicates that a method overrides a method in its superclass.
2. @Deprecated - Marks a method as deprecated, meaning it should no longer be used.
3. @SuppressWarnings - Suppresses compiler warnings for a given part of the code.
Q105. if 4 represent as $** and 3 represent as *$$ based on it there were 4 questions....like i) what is the value of $$$** + $**$* in similar way rest of 3 questions
Q106. What is python and constructer ,arrays,data structures
Python is a high-level programming language known for its simplicity and readability. Constructors are special methods used to initialize objects in classes.
Python is a versatile programming language used for web development, data analysis, artificial intelligence, and more.
Constructors in Python are special methods with the __init__() function that initialize objects when they are created.
Arrays in Python are data structures that can hold multiple values of the same type. Th...read more
Q107. Swap two character variables without using third
Swapping two character variables without using third
Use XOR operator to swap two variables without using third variable
Assign the XOR of both variables to the first variable
Assign the XOR of the first variable and second variable to the second variable
Q108. Write the code to find next smallest palindrome.
Code to find next smallest palindrome.
Iterate from middle to left and right, incrementing/decrementing digits to create palindrome
Handle edge cases like all 9s in number
Check if number is palindrome or not
Q109. Joins in detail with 100 line code for review
Explanation of joins in SQL with 100 line code example
Joins are used in SQL to combine rows from two or more tables based on a related column between them
Types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN
Example: SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id
Q110. Write any program of recursion and explain it using stack frames?
A program demonstrating recursion using factorial function.
Recursion is a technique where a function calls itself.
Factorial function is a classic example of recursion.
Each recursive call creates a new stack frame.
The base case is when the input is 1, and the function returns 1.
The final result is the product of all the recursive calls.
Example: factorial(5) = 5 * factorial(4) = 5 * 4 * factorial(3) = ... = 5 * 4 * 3 * 2 * 1 = 120.
Q111. write a code for binary search
Code for binary search algorithm
Binary search is a divide and conquer algorithm
It works by repeatedly dividing the search interval in half
If the value is found, return the index. Else, repeat on the appropriate half
The array must be sorted beforehand
Q112. Difference between stringbuffer and stringbuilder?
StringBuffer is synchronized and thread-safe, while StringBuilder is not synchronized.
StringBuffer is slower due to synchronization, while StringBuilder is faster.
StringBuffer is preferred in multithreaded environments, while StringBuilder is preferred in single-threaded environments.
Example: StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
Q113. If we are terminated at the middle of the program execution in UNIX,what will happen to the program,it will (i) continue running (ii) terminate (iii)the o/p will be send to ur mail?
Q114. What is mutex and its systax
Mutex is a synchronization object used to prevent multiple threads from accessing shared resources simultaneously.
Mutex stands for mutual exclusion.
It is used to protect shared resources from race conditions.
Mutex provides exclusive access to a shared resource.
Syntax: pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
Example: pthread_mutex_lock(&mutex); // acquire lock
pthread_mutex_unlock(&mutex); // release lock
Q115. What is the difference between arrays and ArrayLists in Java?
Arrays are fixed in size, while ArrayLists can dynamically resize. ArrayLists are part of Java's Collection framework.
Arrays are fixed in size, while ArrayLists can dynamically resize.
Arrays can hold primitive data types and objects, while ArrayLists can only hold objects.
Arrays use square brackets [] for declaration, while ArrayLists use the ArrayList class from the java.util package.
Example: String[] names = new String[5]; ArrayList<String> namesList = new ArrayList<>();
Q116. The syntax of command statement in UNIX 10. If the permission for a file is 000,then the file can be accessed by whom?
If the permission for a file is 000 in UNIX, then the file cannot be accessed by anyone.
File with permission 000 is not accessible to anyone, including the owner, group, and others.
The file cannot be read, written, or executed with permission 000.
To change the permissions and make the file accessible, the owner or superuser needs to modify the permissions using the chmod command.
Q117. which data structure is used in recursion?
The data structure used in recursion is a stack.
Recursion uses a stack data structure to keep track of function calls.
Each time a function is called, its parameters and local variables are pushed onto the stack.
When the function returns, the values are popped off the stack.
This allows the program to keep track of where it is in the recursive process.
Examples of recursive algorithms that use a stack include depth-first search and quicksort.
Q118. Difference between Primary key and Unique key
Primary key uniquely identifies a record in a table, while Unique key ensures uniqueness of a column.
Primary key can't have null values, Unique key can have one null value
A table can have only one Primary key, but multiple Unique keys
Primary key is automatically indexed, Unique key is not necessarily indexed
Q119. what is bug and unit testing?
A bug is an error, flaw, failure, or fault in a computer program or system. Unit testing is a software testing method where individual units or components of a software are tested in isolation.
Bug is an error, flaw, failure, or fault in a computer program or system.
Unit testing is a software testing method where individual units or components of a software are tested in isolation.
Bug testing helps identify and fix issues in the software.
Unit testing ensures that each unit of ...read more
Q120. Why There is a standard of giving clearances from utilities while designing Optical fiber path ?
Clearances from utilities are necessary to avoid interference and damage to the optical fiber path.
To prevent accidental damage to the fiber optic cables during maintenance or construction work by utility companies.
To ensure that there is no interference from existing utility lines that could affect the performance of the optical fiber network.
To comply with safety regulations and standards to prevent accidents and ensure the reliability of the network.
To avoid costly repairs...read more
Q121. What is the minimum and maximum depth of bore and trench ?
The minimum and maximum depth of bore and trench varies depending on the specific project requirements and local regulations.
Minimum depth of bore and trench is typically around 24 inches to ensure proper protection and support for the fiber optic cables.
Maximum depth of bore and trench can range from 36 inches to 60 inches, depending on factors such as soil conditions, road crossings, and utility clearances.
Local regulations and project specifications should always be consul...read more
Q122. What is the width of conduit that we used to place ?
The width of conduit used for fiber placement varies depending on the number of fibers being installed.
Conduit width typically ranges from 1 inch to 4 inches for fiber placement.
The width is determined based on the number of fibers being installed and the type of fiber optic cables used.
For example, a conduit width of 1 inch may be sufficient for a small number of fibers, while a width of 4 inches may be needed for a larger installation.
Components in React go through various stages like mounting, updating, and unmounting.
Components are created and inserted into the DOM during the mounting phase.
During the updating phase, components can re-render due to changes in props or state.
Components are removed from the DOM during the unmounting phase.
Lifecycle methods like componentDidMount, componentDidUpdate, and componentWillUnmount are used to perform actions at different stages.
A static variable in C is a variable that retains its value between function calls.
Declared using the 'static' keyword
Retains its value throughout the program's execution
Useful for maintaining state across function calls
HTML5 is the latest version of the HTML standard with new features for web development.
Support for multimedia elements like <video> and <audio>
Canvas and SVG for graphics and animations
Improved form controls and validation
Offline storage capabilities with Local Storage and IndexedDB
Geolocation API for location-based services
Q126. Write a program to check string is pallindrome or not
Program to check if a string is a palindrome or not.
Remove all spaces and convert to lowercase for case-insensitive comparison.
Compare the first and last characters, then move towards the center until all characters have been compared.
If all characters match, the string is a palindrome.
If any characters do not match, the string is not a palindrome.
Q127. What is a friend function
A friend function is a non-member function that has access to the private and protected members of a class.
Declared inside the class but defined outside the class scope
Can access private and protected members of the class
Not a member of the class but has access to its private members
Used to allow external functions to access and modify private data of a class
Can be declared as a friend in another class
Q128. Real time use of synchronisation
Synchronization is used to ensure consistency and avoid conflicts in real-time systems.
Real-time systems require synchronization to ensure that data is consistent and up-to-date across multiple devices or processes.
Synchronization can be achieved through various techniques such as locks, semaphores, and message passing.
Examples of real-time systems that use synchronization include stock trading platforms, online gaming, and traffic control systems.
Q129. what is SDLC AND TYPES?
SDLC stands for Software Development Life Cycle. It is a process used by software developers to design, develop, and test software.
SDLC is a systematic process for building software applications.
There are different types of SDLC models such as Waterfall, Agile, Iterative, Spiral, etc.
Each type of SDLC model has its own set of advantages and disadvantages.
SDLC involves phases like planning, analysis, design, implementation, testing, and maintenance.
Example: Waterfall model fol...read more
Q130. switch(n) case 1: printf("case 1"); case (2) : printf("default"); break; what will be output?? ans: it will be error since case(2) is not allowed
The code will result in an error because 'case(2)' is not a valid syntax in a switch statement.
Correct syntax for switch statement is 'case 1:' not 'case(1)'
Each case should be followed by a colon (:) not parentheses
The 'break' statement is missing after 'printf("default");'
Q131. What is a dangling pointer
A dangling pointer is a pointer that points to a memory location that has been deallocated, leading to potential crashes or undefined behavior.
Dangling pointers can occur when memory is freed but the pointer is not set to NULL.
Accessing a dangling pointer can result in accessing invalid memory.
Example: int* ptr = new int; delete ptr; // ptr is now a dangling pointer
Q132. Design patterns examples
Design patterns are reusable solutions to common software problems.
Creational patterns: Singleton, Factory, Abstract Factory
Structural patterns: Adapter, Decorator, Facade
Behavioral patterns: Observer, Strategy, Command
Examples: MVC, Dependency Injection, Template Method
Prototype chaining in JavaScript is the mechanism by which objects inherit properties and methods from other objects.
In JavaScript, each object has a prototype property, which points to another object. When a property or method is accessed on an object, JavaScript will look for it in the object itself first, and then in its prototype chain.
If the property or method is not found in the object, JavaScript will continue to look up the prototype chain until it finds the property ...read more
Promises are objects representing the eventual completion or failure of an asynchronous operation.
Promises have three states: pending, fulfilled, and rejected.
Pending: initial state, neither fulfilled nor rejected.
Fulfilled: operation completed successfully.
Rejected: operation failed.
Promises can be chained using .then() to handle success and failure.
Example: const promise = new Promise((resolve, reject) => { ... });
Q135. What is the difference between Boring and Trenching ?
Boring involves drilling a hole underground for installation, while trenching involves digging a trench for laying cables or pipes.
Boring involves drilling a hole underground using specialized equipment, while trenching involves digging a trench using machinery like excavators.
Boring is typically used when minimal disruption to the surface is desired, while trenching is used when a larger area needs to be excavated.
Boring is more expensive but can be faster and less disruptiv...read more
Q136. Which is cost effective method boring or trenching ?
Trenching is generally more cost effective than boring for fiber planning.
Trenching is typically cheaper upfront as it requires less specialized equipment and labor compared to boring.
Boring may be more expensive initially due to the need for specialized machinery and skilled operators.
However, in certain situations where trenching is not feasible or cost-effective, boring may be the preferred method.
Factors such as soil conditions, existing infrastructure, and project timeli...read more
Q137. Multithreading in java, data structures
Multithreading and data structures are important concepts in Java programming.
Multithreading allows for concurrent execution of multiple threads within a single program.
Data structures are used to organize and manipulate data efficiently.
Examples of data structures include arrays, linked lists, stacks, and queues.
Java provides built-in support for multithreading through the Thread class and the Runnable interface.
Synchronization is important in multithreading to prevent race ...read more
Q138. reversal of nodes in linked list
Reversing the nodes in a linked list involves changing the direction of pointers to go from the end to the beginning.
Iterate through the linked list and reverse the pointers to point to the previous node instead of the next node.
Use three pointers - prev, current, and next - to keep track of the nodes while reversing the list.
Update the head of the linked list to point to the last node after reversing.
Q139. What is garbage collection in java
Garbage collection in Java is an automatic memory management process.
It frees up memory by removing objects that are no longer in use.
It is performed by the JVM in the background.
It helps prevent memory leaks and improves performance.
There are different types of garbage collectors in Java, such as Serial, Parallel, CMS, and G1.
Example: int[] arr = new int[1000]; arr = null; // Garbage collector will remove the array from memory
Q140. Explain the concepts of OOPs in a code
OOPs concepts include encapsulation, inheritance, polymorphism, and abstraction in code.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Inheritance: Allowing a new class to inherit properties and behavior from an existing class.
Polymorphism: Objects of different classes can be treated as objects of a common superclass.
Abstraction: Hiding the implementation details and showing only the necessary features of an object.
Q141. Design a singleton class
A singleton class is a class that can only be instantiated once.
Ensure the constructor is private
Provide a static method to access the instance
Lazy initialization can be used to defer object creation
Thread safety should be considered
Q142. How will u print TATA alone from TATA POWER using string copy and concate commands in C?
To print TATA alone from TATA POWER using string copy and concatenate commands in C, we can use string copy to copy the first four characters and then concatenate a null character at the end.
Use strncpy to copy the first four characters of the string TATA POWER into a new string.
Add a null character at the end of the new string to terminate it.
Print the new string containing only TATA.
Q143. Program to reverse a linked list
Program to reverse a linked list
Traverse the linked list and change the direction of pointers
Use three pointers to keep track of current, previous and next nodes
Handle edge cases like empty list or list with only one node
Q144. How you can compare expected and actual result in selenium?
Use Assertion methods to compare expected and actual results in Selenium.
Use Assertion methods like assertEquals(), assertNotEquals(), assertTrue(), assertFalse(), etc.
Pass the expected and actual results as parameters to the Assertion methods.
If the expected and actual results match, the test case will pass, else it will fail.
Example: assertEquals(expectedResult, actualResult);
Q145. In which message passing is fast .....options are (a)pipe (b) message passing (c) message queue (d) memory sharing ans : d
Memory sharing is fast in message passing.
Memory sharing allows for direct access to shared data without the need for message passing overhead.
Examples of memory sharing include shared memory systems in parallel computing.
Memory sharing can lead to potential issues such as race conditions and data inconsistency.
Q146. Take a json and perform CRUD operations
Perform CRUD operations on a JSON object
Use POST method to create new data
Use GET method to read data
Use PUT method to update data
Use DELETE method to delete data
Q147. Addition and Deletion of a node in binary tree?
Addition and Deletion of a node in binary tree
For addition, traverse the tree to find the appropriate position and add the new node as a leaf
For deletion, find the node to be deleted and replace it with its successor or predecessor
In case of deletion, if the node has two children, find the inorder successor and replace it with the node to be deleted
Q148. reverse the string
Reverse a given string
Use a loop to iterate through the string and append each character to a new string in reverse order
Alternatively, use built-in string functions like reverse() or slice()
Remember to handle edge cases like empty strings or strings with only one character
Garbage collector in Java is a built-in mechanism that automatically manages memory by reclaiming unused objects.
Garbage collector runs in the background to reclaim memory from objects that are no longer in use.
It helps prevent memory leaks and optimize memory usage.
Examples of garbage collectors in Java include Serial, Parallel, CMS, G1, and Z Garbage Collectors.
The CSS Box Model is a fundamental concept in CSS that defines the layout and spacing of elements on a webpage.
The Box Model consists of content, padding, border, and margin.
Content: The actual content of the box, such as text or images.
Padding: Space between the content and the border.
Border: The border surrounding the padding and content.
Margin: Space outside the border, separating the element from other elements.
Example: div { width: 200px; padding: 20px; border: 1px solid...read more
Q151. 1. Roles and responsibilities 2. Technology worked on 3. Handling different use case scenario 4. Why to shift to the role 5. Knowledge on telecom
Answering questions related to Product Owner role and responsibilities, technology worked on, handling use case scenarios, reason for shifting to the role, and knowledge on telecom.
As a Product Owner, my primary responsibility is to ensure that the product meets the customer's needs and requirements.
I have worked on various technologies such as Agile, Scrum, and Kanban.
I have experience in handling different use case scenarios, such as user stories, acceptance criteria, and p...read more
Q152. What is springboot?
Spring Boot is a Java-based framework used for creating standalone, production-grade Spring-based Applications.
Spring Boot simplifies the process of creating Spring applications by providing a set of default configurations.
It allows developers to quickly set up and run standalone Spring applications with minimal configuration.
Spring Boot includes embedded servers like Tomcat, Jetty, or Undertow, making it easy to deploy applications.
It promotes convention over configuration, ...read more
Q153. There are 3 males and 2 females,find the possible no of orders that can be made by making the arrangement as in between two males one women is allowed to sit?
Q154. Definition of atoi function of C
atoi function converts a string to an integer in C.
The function takes a string as input and returns an integer.
Leading white spaces are ignored.
If the string contains non-numeric characters, the function stops conversion and returns the converted value.
The function returns 0 if the input string is not a valid integer.
Example: atoi('123') returns 123.
Q155. console.log([] === []) ??
No, they are not equal because they are two separate instances of arrays.
Empty arrays are two separate instances, so they are not strictly equal.
Comparing two empty arrays with strict equality will return false.
Q156. Design linked list
Designing a linked list involves creating a data structure where each element points to the next one.
Define a Node class with a value and a next pointer
Create a LinkedList class with a head pointer
Implement methods to add, remove, and traverse nodes
Consider edge cases like adding to an empty list or removing the head node
Q157. Basics and features of Java 8
Java 8 introduced new features like lambda expressions, streams, and functional interfaces.
Lambda expressions allow for more concise code by enabling functional-style programming.
Streams provide a way to work with collections of objects in a functional way.
Functional interfaces are interfaces with a single abstract method, used for lambda expressions.
Default methods allow interfaces to have method implementations.
Method references provide a way to refer to methods without inv...read more
Q158. Why Software Testing is Required to be done testers only?
Software testing requires specialized skills and knowledge that testers possess.
Testers have expertise in identifying and reporting defects that developers may overlook.
Testers can provide an objective evaluation of the software's functionality and usability.
Testing requires a different mindset and approach than development, and testers are trained in these areas.
Testers can also ensure that the software meets the requirements and specifications outlined by stakeholders.
Witho...read more
Media elements in HTML are used to embed audio and video content on a webpage.
Media elements include <audio> and <video> tags in HTML.
They allow for the playback of audio and video files directly on a webpage.
Attributes like src, controls, autoplay, and loop can be used to customize the behavior of media elements.
Example: <video src='video.mp4' controls></video>
Q160. Where we can run two same programs on a UNIX console at the same time?
Q161. If switch(n) case 1:printf("CASE !"); case(2):printf("default"); break; What will be printed?
Q162. A program to print star pattern
A program to print star pattern
Use nested loops to print the pattern
The outer loop controls the number of rows
The inner loop controls the number of stars to be printed in each row
Use print() or println() function to print the stars
Q163. Unix commands and their use
Unix commands are used to interact with the Unix operating system through the command line interface.
ls - list directory contents
cd - change directory
pwd - print working directory
cp - copy files or directories
mv - move files or directories
rm - remove files or directories
grep - search for specific text in files
chmod - change file permissions
ps - display information about running processes
top - display system resource usage
Q164. All fat people are not dancers, food loving people are all fat .Find the contradictory statement?
Q165. There are A,B techers and C,D doctors.Find the possible no of combinations that should not be repeated more than once?
Q166. what is the command to fetch first 10 records in a file
Q167. Check whether string is palindrome or not, explain the corner cases.
Check if a string is a palindrome by comparing characters from start and end.
Iterate through the string from start and end simultaneously to check if characters match.
Handle corner cases like empty string, single character string, and strings with spaces or special characters.
Examples: 'madam' is a palindrome, 'hello' is not a palindrome.
Q168. What is polymorphism? What is virtual function?
Polymorphism is the ability of an object to take on many forms. Virtual functions are functions that can be overridden in derived classes.
Polymorphism allows objects of different classes to be treated as if they are of the same class.
Virtual functions are declared in a base class and can be overridden in derived classes.
Polymorphism and virtual functions are key concepts in object-oriented programming.
Example: A shape class with virtual functions for calculating area and peri...read more
Q169. String reverse program
A program that reverses a string input
Create a function that takes a string as input
Use a loop to iterate through the characters of the string in reverse order
Append each character to a new string to build the reversed string
Return the reversed string as output
Q170. What is difference between smoke and sanity testing?
Smoke testing is a quick and shallow test to check if the application is stable enough for further testing. Sanity testing is a subset of regression testing to check if the bugs have been fixed and new changes have not affected the existing functionality.
Smoke testing is done to check if the critical functionalities of the application are working fine.
Sanity testing is done to check if the bugs have been fixed and new changes have not affected the existing functionality.
Smoke...read more
Q171. What is refrential integrity
Refrential integrity ensures that relationships between tables in a database remain consistent.
It is a database concept that ensures that foreign key values in one table match the primary key values in another table.
It prevents orphaned records in a database.
It maintains data consistency and accuracy.
For example, if a customer record is deleted, all related orders for that customer should also be deleted.
It is enforced through constraints such as foreign key constraints.
Q172. what are window functions in sql
Window functions in SQL are used to perform calculations across a set of rows that are related to the current row.
Window functions are used to calculate values based on a subset of rows within a table
They allow you to perform calculations across a set of rows that are related to the current row
They are often used for running totals, ranking, and moving averages
Examples of window functions include ROW_NUMBER(), RANK(), and SUM() OVER()
Q173. what is defect life cycle?
Defect life cycle is the process of identifying, reporting, prioritizing, fixing, and verifying defects in software.
Defect is identified by testers during testing
Defect is reported to development team
Development team prioritizes and fixes the defect
Fixed defect is verified by testers
If defect is not fixed, it goes back to development team
If defect is fixed, it is closed
Q174. 2.what is singleton pattern
Singleton pattern is a design pattern that restricts the instantiation of a class to one object.
Used when only one instance of a class is needed throughout the application
Provides a global point of access to the instance
Implemented using a private constructor and a static method to return the instance
Example: Database connection, Logger, Configuration settings
Q175. Strings manipulations' in C
String manipulation in C involves various functions to perform operations on strings like concatenation, comparison, and copying.
Use functions like strcpy() for copying strings
Use functions like strcat() for concatenating strings
Use functions like strcmp() for comparing strings
Q176. event loop in javascript
The event loop is a mechanism in JavaScript that allows for asynchronous execution of code.
The event loop is responsible for handling and executing tasks in JavaScript.
It ensures that tasks are executed in a non-blocking manner.
Tasks are added to different queues based on their type and priority.
The event loop continuously checks the queues and executes tasks in a specific order.
Examples of tasks include setTimeout callbacks, DOM events, and AJAX requests.
Q177. mid element of linkedlist
To find the middle element of a linked list, use the slow and fast pointer technique.
Initialize two pointers, slow and fast, both pointing to the head of the linked list.
Move the slow pointer by one step and the fast pointer by two steps until the fast pointer reaches the end of the list.
The element pointed to by the slow pointer at this point will be the middle element of the linked list.
Q178. Linked List Implementation
A linked list is a data structure where each element points to the next element in the sequence.
Nodes in a linked list contain data and a reference to the next node
Linked lists can be singly linked (each node points to the next) or doubly linked (each node points to the next and previous)
Inserting and deleting elements in a linked list is efficient compared to arrays
Q179. What is OOPs Concepts? Code for Function overloading and functions overriding?
OOPs Concepts include encapsulation, inheritance, polymorphism, and abstraction. Function overloading is having multiple functions with the same name but different parameters. Function overriding is having a derived class redefine a function from its base class.
Encapsulation: bundling data and methods together
Inheritance: creating new classes from existing ones
Polymorphism: using a single interface to represent different types
Abstraction: hiding implementation details
Function...read more
Q180. code of reverse string
Reverse a string using array manipulation
Create an array of characters from the input string
Iterate through the array in reverse order and append each character to a new string
Return the reversed string
Q181. Describe inheritance in java.
Inheritance in Java allows a class to inherit properties and behaviors from another class.
Allows a class to reuse code from another class
Creates a parent-child relationship between classes
Child class inherits fields and methods from parent class
Can have multiple levels of inheritance
Example: class Dog extends Animal
Same-origin policy is a security measure in web browsers that restricts how a document or script loaded from one origin can interact with a resource from another origin.
It prevents a web page from making requests to a different domain than the one it was loaded from.
It helps protect user data and prevent malicious attacks like cross-site scripting (XSS).
Cross-origin resource sharing (CORS) headers can be used to relax the same-origin policy in certain situations.
Q183. What is Microservice architecture and how to design it?
Microservice architecture is a software design pattern where an application is composed of small, independent services that communicate with each other.
Design services around business capabilities
Use lightweight communication protocols
Decentralize data management
Deploy services independently
Automate infrastructure
Monitor and test continuously
Q184. main () { int x=5; x=x----1; printf ("%d", x); } Output?
The output of the code will be 4.
The expression x=x----1 is equivalent to x = x - (-1) = x + 1.
Therefore, x will be 5 + 1 = 6.
But since the post-decrement operator is used, the final value of x will be 6 - 1 = 5.
Q185. Real time examples of Data structures?
Data structures are used to organize and store data in a computer program.
Arrays - used to store a collection of elements of the same data type
Linked Lists - used to store a collection of elements where each element points to the next element
Stacks - used to store a collection of elements where the last element added is the first element removed
Queues - used to store a collection of elements where the first element added is the first element removed
Trees - used to store hiera...read more
Q186. Describe various types of DB
Various types of DB include relational, non-relational, distributed, graph, and time-series databases.
Relational databases store data in tables with rows and columns (e.g. MySQL, PostgreSQL)
Non-relational databases store data in key-value pairs, documents, or wide-column stores (e.g. MongoDB, Cassandra)
Distributed databases spread data across multiple servers for scalability and fault tolerance (e.g. HBase, Riak)
Graph databases use graph structures for data storage and queryi...read more
Q187. context switching takes place.... a) kernel to user mode b)user to user mode c)kernel to kernel mode d)one process to another process
Context switching takes place when the CPU switches from one process to another process.
Context switching involves saving the state of the current process and loading the state of the next process.
It can occur when a process voluntarily yields the CPU, or when a higher priority process preempts the current process.
Examples include multitasking operating systems where multiple processes share the CPU.
Context switching overhead can impact system performance.
Callbacks in JavaScript are functions passed as arguments to other functions, to be executed later.
Callbacks are commonly used in asynchronous operations, such as event handling or AJAX requests.
They allow for more flexible and dynamic programming, by defining behavior that should happen after a certain event or task is completed.
Example: setTimeout function in JavaScript takes a callback function as an argument to be executed after a specified time.
Q189. Diamond problem, how java handle it?
Java uses default methods to handle the diamond problem by allowing interfaces to have method implementations.
Java allows interfaces to have default methods, which provide a default implementation for a method in case multiple interfaces define the same method.
If a class implements two interfaces with the same default method, the class must override the method to provide its own implementation.
Example: interface A { default void method() { System.out.println('A'); } } interfa...read more
Q190. explain useCallback
useCallback is a React hook that returns a memoized callback function
Returns a memoized callback function
Helps optimize performance by preventing unnecessary re-renders
Useful when passing callbacks to child components
Q191. what is the command to connecto to remote terminals
Q192. What are the two health checks when EC2 instance is launched?
The two health checks when an EC2 instance is launched are System Status Checks and Instance Status Checks.
System Status Checks ensure that the underlying host system is healthy and reachable.
Instance Status Checks ensure that the instance is running properly and can be accessed.
Examples: System Status Checks may include checking network connectivity, while Instance Status Checks may include verifying system logs.
Q193. Which programming languages do you know.
I know multiple programming languages including Java, Python, and C++.
Java
Python
C++
Q194. explain the difference between delete and truncate in dbms
Delete removes specific rows from a table, while truncate removes all rows from a table.
Delete is a DML command, while truncate is a DDL command.
Delete operation can be rolled back, while truncate operation cannot be rolled back.
Delete operation triggers delete triggers, while truncate operation does not trigger any triggers.
Delete operation is slower compared to truncate operation.
Example: DELETE FROM table_name WHERE condition; TRUNCATE TABLE table_name;
Q195. Plsql procedure
PL/SQL is a procedural language extension for SQL in Oracle databases.
PL/SQL stands for Procedural Language/Structured Query Language.
It is used to create stored procedures, functions, triggers, and packages in Oracle databases.
PL/SQL code is executed on the server side, providing better performance compared to SQL statements executed on the client side.
Q196. Reverse a string
Reverse a given string
Use a loop to iterate through the string and append each character to a new string in reverse order
Alternatively, use built-in string functions to reverse the string
If the string is stored as an array of characters, swap the first and last elements, then the second and second-to-last elements, and so on until the middle is reached
Q197. What is difference between test cases and test scenarios
Test cases are detailed steps to test a specific functionality, while test scenarios are high-level descriptions of possible test paths.
Test cases are detailed steps to test a specific functionality or requirement
Test scenarios are high-level descriptions of possible test paths or user interactions
Test cases are more specific and concrete, while test scenarios are more abstract and general
Test cases are usually written by testers, while test scenarios can be written by busine...read more
Q198. What is the difference between severity and priority with example
Severity is the impact of a defect on the system, while priority is the order in which defects should be fixed.
Severity is the measure of how serious a defect is in terms of its impact on the system functionality.
Priority is the order in which defects should be fixed, based on factors like customer requirements and project deadlines.
Example: A defect causing the system to crash would have high severity, but if it only affects a small number of users, it may have lower priorit...read more
Q199. How will add additional conditions in SQL?
Q200. How will u divide two numbers in a MACRO?
Top HR Questions asked in Moody's
Interview Process at Moody's
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month