Join Regular Classroom : Visit ClassroomTech

Optum – Overall Interview Questions + Coding Solutions – codewindow.in

Hot Topics

Optum Solution

Technical Round

Data structure for finding all files under a drive.

For finding all files under a drive, a tree-like data structure can be used, where the root node represents the drive and each child node represents a subdirectory. The data structure can be implemented as a file system tree (FST) or a directory tree.
In an FST, each node has a reference to its parent node, allowing us to traverse the tree in both directions. This makes it easier to find the parent directory of a given file or to traverse the entire tree.
In a directory tree, each node has a reference to its children nodes, allowing us to traverse the tree in a top-down manner, starting from the root. This makes it easier to find all files under a specific directory.
Both data structures have their advantages and trade-offs, but in general, a directory tree is more appropriate for finding all files under a drive, as it allows us to traverse the tree in a top-down manner and search for files in a specific subdirectory without traversing the entire tree.

What is SDLC, technology,MVC,WCF,Java Script.

SDLC (Software Development Life Cycle) refers to a set of standardized steps that software development organizations follow to develop high-quality software. The steps usually include Requirements Gathering and Analysis, Design, Implementation, Testing, Deployment, and Maintenance.
Technology refers to the tools, methods, and systems used in the production, development, and use of products or services. It encompasses various fields such as computing, electronics, and mechanics.
MVC (Model-View-Controller) is an architectural pattern used in software development to separate the concerns of the application into three distinct components: the Model, the View, and the Controller. The Model represents the data and business logic, the View is responsible for rendering the data, and the Controller handles user interactions.
WCF (Windows Communication Foundation) is a framework for building service-oriented applications in .NET. It provides a unified programming model for building, deploying, and consuming services on a variety of platforms and protocols.
JavaScript is a high-level, interpreted programming language used for client-side web development. It is used to create dynamic web pages and provide interactive features such as form validation, mouse events, and dynamic content updates.

How would you design user authentication using C++?

Designing user authentication using C++ involves the following steps:
  1. Choose a password storage mechanism: You can store passwords as hashed strings with a unique salt value for each user. The salt value is added to the password string before hashing to prevent dictionary attacks.
  2. Design a login function: The login function should take the user’s username and password as inputs, retrieve the user’s hashed password from the database and compare it with the hashed value of the input password after applying the same salt value.
  3. Implement security measures: To prevent various security attacks, you can implement measures such as rate limiting, hashing the password with a strong algorithm, using SSL/TLS to secure the connection, etc.
  4. Provide options for password recovery: Implement a password recovery mechanism in case the user forgets their password. This could be either through email or security questions.
  5. Implement session management: After the user has successfully logged in, the system should create a session for the user to keep track of their activity. The session should be invalidated after a specified time or after the user logs out.
  6. Implement logging: The system should log all login attempts and other relevant information for auditing and security purposes.

What is binary search?

Binary search is a sorting algorithm that is used upon sorted array to repeatedly divide the search interval in half and search for the value.

Designing a Shopping Cart. What data structures I would you use in such scenarios? SQL Queries.

To design a shopping cart, you could use the following data structures:
  • Arrays or lists to store the items in the cart
  • Stacks to implement undo and redo actions in the cart
  • Hash tables or dictionaries to store item-quantity pairs and provide fast lookups
In terms of SQL queries, you would need to store the items and their details in a database table, and the shopping cart data in another table with columns for the item ID, quantity, and user ID. To retrieve the items in a user’s cart, you could use a SELECT statement with a JOIN on the two tables to retrieve the item details and quantities in the cart. To add or remove items, you would use INSERT or DELETE statements.

Oops Concept, HashMap implementation, Concurrent HashMap.

In Object-Oriented Programming (OOP), the Object-Oriented Programming Concepts (OOPS) are fundamental concepts that provide a way to structure and organize code. Some of the main OOP concepts include encapsulation, inheritance, and polymorphism.
A HashMap is a collection class in Java that implements the Map interface. It is used to store key-value pairs, where each key is unique. To implement a HashMap, you can use the built-in Java HashMap class or create your own implementation using an array and a hash function.
A ConcurrentHashMap is a thread-safe implementation of HashMap in Java, where multiple threads can access the map and perform operations such as adding, updating, and removing elements concurrently. The ConcurrentHashMap class provides a higher level of concurrency compared to HashMap, as it allows multiple threads to perform operations on the map simultaneously, without blocking each other.

Code to find if sum of factorial of digits of a number is equal to the number using c/c++.

#include <iostream>
#include <unordered_map>

using namespace std;

unordered_map<int, int> factorials;

// Function to calculate the factorial of a number
int factorial(int n) {
    if (n == 0 || n == 1) {
        return 1;
    }
    return n * factorial(n - 1);
}

// Function to calculate the sum of the factorials of the digits of a number
int sum_of_factorial_of_digits(int n) {
    int sum = 0;
    while (n > 0) {
        int digit = n % 10;
        if (factorials.count(digit) == 0) {
            factorials[digit] = factorial(digit);
        }
        sum += factorials[digit];
        n /= 10;
    }
    return sum;
}

int main() {
    int n;
    cout << "Enter a number: ";
    cin >> n;

    // Check if the sum of the factorials of the digits of the number is equal to the number
    if (sum_of_factorial_of_digits(n) == n) {
        cout << "The sum of the factorials of the digits is equal to the number" << endl;
    } else {
        cout << "The sum of the factorials of the digits is NOT equal to the number" << endl;
    }
    return 0;
}
/*
OUTPUT -
Enter a number: 121
The sum of the factorials of the digits is NOT equal to the number
*/

What is the difference between PUT and POST?

PUT and POST are two common HTTP methods used for sending data to a server. The main difference between the two is the intent behind their use:
  • PUT: The PUT method is used to update a resource on the server. It is typically used when you want to update an existing resource, such as a file or database record, with new data. The PUT method requires the client to send the complete resource representation, including all its attributes, as the request body.
  • POST: The POST method is used to create a new resource on the server. It is typically used when you want to submit data to a form or create a new database record. The POST method allows the client to send partial data, and the server can then use this data to create a new resource.
In general, if you want to modify an existing resource, you should use PUT, and if you want to create a new resource, you should use POST. However, it is important to note that these methods are not strictly enforced, and a server may choose to implement them in different ways.

What is Multi-Threading in Java?

Multi-threading is a process in Java in which two or more threads executes simultaneously for maximum utilization of the CPU.

Write a code of Fibonacci series in recursion.

#include<stdio.h>
int main(){
    int num,a=0,b=1,i,next;
    scanf("%d",&num);//Lenghth of the series
    printf("%d\n%d\n",a,b);//0 1

    //We have to print num-2=3
    for(i=1;i<num;i++){
        next=a+b; //next=0+1=1
        a=b;      //a=1
        b=next;   //b=1
        printf("%d\n",next);
    }
   
}
/*
OUTPUT
5
0
1
1
2
3
5
*/

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories