Log In

Don't have an account? Sign up now

Lost Password?

Sign Up

Prev Next

Accenture Interview Guide

Accenture Hiring Process

Accenture recruits engineering graduates from all across India and mainly hires candidates for two roles — Associate Software Engineer (ASE) and Advanced Associate Software Engineer (AASE).

Number of Rounds: 3

Accenture’s hiring has three major stages:

  1. Online Assessment (with multiple sub-sections)
    • Cognitive Ability
    • Abstract & Critical Reasoning
    • Verbal Ability
    • Technical Assessment
    • MS Office & Application knowledge
    • Pseudocode
    • Network, Security & Cloud
    • Coding
  2. Communication Assessment
  3. Interview Round (Technical + HR combined)

Job Roles Offered

Accenture hires through:

  • On-Campus drives
  • Off-Campus drives

They offer two profiles to freshers:

RoleSalary Package
Associate Software Engineer (ASE)4.5 LPA
Advanced Associate Software Engineer (AASE)6.5 LPA

Note: These packages may vary depending on the company’s financial performance and policies each year.


Detailed Recruitment Stages

1. Online Assessment (Elimination Round)

More than 75% candidates get eliminated here.

The test includes three qualifying sections:

🔹 Cognitive Ability Test

  • 50 questions → 50 minutes
  • Needs to be cleared to move to the next stage.

🔹 Technical Assessment

  • 40 questions → 40 minutes
  • Also qualifying — failure ends your hiring process.

🔹 Coding Assessment

  • Usually 2 coding questions
  • If you solve only 1 code successfully → high chance of ASE
  • If you solve both codes → possibility of AASE

In total, the online assessment lasts around 150 minutes.
Even though cut-off is not declared publicly, 60%+ in all sections is generally safe.

2. Communication Assessment

This test evaluates English speaking skills based on:

  • Sentence formation
  • Vocabulary
  • Fluency
  • Pronunciation

There are about 20–25 questions with 30 minutes duration.

It is not a qualifying round, but the score becomes crucial if two candidates score equally in other stages.

3. Interview Round

More than 92% of the remaining candidates get filtered out here.

Accenture conducts a combined interview (Technical + HR), which may last 60–90 minutes.

Topics usually asked:

🔹 Technical Part

  • Coding and DSA
  • DBMS, OOP, OS, CN (basic CS fundamentals)
  • Projects and internships
  • Certifications and problem-solving skills

🔹 HR Part

  • Self-introduction
  • Strengths, weaknesses, hobbies
  • “Why Accenture?”
  • Relocation & work flexibility
  • Puzzles and situational/behavioral questions

About Accenture

  • Accenture Technology is an Irish-American multinational focused on IT consulting, software development, cloud, research & delivery solutions.
  • Founded in 1989 by Arthur Andersen
  • Headquarters: Dublin, Ireland

50 most Asked questions in Accenture Interview

Question 1:

What is an operator in Python?
Explanation:
Operator is a symbol, which is used on some values and produces an output as a result. Operator works on operands.
Operators are of unary, binary or ternary types depending on the number of operands required.
They include:

  • Arithmetic
  • Relational
  • Assignment
  • Logical
  • Identify
  • Bitwise

Question 2:

What is the use of printf() and scanf() functions?
Explanation:
printf() function displays integer, character, float or string values on the screen.

  • %d – displays an integer value
  • %s – displays a string
  • %c – displays a character value
  • %f – displays a floating value
    scanf() function takes input from the user.

Question 3:

What is a constraint?
Explanation:
Constraints are limitations on the data type of a given table. Samples of constraints are:

  • Not Null
  • Check
  • Default

Question 4:

What is a foreign key?
Explanation:
Foreign Key is a key which links 2 tables.
It is a field or a collection of fields in a table that corresponds to the Primary Key of another table.


Question 5:

What is slicing in Python?
Explanation:
Slicing is used to break up a list or tuple.

  • Start: starting index
  • Stop: ending index
  • Step: number of jumps
    Syntax:
    [start:stop:step]

Question 6:

