InternDoor

Barclays interview prep

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

Practise them as a timed round20 roles open at Barclays

DSA 3

  1. DSAHard

    Finding every occurrence of a pattern of length m in a text of length n: how fast are the Z-algorithm and KMP, compared with checking each position directly?

    1. Both are O(n + m); the direct check is O(n * m) in the worst case
    2. Both are O(n log m); the direct check is O(n + m)
    3. Both are O(n * m), the same as the direct check
    4. The Z-algorithm is O(n^2) and KMP is O(n)
    Show the answer

    A. Both are O(n + m); the direct check is O(n * m) in the worst case

    Both reuse what earlier comparisons learned (the Z-array, or KMP's failure function) so they never re-read text characters. The Z-algorithm runs on pattern + "$" + text and reports positions where the Z-value equals m.

    This topic is named in a candidate’s interview report: Summer internship on-campus test, 2020, on GeeksforGeeks.

  2. DSAEasy

    Which property defines a binary max-heap?

    1. Every node is greater than or equal to its children, and the tree is complete, filled level by level from the left
    2. The left child is smaller than the node and the right child is larger
    3. Every level is sorted from left to right
    4. The root is the smallest element
    Show the answer

    A. Every node is greater than or equal to its children, and the tree is complete, filled level by level from the left

    The heap order gives the maximum at the root, and completeness lets the heap live in an array, with the children of index i at 2i + 1 and 2i + 2. Left smaller, right larger describes a binary search tree.

    This topic is named in a candidate’s interview report: On-campus interview with a VP, 2020, on GeeksforGeeks.

  3. DSAEasy

    What does this print?

    stack = []
    for x in [1, 2, 3]:
        stack.append(x)
    stack.pop()
    stack.append(4)
    print(stack[-1], len(stack))
    1. 3 3
    2. 4 2
    3. 4 3
    4. 1 3
    Show the answer

    C. 4 3

    A stack is last in, first out. After pushing 1, 2, 3, pop removes 3, and pushing 4 makes the stack [1, 2, 4]: the top is 4 and the size is 3.

    This topic is named in a candidate’s interview report: On-campus interview with a VP, 2020, on GeeksforGeeks.

Java 1

  1. JavaEasy

    What does this print?

    public class Main {
        public static void main(String[] args) {
            String s = "bank";
            String r = "";
            for (int i = s.length() - 1; i >= 0; i--) {
                r += s.charAt(i);
            }
            System.out.println(r);
        }
    }
    1. bank
    2. nkab
    3. kanb
    4. knab
    Show the answer

    D. knab

    The loop reads the characters from the last to the first and appends each one. new StringBuilder(s).reverse() does the same without building a new String on every step.

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

DBMS and SQL 1

  1. DBMS and SQLMedium

    In the three-level (ANSI/SPARC) DBMS architecture, what does the conceptual level describe?

    1. How the data is stored on disk, such as files and indexes
    2. The network between the client and the server
    3. Only what one group of users is allowed to see
    4. The whole database's logical structure, tables, relationships and constraints, independent of storage
    Show the answer

    D. The whole database's logical structure, tables, relationships and constraints, independent of storage

    The internal level is physical storage, the conceptual level is the logical schema of the whole database, and the external level is each user's view. The separation gives data independence: storage can change without changing the schema.

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

Prep for other employers

All employers
See who is hiring after Barclays

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