Join Regular Classroom : Visit ClassroomTech

Commvault Systems Overall Interview Questions + Coding Solution – codewindow.in

Hot Topics

Commvault Systems Solution

Technical Round

Address arithmetic in K &amp.

Address arithmetic in C refers to the manipulation of pointers, which are variables that hold memory addresses. The main use of address arithmetic is to traverse arrays and other data structures in memory.

Find the smallest number, greater than a given number p, which does not have ’11’ in its binary representation.

To find the smallest number greater than a given number p that does not have the binary sequence 11 in its binary representation, you can use the following algorithm:
  1. Increment p by 1.
  2. Convert the number to its binary representation.
  3. Check if the binary representation contains the sequence 11.
  4. If it does, repeat steps 1 to 3.
  5. If it doesn’t, return the number.
Here is a sample implementation in Python:
def find_smallest_number(p):
    while True:
        p += 1
        binary = bin(p)[2:]
        if '11' not in binary:
            return p
You can test the function with the following code:
p = 10
result = find_smallest_number(p)
print(result)  
# Output: 12

Questions were mostly based on computer networks, operating systems and DBMS. No questions at all on programming or data structures. Only theoretical knowledge is not sufficient, questions were mostly application oriented.

I apologize for not focusing on your area of interest. To perform well in an interview that focuses on computer networks, operating systems, and DBMS, it’s important to have a solid understanding of the underlying concepts, as well as the ability to apply that knowledge to real-world problems. Here are a few areas you may want to focus on:
  1. Computer Networks: Network protocols (TCP/IP, UDP, HTTP, FTP, SMTP, etc.), network topologies (star, bus, ring, mesh, etc.), data transmission (circuit switching, packet switching), and network security (firewalls, encryption, access control).
  2. Operating Systems: Process and thread management, memory management (segmentation, paging), file systems, and system calls.
  3. DBMS: Database normalization (1NF, 2NF, 3NF, etc.), SQL queries, transactions, database design, and database security.
In addition to studying these topics, you may also want to practice solving real-world problems related to these areas. This can include working on projects or doing practice problems from books or online resources. Good luck with your interview preparation!

There was hashmap code written with errors in it. JavaScript: function is declared. It is called with window. functionName(), will it execute?

If the function functionName is declared in the global scope and is called with window.functionName(), it will execute if there are no syntax errors in the function definition.
However, it’s worth noting that window.functionName() is a way to access the global function functionName in the JavaScript window object. In modern JavaScript, it’s more common to use the window object implicitly and simply call the function with functionName().
Here’s an example to illustrate:
function functionName() {
  console.log("Function executed");
}

window.functionName(); // Output: "Function executed"

What is the difference between .exe and .dll files?

.exe and .dll are two different types of file formats in the Windows operating system.
.exe stands for “executable” and is used to designate a file that can be run as a standalone application. An .exe file contains all the necessary instructions and resources needed to run a program. When you double-click an .exe file, the operating system starts executing the code in the file.
.dll stands for “dynamic link library” and is used to store code and resources that can be shared by multiple programs. Unlike .exe files, .dll files cannot be run by themselves. Instead, they are loaded into memory by other programs and used as needed. This allows multiple programs to share code and resources, reducing the amount of memory and disk space used by each program.
In summary, .exe files are standalone executables while .dll files are shared libraries that are loaded into memory by other programs.

Difference between composition and inheritance.

Composition
Inheritance
1.Composition is a way to implement “has a” relationship.
Inheritance is way to implement “is a” relationship.
2. Multiple classes functionalities can be used.
We can extend one class so that we can reuse the code of only one class.
3. Multiple inheritance can be achieved using composition.
Java does not support multiple inheritance. 

How can you copy files from one directory to another using Python?

We can copy files from one directory to another using copy2 () method in Python.

char *a=”something”; Valid / Invalid.

In C and C++, the following code:
char *a = "something";
is considered valid. It declares a pointer a of type char * and initializes it with a string literal “something”.
However, it is worth noting that string literals in C and C++ are stored in read-only memory, and attempting to modify them can result in undefined behavior. If you need to modify the contents of the string, you should declare an array of characters and copy the string into the array.

Write a class for user defined exception.

In Python, you can define custom exceptions by creating a new class that inherits from the built-in Exception class. Here’s an example of how you might define a custom exception class:
class CustomException(Exception):
    def __init__(self, message):
        self.message = message

try:
    raise CustomException("This is a custom exception")
except CustomException as e:
    print(e.message)
#OUTPUT - This is a custom exception
In this example, the CustomException class is defined with a constructor that takes a message argument. When an instance of this class is raised as an exception, you can access the message attribute to retrieve the error message.
You can add additional methods or attributes to the custom exception class as needed to provide more information about the exception. When defining custom exceptions, it’s a good idea to choose descriptive names for your exceptions and to document their intended use.