What is the static variable? What is its use?
Explanation:
A variable which is declared static is known as a static variable. These variables retain their value between function calls.
Syntax: static int y = 10;
Static variables are accessible from anywhere in the program and are shared by all methods.


Question 7:

What do you like most about the IT industry? What do you enjoy the least about it?
Explanation:
Mention the features of IT that you like. Example: opportunity to work with emerging technologies.
Also mention the aspects that you wish would change.


Question 8:

What is the use of ‘this’ keyword in Java?
Explanation:
‘this’ keyword refers to the current object. It is used to invoke the current class method or constructor, and is also passed as an argument to methods/constructors.


Question 9:

Do you have any technical certifications?
Explanation:
If you have mentioned certifications, the interviewer will ask this.
Explain your training, projects, workshops, webinars etc.
Include only job-relevant certifications and relate them to the job.


Question 10:

What was the recent technical project you worked on? What were your key responsibilities?
Explanation:
Behavioral question — answer using STAR method.
If your project includes technologies from the job description, highlight that.
Focus more on responsibilities or challenges if specifically asked.


Question 11:

What is a NULL pointer and far pointer?
Explanation:
Null Pointer — pointer that refers to no address; assigned value 0.
Far Pointer — pointer that can access all 16 segments (full memory space of RAM). It is a 32-bit pointer.


Question 12:

What are tables, fields and records?
Explanation:

  • Tables: rows & columns structure
  • Fields: columns
  • Records: rows

Question 13:

What is a query?
Explanation:
A query is a request for information from a database. A DB query is code written to retrieve data.


Question 14:

What is method overloading?
Explanation:
It is a polymorphism technique that allows multiple methods with the same name but different signatures.


Question 15:

What is JVM, JDK and JRE?
Explanation:

  • JVM – Java Virtual Machine (executes code)
  • JRE – Java Runtime Environment (files needed during runtime)
  • JDK – Java Development Kit (tools to write and run programs)

Question 16:

What is DBMS?
Explanation:
DBMS stands for Database Management System. It performs creation, maintenance and usage of a database.


Question 17:

What is a pointer in C? What are its uses?
Explanation:
A pointer is a variable storing the address of another value.
Syntax: data_type *p;
Uses: accessing array elements, passing reference to functions.


Question 18:

What do you do to improve your technical skills?
Explanation:
Mention:

  • Technical books/journals
  • Webinars & tutorials
  • GitHub projects
  • Learning new tools

Question 19:

What is Python swapcase() function?
Explanation:
It converts uppercase characters to lowercase and vice-versa and returns a new modified copy of the string.


Question 20:

What is an infinite loop?
Explanation:
A loop that executes continuously for an indefinite number of times.


Question 21:

What is the difference between call by value and call by reference in C?
Explanation:
(No change — same explanation expected as provided.)


Question 22:

What is a command line argument?
Explanation:
The argument passed to the main() function while executing a program.


Question 23:

