InternDoor

UST interview prep

18 practice questions on the topics candidates reported from UST interviews, with answers. The questions are ours; each one links to the interview report that names its topic.

Practise them as a timed round34 roles open at UST

DSA 3

  1. DSAMedium

    What is the length of the longest common subsequence of "STONE" and "LONGEST"?

    1. 2
    2. 3
    3. 4
    4. 5
    Show the answer

    B. 3

    dp[i][j] is the answer for the first i letters of one word and the first j of the other: equal letters give dp[i-1][j-1] + 1, otherwise the larger of dp[i-1][j] and dp[i][j-1]. "ONE" appears in order in both words. O(mn) time.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

  2. DSAEasy

    Merge sort splits the array in half, sorts each half and merges them. What is its time complexity, and its extra space for an array?

    1. O(n log n) time in every case, with O(n) extra space for merging
    2. O(n^2) time in the worst case, with O(1) extra space
    3. O(n) time, with O(log n) extra space
    4. O(n log n) time on average but O(n^2) in the worst case
    Show the answer

    A. O(n log n) time in every case, with O(n) extra space for merging

    There are log n levels of halving and each level merges n elements, whatever the input order. Merging needs a temporary array. Quick sort is the one that degrades to O(n^2).

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

  3. DSAEasy

    Which of these runs in O(log n) time on n items?

    1. Binary search for a key in a sorted array
    2. Finding the largest value in an unsorted array
    3. Comparing every pair of elements
    4. Printing every element
    Show the answer

    A. Binary search for a key in a sorted array

    Binary search halves what is left on every step, so it needs about log2 n steps: 20 steps for a million items. A scan of every element is O(n), and comparing every pair is O(n^2). n is the size of the input.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

Java 3

  1. JavaEasy

    How are the JDK, the JRE and the JVM related?

    1. The JDK contains the JRE plus tools such as javac; the JRE contains the JVM plus the standard libraries; the JVM runs bytecode
    2. The JVM contains the JDK
    3. The JRE is needed to compile Java, the JDK to run it
    4. They are three names for the same program
    Show the answer

    A. The JDK contains the JRE plus tools such as javac; the JRE contains the JVM plus the standard libraries; the JVM runs bytecode

    You compile with the JDK's javac to bytecode; the JVM inside the JRE runs that bytecode. Recent Java versions ship the JDK (or a jlink-built runtime) rather than a separate JRE download.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

  2. JavaMedium

    In Java, can you create an object of a static class?

    1. No, static classes can never be instantiated
    2. Yes, any top-level class can be declared static
    3. Only a nested class can be static, and yes: new Outer.Nested() works without any Outer object
    4. Only through reflection
    Show the answer

    C. Only a nested class can be static, and yes: new Outer.Nested() works without any Outer object

    A top-level class cannot be static. A static nested class is just a class scoped inside another, with no hidden reference to an outer instance, so it is created like any other class. An inner (non-static) class needs an outer object: outer.new Inner().

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

  3. JavaMedium

    What does this print?

    public class Main {
        public static void main(String[] args) {
            String a = "ust";
            String b = "ust";
            String c = new String("ust");
            System.out.println((a == b) + " " + (a == c) + " " + a.equals(c));
        }
    }
    1. true true true
    2. true false false
    3. false false true
    4. true false true
    Show the answer

    D. true false true

    String literals are interned in the String pool, so a and b are the same object. new String always makes a new object outside the pool, so a == c is false. equals compares the characters, so it is true. c.intern() would return the pooled one.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

OOP 1

  1. OOPEasy

    Which kind of inheritance does Java not allow between classes?

    1. Single inheritance
    2. Hierarchical inheritance
    3. Multilevel inheritance
    4. Multiple inheritance: a class can extend only one class, though it can implement many interfaces
    Show the answer

    D. Multiple inheritance: a class can extend only one class, though it can implement many interfaces

    Extending two classes would raise the diamond problem: which parent's fields and method win. Java allows one superclass and any number of interfaces; since Java 8, a clash between two default methods must be resolved in the class.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

