📜  Commvault 面试体验(校内)

📅  最后修改于: 2022-05-13 01:58:12.028000             🧑  作者: Mango

Commvault 面试体验(校内)

Commavault访问了我们的校园,招聘SDE (C++/ Java)SDET(PYTHON)职位如果你 选择 您将获得C++/ Java语言 SDE 角色Python SDET 角色。

第一轮:在他们的平台上进行在线编码。网络摄像头已打开。有 15 个 MCQ 和 3 个编码问题。 MCQ 主要基于 OOP,以及一个简单的和两个中等的编码问题。

  1. 最长回文子串
  2. BST的两个节点之间的最大元素

不记得基于异或。

第二轮:虚拟文件系统的实现。 我们必须完成他们的虚拟文件系统的代码。这一轮是6个小时。整个代码将在 6 小时内完成。

Java
import java.io.*;
  
import java.math.BigInteger;
  
import java.security.MessageDigest;
  
import java.security.NoSuchAlgorithmException;
  
// Java class to calculate MD5 hash value
  
class MD5 {
  
    public static String getMd5(String input)
    {
  
        try {
  
            // Static getInstance method is called with
            // hashing MD5
  
            MessageDigest md
                = MessageDigest.getInstance("MD5");
  
            // digest() method is called to calculate
            // message digest
  
            // of an input digest() return array of byte
  
            byte[] messageDigest
                = md.digest(input.getBytes());
  
            // Convert byte array into signum representation
  
            BigInteger no
                = new BigInteger(1, messageDigest);
  
            // Convert message digest into hex value
  
            String hashtext = no.toString(16);
  
            while (hashtext.length() < 32) {
  
                hashtext = "0" + hashtext;
            }
  
            return hashtext;
        }
        catch (
            NoSuchAlgorithmException
                e) { // incorrect message digest algorithms
  
            throw new RuntimeException(e);
        }
    }
}
  
class CV_SIOManager {
  
    public CV_SIOManager() {}
  
    public CVFile CVGetFile(
        final String
            filePathName) // Returns the reference to the
                          // CVFile object for the given
  
    // filePathName.
  
    {
  
        // Put your code here
  
        return null;
    }
  
    public void
    CVDisplayStats() // Display the whole stats that
                     // CV_SIOManager holds.
  
    {
  
        // Put your code here
    }
  
    public int CVDeleteFile(
        final String filePathName) // Deletes a file in the
                                   // given path.
  
    {
  
        // Put your code here
  
        return 0;
    }
  
    public int CVMoveFile(
        final String sourcePathName,
        final String targetPathName) // Moves file from one
                                     // location to
  
    // another.
  
    {
  
        // Put your code here
  
        return 0;
    }
  
    public int CVCopyFile(
        final String sourcePathName,
        final String targetPathName) // Copies file from one
                                     // location to
  
    // another.
  
    {
  
        // Put your code here
  
        return 0;
    }
}
  
class CVFile {
  
    private String fileName;
  
    public CVFile()
    {
  
        // put your code here
    }
  
    public CVFile(
        final String filePathName,
        final String
            content) // Creates a file with given content.
  
    {
  
        // Put your code here
  
        fileName = filePathName;
    }
  
    public void CVModifyFile(
        final String
            content) // Modifies and rewrites the content of
                     // a file with given content.
  
    {
  
        // Put your code here
    }
  
    public int
    CVReadFile(int revision, /* output */ String
                   content) // Reads file content based on
                            // the given revision.
  
    {
  
        // Put your code here
  
        return 0;
    }
  
    public int CVTrim() // Trims all previous versions and
                        // only holds on to latest content
  
    {
  
        // Put your code here
  
        return 0;
    }
}
  
/*****
  
* NOTE ---- 1. Do not make any modifications to main(). 2.
Every filePathName
  
* given in this problem is the absolute file path with file
name like
  
* DriveName:\\Path\\To\\FileName (Eg: C:\\A.txt).
  
*****/
  
public class SIOManagerDriver {
  
    public static void main(String[] args)
    {
  
        CV_SIOManager sm = new CV_SIOManager();
  
        String contentInFile = "";
  
        CVFile fx;
  
        CVFile f1 = new CVFile("C:\\File1.txt",
                               "Welcome to Commvault 1!");
  
        CVFile f2 = new CVFile("C:\\File2.txt",
                               "All The Best 2!");
  
        CVFile f2_1 = new CVFile("C:\\File2_1.txt",
                                 "All The Best 2!");
  
        CVFile f9
            = new CVFile("C:\\File9.txt", "This is File 9");
  
        sm.CVDisplayStats();
  
        CVFile f4
            = new CVFile("C:\\File4.txt", "Good Luck 4!");
  
        CVFile f4_1
            = new CVFile("C:\\File4_1.txt", "Good Luck 4!");
  
        sm.CVDisplayStats();
  
        CVFile f10
            = new CVFile("D:\\File10.txt", "Good Luck 10!");
  
        CVFile f20 = new CVFile("D:\\File20.txt",
                                "Welcome to Commvault 20!");
  
        CVFile f50 = new CVFile("D:\\File50.txt",
                                "Best Place to Work 50!");
  
        CVFile f20_1 = new CVFile(
            "D:\\File20_1.txt", "Welcome to Commvault 20!");
  
        sm.CVDisplayStats();
  
        CVFile f60 = new CVFile("D:\\File60.txt",
                                "All THE Best 60!");
  
        CVFile f70 = new CVFile("D:\\File70.txt",
                                "All The Best 70!");
  
        CVFile f70_1
            = new CVFile("D:\\File70.txt", "Commvault 70!");
  
        sm.CVDisplayStats();
  
        fx = sm.CVGetFile("D:\\File60.txt");
  
        if (null != fx) {
  
            fx.CVReadFile(-5, contentInFile);
  
            System.out.println(contentInFile);
        }
  
        f4.CVModifyFile("Welcome to Commvault 4!");
  
        fx = sm.CVGetFile("C:\\File4.txt");
  
        if (null != fx) {
  
            fx.CVReadFile(0, contentInFile);
  
            System.out.println(contentInFile);
        }
  
        fx = sm.CVGetFile("C:\\File4.txt");
  
        if (null != fx) {
  
            fx.CVReadFile(-1, contentInFile);
  
            System.out.println(contentInFile);
        }
  
        sm.CVDisplayStats();
  
        sm.CVMoveFile("C:\\File9.txt", "D:\\File30.txt");
  
        sm.CVMoveFile("C:\\File4.txt", "D:\\File2.txt");
  
        sm.CVDisplayStats();
  
        sm.CVCopyFile("C:\\File4.txt", "D:\\File21.txt");
  
        sm.CVCopyFile("C:\\File3.txt", "C:\\File40.txt");
  
        sm.CVDisplayStats();
  
        sm.CVDeleteFile("D:\\File20.txt");
  
        sm.CVDisplayStats();
  
        sm.CVDeleteFile("C:\\File1.txt");
  
        sm.CVDeleteFile("C:\\File4.txt");
  
        sm.CVDisplayStats();
  
        sm.CVDeleteFile("D:\\File7.txt");
  
        sm.CVDeleteFile("D:\\File70.txt");
  
        sm.CVDeleteFile("D:\\File30.txt");
  
        sm.CVDisplayStats();


不幸的是,没有人被选中参加面试。

祝一切顺利!