How can you restrict inheritance?
Explanation:

  • Using final keyword
  • Making the method final
  • Private constructor
  • Javadoc comment (//)

Question 24:

What are lists and tuples?
Explanation:
Both are sequence data types.
Lists → [] (mutable)
Tuples → () (immutable)


Question 25:

What is a production deployment process?
Explanation:
Deployment is the step-by-step method to make an application ready.
Models: Waterfall, Iterative, Agile, or a mix.
Explain your preferred process to the interviewer.


Question 26:

How many programming languages do you know?
Explanation:
Tell the languages listed in your resume and rate yourself realistically.
If you rate yourself high, you may be asked advanced questions on that language.


Question 27:

What is static method and static variable?
Explanation:
They are shared by all objects of a class. Their static nature originates from the class, not the object.


Question 28:

What is a unique key?
Explanation:
A unique key uniquely identifies each record in the database.


Question 29:

What is ACID property?
Explanation:

  • Atomicity
  • Consistency
  • Isolation
  • Durability

Question 30:

What is a Python decorator?
Explanation:
A powerful meta-programming tool that adds functionality to existing code without modifying it.


Question 31:

What is Recursion in C?
Explanation:
A function calling itself.
Two phases:

  • Winding
  • Unwinding

Question 32:

What is pass in Python?
Explanation:
A null operation used as a placeholder for code yet to be written.


Question 33:

What is a dangling pointer? How is it overcome?
Explanation:
Pointer referring to deallocated memory.
Solution: assign NULL after freeing memory.


Question 34:

What is SQL?
Explanation:
SQL stands for Structured Query Language. It is used to communicate with & manipulate a database.


Question 35:

What is an object and class?
Explanation:
Object: collection of methods & properties.
Class: blueprint used to create objects.


Question 36:

What is the extent of your technical expertise?
Explanation:
Rate your skills and mention technologies you know.
Include trending tech like ML, AI, AWS if true — don’t lie.


Question 37:

Why is a solution design document important?
Explanation:
It contains project details before implementation and aligns the team with a unified plan.


Question 38:

What is interpreted language?
Explanation:
Executes statements line-by-line without a separate compilation step.


Question 39:

What is Python “self”?
Explanation:
Self refers to the current instance of a class and is passed as the first parameter to methods.


Question 40:

What is the break statement used for?
Explanation:
It terminates the current loop and transfers control outside the block.


Question 41:

What is the difference between Python lists and arrays?
Explanation:

FeaturePython ListArray
Data TypeCan store different data types in the same list (e.g., int, string, float)Stores same data type only
ModuleBuilt-in (no import needed)Requires import (array module or NumPy)
MemoryUses more memoryUses less memory
SpeedSlower for numerical operationsFaster for numerical/calculation tasks
Use CaseGeneral-purpose collectionBest for mathematical and large numeric data

Question 42:

Can we compile a program without the main() function?
Explanation:
Yes, it compiles but does not execute.
Using #define, a program can execute without writing main() explicitly.


Question 43:

What is a relationship in DBMS and what are its types?
Explanation:
Relationship connects tables. Types:

  • One-to-One
  • One-to-Many
  • Many-to-One
  • Self-Referencing

Question 44:

What do you keep in mind while solving a technical problem — business, user or yourself?
Explanation:
Explain who the product is being built for and justify your answer.


Question 45:

What is Python slicing?
Python slicing is a technique used to extract a part (portion) of a list, string, tuple, or any sequence by specifying a start, end, and an optional step.

Syntax

sequence[start : end : step]

How it works

step → gap between elements (optional)

start → index where slicing begins

end → index where slicing stops (end is not included)


Question 45

What is DELETE vs TRUNCATE?
Explanation:


DELETE

  • Removes specific rows from a table using a WHERE condition.
  • Slow because it deletes rows one by one.
  • Can be rolled back (transaction log maintained).
  • Triggers get fired when DELETE is used.
  • Table structure and identity counter remain unchanged.

TRUNCATE

Identity counter resets (auto-increment starts from beginning).

Removes all rows from a table (cannot delete selected rows).

Very fast because it deallocates data pages instead of row-by-row deletion.

Cannot be rolled back in most DBMS once executed.

Triggers do not fire.


Question 46:

Give an example of applying technical knowledge practically.
Explanation:
Behavioral question — answer using STAR method and share a project where you implemented your skills.


Question 47:

What is the ACID property?
ACID property ensures reliable database transactions through Atomicity, Consistency, Isolation, and Durability.


Question 48 :

What is an infinite loop?
An infinite loop is a loop that runs endlessly because its terminating condition is never met.


Question 49:

What is the Python decorator?
A Python decorator is a function that modifies or adds extra functionality to another function without changing its actual code.


Question 50 :

What is platform independence in Java?
Explanation:
Java is platform-independent because its bytecode can run on any system regardless of OS.


Question 51:

What are access modifiers in Java?
Explanation:
Keywords that restrict access to class elements:

  • Default
  • Private
  • Protected
  • Public

Question 52:

What is enumeration?
Explanation:
An interface used to access elements of an original data structure.


Question 53:

What is the final variable in Java?
Explanation:
The final variable cannot be modified once assigned.

Top 30 Technical questions asked in Accenture Interview

Question 1:

What is SDLC?

Answer:
SDLC stands for software development Life Cycle is a model used in project management to design, develop and test high quality softwares. It is also Known as the application development life-cycle. SDLC includes following phases — Planning, Analysis, Design, Development, Testing, Implementation, Maintenance.


Question 2:

What functions are used for dynamic memory allocation in C language?

Answer:
Basically, the concept of dynamic memory allocation in C language enables the programmer to allocate memory at runtime. Its memory can be increased while executing program. Dynamic memory allocation is possible by four functions of stdlib.h header file which are malloc(), calloc(), realloc(), free().


Question 3:

What is the difference between the local variable and global variable in C?

Answer:
In C:

Local variables are declared inside a function/block, stored in stack memory, and can be accessed only within that function/block.

Global variables are declared outside all functions, stored in global memory, and can be accessed by any function in the program.


Question 4:

What is the first object-oriented programming language?

Answer:
First object oriented programming language is Simula.


Question 5:

What is a deadlock condition in multithreading?

Answer:
When each process is holding a resource and waiting for another resource acquired by some other process this situation is known as a deadlock condition. Deadlock is a condition in which two or more threads are blocked forever, waiting for each other.


Question 6:

What are the features of the C language?

Answer:
Features of C Programming language are as follows: Procedural Language, Fast and Efficient, Modularity, Statically Type, General-Purpose Language, Rich set of built-in Operators, Libraries with rich Functions, Middle-Level Language, Portability, Easy to Extend.


Question 7:

What is an infinite loop?

Answer:
An infinite loop is a piece of code that keeps running forever as the terminating condition is never reached.


Question 8:

Why is Java called platform independent?

Answer:
Java is called a platform independent language because of the JVM. The byte code (.class file) generated after compilation runs on any operating system, but each OS has its own JVM — making Java platform independent.


Question 9:

What is a checked and unchecked exception?

Answer:
Checked exceptions are checked at compile time; the method must either handle them or declare using the throws keyword. Unchecked exceptions occur at runtime (RuntimeException and Error). In C++, all exceptions are unchecked.


Question 10:

What is encapsulation in Java?

Answer:
It’s a process of wrapping code and data together into a single unit — like a capsule that contains many medicines.


Question 11:

What is recursion in C?

Answer:
Recursion is a technique where a function calls itself repeatedly until a specific terminating condition is reached. The function that does this is called a recursive function.


Question 12:

What is “Collection Framework” in Java?

Answer:
It is a set of prepackaged data structures and algorithms for manipulating those data structures. It reduces programming effort and helps focus on logic building.


Question 13:

What are the reasons behind the occurrence of an exception?

Answer:
An exception is thrown when:

  1. JVM detects an abnormal execution condition (e.g., divide by zero, resource limitation).
  2. A throw statement is executed.
  3. An asynchronous exception occurs (e.g., internal JVM error, deprecated Thread.stop()).

Question 14:

What is the maximum length of an identifier?

Answer:
The maximum length of an identifier is 79 characters.


Question 15:

Differentiate between class and object.

Answer:
Class is a blueprint or template that defines properties and behaviors (variables and methods), whereas an Object is an instance created from that class which actually uses those properties and behaviors.


Question 16:

What is the recursion in C?

Answer:
Recursion in C is a programming technique where a function calls itself repeatedly until a specified base condition is reached.


Question 17:

What are the keywords “super” and “this” in Java?

Answer:
super refers to the parent class object and can be used to access parent variables, methods, and constructors. this refers to the current class object and can be used to access current class variables, methods, constructors, and return the current instance.


Question 18:

What is the newline escape sequence?

Answer:
The escape sequence for newline is “\n”.


Question 19:

How delete [] is different from delete?

Answer:
delete deallocates memory and calls destructor for a single object created with new.
delete[] deallocates memory and calls destructors for an array of objects created with new[].


Question 20:

What is “Diamond problem” in Java? How can it be removed?

Answer:
When two superclasses of a class have a common base class, it forms a diamond problem. Java avoids it by not supporting multiple class inheritance. Default methods & interfaces and virtual inheritance solve diamond problems.


Question 21:

What do you understand about runtime polymorphism?

Answer:
Runtime polymorphism (dynamic method dispatch) is when the call to an overridden method is resolved at runtime based on the object referenced by the superclass reference variable.


Question 22:

Can we compile a program without the main() function?

Answer:
Yes. Even though main() is the entry point for program execution, the system first calls _start(), which then calls main().


Question 23:

Differentiate between Collection and array.

Answer:

FeatureArrayCollection
SizeFixed size (cannot grow or shrink)Dynamic size (can grow or shrink at runtime)
Data TypeStores elements of same data typeCan store different data types depending on collection type
MemoryMemory allocated at compile timeMemory allocated at runtime
PerformanceFaster because of fixed size and continuous memorySlightly slower because of dynamic nature and internal processing
Built-in MethodsVery few inbuilt functionsProvides many inbuilt methods like add, remove, sort, search, etc.
FlexibilityLess flexibleHighly flexible
Exampleint arr[5];ArrayList list = new ArrayList();

Question 24:

What do you understand about Exception Handling?

Answer:
Exception handling is a mechanism to handle runtime errors so that the normal flow of the application continues without interruption.


Question 25:

What is the “auto” keyword in C?

Answer:
An auto keyword defines a local variable storage class whose lifetime lasts only till the end of its enclosing scope.


Question 26:

What is call by value and call by reference?

Answer:
Call by value copies the actual value to the function parameters; call by reference passes the memory address of the variable instead of value.


Question 27:

What is the OOPs concept?

Answer:
Object-oriented programming allows software design using objects and classes and includes concepts like Object, Class, Inheritance, Polymorphism, Abstraction, and Encapsulation.


Question 28:

How can you differentiate between method overloading and method overriding?

Answer:

FeatureMethod OverloadingMethod Overriding
DefinitionSame method name with different parameters in the same classSame method name with same parameters in parent and child class
ConceptCompile-time polymorphismRuntime polymorphism
Class InvolvedHappens within the same classHappens between superclass and subclass
ParametersMust be different (type, number, or order)Must be same as parent class
Return TypeCan be same or differentMust be same or covariant
PurposeTo increase method flexibilityTo change/extend parent class method behavior
Exampleadd(int a, int b) and add(double x, double y) in same classChild class redefining display() method of parent class

Question 29:

What is an abstract class in Java?

Answer:
An abstract class cannot be instantiated and may or may not include abstract methods. It is used to be subclassed instead of directly creating objects.


Question 30:

What is an overflow error?

Answer:
When a program receives a value outside the limit of what it can store or handle, leading to inaccurate or impossible calculation results.

Accenture Coding Questions Asked in Interview

Question 1

Examine the array arr[] comprising N distinct integers. Your objective is to determine whether the array remains sorted after undergoing a counter-clockwise rotation. It is imperative to note that a conventionally sorted array, without any rotations, does not qualify as sorted and rotated in this context. In essence, ascertain the presence of at least one rotation for the array to be considered as sorted and rotated.

Example:

Input: arr[] = { 3, 4, 5, 1, 2 } 

Output: true 

Explanation: 

Sorted array: {1, 2, 3, 4, 5}. 

Rotating this sorted array clockwise 

by 3 positions, we get: { 3, 4, 5, 1, 2}

Input: arr[] = {7, 9, 11, 12, 5} 

Output: true


Question 2

Within a collection of strings, your task is to employ Binary Search to identify the longest common prefix. Devise a solution that efficiently determines the shared prefix among the given strings, utilizing the principles of Binary Search.

Example:

Input: strings = [“flower”, “flow”, “flight”]

Output: Longest Common Prefix: ‘fl’


Question 3

Determine the methodology to identify a peak element within a given 2D Array or Matrix. Develop an algorithm that can effectively pinpoint a peak element in the matrix, adhering to the specified task requirements.

Example:

Input: [[10 20 15], [21 30 14], [7  16 32]]

Output: 1, 1

Input: [[10 7], [11 17]]

Output : 1, 1


Question 4

In the context of a sorted and rotated array containing duplicate elements, your objective is to devise an algorithm capable of efficiently identifying a specified element within the rotated array. The algorithm is required to achieve this task with a time complexity of O(log n). Additionally, it is important to output the index where the key exists, and if there are multiple valid answers, any of them can be printed. Design a solution that meets these criteria and successfully locates the specified element in the given rotated array.

Example:

Input: arr[] = {3, 3, 3, 1, 2, 3}, key = 3 

Output: 0 

arr[0] = 3

Input: arr[] = {3, 3, 3, 1, 2, 3}, key = 11 

Output: -1 

11 is not present in the given array. 


Question 5

Consider a mountain array, denoted as arr[], and an integer X. Your assignment is to formulate an algorithm to determine the smallest index of X within the given mountain array. In cases where no such index is identified, the output should be -1. Develop a solution that effectively locates the specified integer in the mountain array and prints the smallest index if found; otherwise, outputs -1.

Example:

Input: arr = {1, 2, 3, 4, 5, 3, 1}, X = 3

Output: 2

Explanation: 

The smallest index of X(= 3) in the array is 2. 

Therefore, the required output is 2.

Input: arr[] = {0, 1, 2, 4, 2, 1}, X = 3

Output: -1

Explanation: Since 3 does not exist in the array, the required output is -1.


Question 6

In the context of two sorted arrays, namely a[] and b[], with N and M elements, the objective is to devise an algorithm to determine the median of the combined array. Your task is to formulate a solution that efficiently computes the median, considering the total number of elements in both arrays. Develop an algorithm that accurately identifies the median of the merged sorted arrays, with N and M denoting the number of elements in the respective arrays.

Example:

Input: a[] = {-5, 3, 6, 12, 15}, b[] = {-12, -10, -6, -3, 4, 10}

Output: The median is 3.

Explanation: The merged array is: ar3[] = {-12, -10, -6, -5 , -3, 3, 4, 6, 10, 12, 15}.

So the median of the merged array is 3

Input: a[] = {2, 3, 5, 8}, b[] = {10, 12, 14, 16, 18, 20}

Output: The median is 11.

Explanation : The merged array is: ar3[] = {2, 3, 5, 8, 10, 12, 14, 16, 18, 20}

If the number of the elements are even. So there are two middle elements.

Take the average between the two: (10 + 12) / 2 = 11.


Question 7

In an examination scenario, you are presented with K sorted arrays, each of size N. Your assignment is to develop an algorithm for merging these arrays into a single sorted output. Formulate a solution that efficiently merges the K sorted arrays and produces the final sorted result. Provide the code for your algorithm along with the necessary explanation, demonstrating your ability to handle and manipulate sorted arrays in a merging context.

Example:

Input: K = 3, N = 4, arr = { {1, 3, 5, 7}, {2, 4, 6, 8}, {0, 9, 10, 11}}

Output: 0 1 2 3 4 5 6 7 8 9 10 11 

Explanation: The output array is a sorted array that contains all the elements of the input matrix. 


Question 8

You are presented with k sorted arrays, each possessing varying lengths. Your task is to devise an algorithm that effectively merges these arrays into a singular array, ensuring that the resulting merged array maintains a sorted order. Formulate a solution that efficiently handles arrays of different lengths, demonstrating your ability to merge and maintain sorted order in the merged array. Provide the corresponding code, along with a clear explanation of your algorithm.

Example:

Input : {{3, 13}, 

        {8, 10, 11}

        {9, 15}}

Output : {3, 8, 9, 10, 11, 13, 15}

Input : {{1, 5}, 

         {2, 3, 4}}

Output : {1, 2, 3, 4, 5}


Question 9

You are presented with K sorted linked lists, each comprising N elements. Your assignment is to develop an algorithm capable of merging all these linked lists while preserving their sorted order. Devise a solution that efficiently handles the merging of K sorted linked lists, showcasing your ability to maintain the overall sorted order in the merged linked list. Additionally, provide a well-documented example illustrating the input and output of your algorithm.

Example:

Input: K = 3, N =  4

list1 = 1->3->5->7->NULL

list2 = 2->4->6->8->NULL

list3 = 0->9->10->11->NULL

Output: 0->1->2->3->4->5->6->7->8->9->10->11

Merged lists in a sorted order where every element is greater than the previous element.

Input: K = 3, N =  3

list1 = 1->3->7->NULL

list2 = 2->4->8->NULL

list3 = 9->10->11->NULL

Output: 1->2->3->4->7->8->9->10->11

Merged lists in a sorted order where every element is greater than the previous element.


Question 10

Write a program to generate two linked lists, L1 and L2, representing sets of elements. Implement functions to compute the union and intersection of these sets and create linked lists, U and I, where U represents the union of elements from L1 and L2, and I represents the intersection of elements present in L1 and L2. Ensure that the order of elements in the output lists is not significant.

Example:

Input:

   List1: 10 -> 15 -> 4 -> 20

   List2: 8 -> 4 -> 2 -> 10

Output:

   Intersection List: 4 -> 10

   Union List: 2 -> 8 -> 20 -> 4 -> 15 -> 10

Input:

   List1: 1 -> 2 -> 3 -> 4

   List2: 3 -> 4 -> 8 -> 10

Output:

   Intersection List: 3 -> 4

   Union List: 1 -> 2 -> 3 -> 4 -> 8 -> 10


Question 11

Develop a program to construct a linked list that captures the disparity between two given linked lists. Specifically, create a linked list to store the elements present in the first linked list but absent in the second linked list. Ensure the order of elements in the resultant list is not a determining factor.

Example:

Input: 

List1: 10 -> 15 -> 4 ->20, 

List2: 8 -> 4 -> 2 -> 10 

Output: 15 -> 20 


Question 12

In the context of a numerical scenario, formulate a program to substitute a specified digit, denoted as d1, with another digit, denoted as d2, in a given number x.

Example:

Input : x = 645, d1 = 6, d2 = 5

Output : 545

We replace digit 6 with 5 in number 645.

Input  : x = 746, d1 = 7, d2 = 8

Output : 846


Question 13

Given an integer N, the task is to check whether the product of digits at even and odd places of a number are equal. If they are equal, print Yes otherwise print No.

Example:

Input: N = 2841 

Output: Yes 

Product of digits at odd places = 2 * 4 = 8 

Product of digits at even places = 8 * 1 = 8

Input: N = 4324 

Output: No 

Product of digits at odd places = 4 * 2 = 8 

Product of digits at even places = 3 * 4 = 12   


Question 14

Compose a program to determine the count of matching digits at corresponding indices in two given numbers, denoted as N and M.

Example:

Input: N = 123, M = 321

Output: 1

Explanation: Digit 2 satisfies the condition

Input: N = 123, M = 111

Output: 1


Question 15

Design a program to reverse a 32-bit integer, taking into account potential overflow scenarios. If the reversed integer exceeds the 32-bit limit, the program should output -1.


Question 16

Write a program to compute the N-th root of a given number A. In mathematical terms, determine the real number that, when raised to the power of the integer N, results in the value A.

Example:

Input : A = 81

        N = 4

Output : 3 

3^4 = 81


Question 17

Consider an array arr[] of size N and an integer K. Your task is to determine the maximum value for each contiguous subarray of size K.

Write a function or algorithm to efficiently solve this problem.

Example:

Input:

Array: [1, 3, 4, 2, 6, 7]

K: 3

Output:

Maximum Values: [4, 4, 6, 7]


Question 18

You are given an array Arr[] of N integers. Your task is to identify the contiguous sub-array (containing at least one number) with the maximum sum and return its sum.

Write a function or algorithm to efficiently solve this problem.

Example:

Input:

Array: [-2, 1, -3, 4, -1, 2, 1, -5, 4]

Output:

Maximum Sum: 6

Explanation:

The contiguous sub-array [4, -1, 2, 1] has the maximum sum, which is 6.


Question 19

You are given an array Arr[] of N integers. Your task is to identify the contiguous sub-array (containing at least one number) with the maximum sum and return its sum.

Write a function or algorithm to efficiently solve this problem.

Example:

Input:

Array: [-2, 1, -3, 4, -1, 2, 1, -5, 4]

Output:

Maximum Sum: 6

Explanation:

The contiguous sub-array [4, -1, 2, 1] has the maximum sum, which is 6.


Question 20

Consider an array of size N-1 containing distinct integers in the range of 1 to N. Your task is to find the missing element in the array.

Write a function or algorithm to efficiently solve this problem.

Example:

Input:

Array: [1, 2, 4, 6, 3, 7, 8]

Output:

Missing Element: 5

Explanation:

The missing element in the array is 5.


Question 21

Develop a program to arrange an unsorted array of integers into a wave array. An array arr[0..n-1] is considered in wave form if it satisfies the condition: 

arr[0] >= arr[1] <= arr[2] >= arr[3] <= arr[4] >= …..

Example:

Input:  arr[] = {10, 5, 6, 3, 2, 20, 100, 80}

Output: arr[] = {10, 5, 6, 2, 20, 3, 100, 80} 

Input: arr[] = {20, 10, 8, 6, 4, 2}

Output: arr[] = {20, 8, 10, 4, 6, 2}


Question 22

Formulate a program to sort a binary array with the objective of minimizing the number of swaps. The program should adhere to the constraint that only adjacent elements are permissible for swapping.

Example:

Input : [0, 0, 1, 0, 1, 0, 1, 1]

Output : 3

1st swap : [0, 0, 1, 0, 0, 1, 1, 1]

2nd swap : [0, 0, 0, 1, 0, 1, 1, 1]

3rd swap : [0, 0, 0, 0, 1, 1, 1, 1]

Input : Array = [0, 1, 0, 1, 0]

Output : 3


Question 23

Create an algorithm to efficiently sort an array of N elements, considering that each element is at most K positions away from its target position. The algorithm should achieve a time complexity of O(N log K).

Example:

Input: arr[] = {6, 5, 3, 2, 8, 10, 9}, K = 3 

Output: arr[] = {2, 3, 5, 6, 8, 9, 10}

Input: arr[] = {10, 9, 8, 7, 4, 70, 60, 50}, k = 4


Output: arr[] = {4, 7, 8, 9, 10, 50, 60, 70}


Question 24

Develop a program to determine whether an array, consisting of both positive and negative numbers, contains a subarray (of minimum size one) with a sum equal to zero.

Example:

Input: {4, 2, -3, 1, 6}

Output: true 

Explanation:

There is a subarray with zero sum from index 1 to 3.

Input: {4, 2, 0, 1, 6}

Output: true

Explanation: The third element is zero. A single element is also a sub-array.


Question 25

Create a program to identify the index of the first repeating element in an array of integers, where the first occurrence of the repeating element has the smallest index.

Example:

Input: arr[] = {10, 5, 3, 4, 3, 5, 6}

Output: 5 

Explanation: 5 is the first element that repeats

Input: arr[] = {6, 10, 5, 4, 9, 120, 4, 6, 10}

Output: 6 

Explanation: 6 is the first element that repeats


Question 26

Develop a program to determine the minimum number of times a given string A needs to be repeated such that another string B becomes a substring of it. If no solution exists, the program should output -1.

Example:

Input : A = “abcd”, B = “cdabcdab” 

Output : 3 

Repeating A three times (“abcdabcdabcd”), B is a substring of it. B is not a substring of A when it is repeated less than 3 times.

Input : A = “ab”, B = “cab” 

Output : -1 


Question 27

Create a program to capitalize the first and last characters of each word in a given string.


Question 28

Develop a program to calculate the sum of the minimum absolute differences within a given array.

Example:

Input: arr[]={2, 4, 5, 3};

Output: Minimum Absolute Difference Sum is 4

Question 29:

Create a program to identify all pairs of integers in an array whose sum equals a given target number.

Example:

Input: arr[] ={10, 12, 10, 15, -1, 7, 6, 5, 4, 2, 1, 1, 1}

Output: Count of pairs is 9


Question 30

Formulate a program to identify the first non-repeating element in an array of integers of size N.

Example:

Input: {-1, 2, -1, 3, 0}

Output: 2

Explanation: The first number that does not repeat is : 2

Input: {9, 4, 9, 6, 7, 4}

Output: 6

Leave a Comment

    🚀 Join Common Jobs Pro — Referrals & Profile Visibility Join Now ×
    🔥