DBMS and SQL 6

  1. DBMS and SQLMedium

    What does adding an index on a column usually do?

    1. Speeds up queries that search or sort on that column, at the cost of extra storage and slower inserts and updates
    2. Speeds up every query on the table, with no cost
    3. Prevents duplicate values in the column
    4. Compresses the table to save space
    Show the answer

    A. Speeds up queries that search or sort on that column, at the cost of extra storage and slower inserts and updates

    A B-tree index lets the database find matching rows in O(log n) instead of scanning the table. Every write must also update the index, so indexes go on columns that are searched often. Only a UNIQUE index stops duplicates.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

  2. DBMS and SQLEasy

    What is a trigger in SQL?

    1. A query that runs on a schedule, such as every night
    2. Code the database runs automatically when a chosen event, such as an INSERT, UPDATE or DELETE on a table, happens
    3. A constraint that stops NULL values
    4. Another name for a stored procedure the user calls by hand
    Show the answer

    B. Code the database runs automatically when a chosen event, such as an INSERT, UPDATE or DELETE on a table, happens

    A trigger can run BEFORE or AFTER the event, for example to write an audit row whenever a salary changes. A stored procedure, by contrast, runs only when it is called.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

  3. DBMS and SQLMedium

    emp has rows (1, Asha, NULL), (2, Ravi, 1), (3, Meena, 1) as (id, name, manager_id). How many rows does this return?

    SELECT e.name, m.name AS manager
    FROM emp e
    JOIN emp m ON e.manager_id = m.id;
    1. 3
    2. 1
    3. 2
    4. 0
    Show the answer

    C. 2

    A self join joins a table to itself under two aliases. Ravi and Meena each match Asha as manager; Asha has no manager, so the inner join drops her. A LEFT JOIN would keep her with a NULL manager, giving 3.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

  4. DBMS and SQLEasy

    A students table has a skills column holding values like "Python, SQL, Java". Which normal form does that break, and what is the fix?

    1. BCNF; split the table by primary key
    2. None; text columns may hold lists
    3. Third normal form; add an index on skills
    4. First normal form, which needs atomic values; move skills to a separate table with one row per student and skill
    Show the answer

    D. First normal form, which needs atomic values; move skills to a separate table with one row per student and skill

    1NF wants one value per cell. With a list in a cell you cannot index, join or count skills cleanly, and "find every SQL student" needs string matching. A student_skills table, keyed on (student_id, skill), fixes it.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

  5. DBMS and SQLEasy

    Why is a DBMS preferred over keeping data in plain files?

    1. It gives concurrent access with transactions, constraints that keep data consistent, indexes and a query language, and recovery after a crash
    2. Files cannot hold text
    3. A DBMS always uses less disk space
    4. Files cannot be backed up
    Show the answer

    A. It gives concurrent access with transactions, constraints that keep data consistent, indexes and a query language, and recovery after a crash

    With plain files every program has to handle locking, duplicates, partial writes and searching by itself. A DBMS does that once: ACID transactions, keys and constraints, indexed queries in SQL, and logs to recover.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

  6. DBMS and SQLEasy

    What is a stored procedure?

    1. A backup of a table
    2. A query the database runs automatically when a row changes
    3. A named block of SQL saved in the database, run with a call and able to take parameters
    4. An index on a view
    Show the answer

    C. A named block of SQL saved in the database, run with a call and able to take parameters

    A procedure runs where the data is, so a multi-step job costs one round trip, and access can be granted to the procedure rather than the tables. A trigger is the one that runs automatically on an INSERT, UPDATE or DELETE.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

Operating systems 1

  1. Operating systemsEasy

    What is the key difference between two processes and two threads of one process?

    1. Processes have separate address spaces; threads of one process share memory
    2. Threads cannot run at the same time
    3. Processes share memory; threads do not
    4. Threads each need their own copy of the program code
    Show the answer

    A. Processes have separate address spaces; threads of one process share memory

    Threads share the process's heap, globals and open files, so they communicate cheaply but need locks. Processes are isolated, so one crashing does not take the other down, and they talk through pipes, sockets or shared memory.

    This topic is named in a candidate’s interview report: Software engineer on-campus interview, Pune, 2023, on GeeksforGeeks.

Computer networks 1

  1. Computer networksMedium

    Which HTTP method is NOT idempotent?

    1. GET
    2. PUT
    3. DELETE
    4. POST
    Show the answer

    D. POST

    Repeating a PUT or DELETE leaves the server in the same state, but repeating a POST can create a second order. That is why payment APIs add idempotency keys.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

Web development 2

  1. Web developmentMedium

    MongoDB stores documents as BSON rather than plain JSON text. What does BSON add?

    1. Nothing: it is JSON with a different file extension
    2. Encryption of every field
    3. A binary encoding with lengths up front and extra types such as dates, 64-bit integers, binary data and ObjectId
    4. A schema the database enforces on every document
    Show the answer

    C. A binary encoding with lengths up front and extra types such as dates, 64-bit integers, binary data and ObjectId

    Length prefixes let MongoDB skip over fields without parsing them, and the extra types survive a round trip that JSON would turn into strings. It is not always smaller than JSON. Drivers convert to and from JSON for you.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

  2. Web developmentEasy

    What does this print?

    var a = 2;
    a = "ust";
    console.log(typeof a, a);
    1. number 2
    2. number ust
    3. It throws a TypeError
    4. string ust
    Show the answer

    D. string ust

    JavaScript is dynamically typed: the variable has no fixed type, the value does. Reassigning a string is allowed. Only const forbids reassignment, and that would throw a TypeError whatever the new value's type.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

Software engineering 1

  1. Software engineeringEasy

    What is the difference between Git and GitHub?

    1. Git is the version control tool that runs on your machine; GitHub is a service that hosts Git repositories and adds pull requests, issues and CI
    2. They are the same product
    3. GitHub is the command line, Git is the website
    4. Git only works with GitHub
    Show the answer

    A. Git is the version control tool that runs on your machine; GitHub is a service that hosts Git repositories and adds pull requests, issues and CI

    Git keeps the full history locally and works with no network. GitHub, like GitLab or Bitbucket, is one place to push a copy so a team can share it and review changes.

    This topic is named in a candidate’s interview report: Software engineer full-time interview, 2024, on GeeksforGeeks.

Prep for other employers

All employers
See who is hiring after UST

Engineering internships and entry-level jobs in India, newest first.