What is use of zip function in Python?

Zip function is used to map the similar index of multiple containers so that they can be used just using a single entity

Check if string1 is a rotation of string2 and the degree of rotation.

To check if a string string1 is a rotation of another string string2, you can concatenate string1 with itself and then check if string2 is a substring of the result. Here’s an example implementation in Python:
def is_rotation(string1, string2):
    if len(string1) != len(string2):
        return False

    doubled = string1 + string1
    return string2 in doubled

def find_rotation_point(string1, string2):
    if not is_rotation(string1, string2):
        return -1

    return len(string1) - doubled.index(string2)

string1 = "hello"
string2 = "llohe"

if is_rotation(string1, string2):
    rotation_point = find_rotation_point(string1, string2)
    print("'{}' is a rotation of '{}', rotated {} degrees".format(string2, string1, rotation_point))
else:
    print("'{}' is not a rotation of '{}'".format(string2, string1))
In this example, the is_rotation function concatenates string1 with itself and then checks if string2 is a substring of the result. If string2 is found in the result, then string1 is a rotation of string2. The find_rotation_point function calculates the number of characters by which string2 has been rotated relative to string1. It returns the result by subtracting the starting position of string2 in doubled from the length of string1.

Print out the values of a BST in CCW order, only printing the ‘border’ elements

To print the values of a binary search tree (BST) in counterclockwise (CCW) order while only printing the “border” elements, you can use a combination of in-order, pre-order, and post-order traversals. Here’s an example implementation in Python:
class Node:
    def __init__(self, value):
        self.value = value
        self.left = None
        self.right = None

def print_ccw_border(root):
    if not root:
        return

    print(root.value, end=" ")

    if not root.left and not root.right:
        return

    leftmost = root.left
    while leftmost.left:
        print(leftmost.value, end=" ")
        leftmost = leftmost.left

    stack = [root.right]
    while stack:
        node = stack.pop()
        if node:
            print(node.value, end=" ")
            stack.append(node.right)
            stack.append(node.left)

root = Node(10)
root.left = Node(5)
root.right = Node(15)
root.left.left = Node(2)
root.left.right = Node(7)
root.right.left = Node(12)
root.right.right = Node(20)

print_ccw_border(root)
In this example, the print_ccw_border function first prints the value of the root node. If the root has no children, it returns. Otherwise, it first prints the value of the leftmost leaf node by following the left pointers from the root to the leftmost leaf. Then, it uses a stack to traverse the right subtree in pre-order and print the values of the border elements, i.e., the right-most leaf node and the right child of each parent node.

Given a budget N, and K gifts each with their own prices, select the max amount of gifts you can purchase.

One way to approach this problem is to use a greedy algorithm. The idea is to sort the gifts in non-descending order based on their prices and then pick as many gifts as possible until the budget N is exhausted. Here’s an implementation in Python
def max_gifts(N, gifts):
    gifts.sort()
    count = 0
    for i in gifts:
        if N >= i:
            count += 1
            N -= i
        else:
            break
    return count

N = 50
gifts = [10, 20, 30, 40, 50]
print(max_gifts(N, gifts))
In this example, the max_gifts function sorts the list of gifts based on their prices and then iterates through the list. If the budget N is greater than or equal to the price of the gift, the gift is purchased and the budget is reduced by the price. If the budget is less than the price, no more gifts can be purchased, so the loop breaks and the function returns the number of gifts that can be purchased.
Given an array (1, 5, 10, 11), find the given sum. Sum =15, check which two set of data will give you the sum.
One way to approach this problem is to use a greedy algorithm. The idea is to sort the gifts in non-descending order based on their prices and then pick as many gifts as possible until the budget N is exhausted. Here’s an implementation in Python
def find_sum(arr, target):
    start = 0
    end = len(arr) - 1
    while start < end:
        if arr[start] + arr[end] == target:
            return (arr[start], arr[end])
        elif arr[start] + arr[end] < target:
            start += 1
        else:
            end -= 1
    return None

arr = [1, 5, 10, 11]
target = 15
print(find_sum(arr, target))
In this example, the find_sum function takes an array and a target sum as input. The start and end pointers are initialized to the beginning and end of the array, respectively. In each iteration of the while loop, the sum of the elements pointed to by start and end is calculated. If the sum is equal to the target, the pair of elements is returned. If the sum is less than the target, the start pointer is moved to the right. If the sum is greater than the target, the end pointer is moved to the left. If the pointers cross each other, it means that no such pair exists, and None is returned.

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories