Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views6 pages

Inverse Coding - R1 (Set 1)

The document contains a set of coding and conceptual questions divided into three difficulty levels: easy, medium, and hard, covering topics in C++ and Java programming. It also includes programming questions that require understanding of C and C++ code behavior, as well as aptitude questions involving mathematical reasoning and pattern recognition. Overall, it serves as a comprehensive assessment tool for evaluating knowledge in programming and logical reasoning.

Uploaded by

riduvarshinias
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Inverse Coding - R1 (Set 1)

The document contains a set of coding and conceptual questions divided into three difficulty levels: easy, medium, and hard, covering topics in C++ and Java programming. It also includes programming questions that require understanding of C and C++ code behavior, as well as aptitude questions involving mathematical reasoning and pattern recognition. Overall, it serves as a comprehensive assessment tool for evaluating knowledge in programming and logical reasoning.

Uploaded by

riduvarshinias
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Set 1

Inverse coding - Round 1 (Set A)

Conceptual questions - 10 (1 point)


Easy :
1.Which type of polymorphism is achieved at runtime in C++?
A) Function Overloading​
B) Function Overriding​
C) Operator Overloading​
D) Constructor Overloading

2.In Java, which collection would you use to maintain a list of unique elements in sorted order?
A) ArrayList ​ ​ B) HashMap
C) TreeSet​ ​ D) LinkedList

3.Which type of constructor in C++ is called when an object is created using another object of the
same class?
A) Default Constructor
B) Parameterized Constructor
C) Copy Constructor
D) Move Constructor

4.Which OOP concept ensures that an object maintains its own copy of data rather than sharing it with
others?
A) Deep Copy
B) Shallow Copy
C) Virtual Function
D) Operator Overloading

5. In C++, which keyword is used to allocate memory dynamically for an object?


A) malloc
B) new
C) calloc
D) allocate

Medium :
6. You are developing a spell checker that needs to check if a word exists in a dictionary. Which data
structure would provide the most efficient lookup time?
A) Hash Table​ ​ B) Self-Balancing Binary Search Tree
C) Trie ​​ ​ D) Radix Tree

7.What is the time complexity of searching for an element in a balanced binary search tree with n
elements?
A) O(1) ​ ​ B) O(log n)
C) O(n) ​ ​ D) O(n log n)

8. In C++, what is the difference between new and malloc() ?


A) new calls constructors, malloc() does not
B) malloc() is faster than new
C) new can only allocate memory for primitive types
D) malloc() automatically handles memory deallocation

Hard :
9. A company needs to analyze financial transactions to detect potentially fraudulent patterns. Given
millions of transactions, which algorithm would be most efficient for clustering similar transaction
patterns?
A) K-Means Clustering​ ​ ​ ​ B) Merge Sort
C) Hashing with Open Addressing​ ​ D) Expectation-Maximization Algorithm

10.A network routing system must compute optimal paths between millions of nodes in a dynamic
graph where edge weights (representing latencies) change constantly. The system needs to recompute
affected paths within microseconds when topology changes occur. Which algorithm and data structure
combination would be most efficient?
A) Incremental Dijkstra with Fibonacci Heaps
B) Dynamic A* with Custom Heuristics and Priority Queues
C) Delta-Stepping with Parallel Relaxation
D) Distance-Vector Multipath with Distributed Bellman-Ford

Program questions - 5 (2 points)


1. What is the final value of X in the following C Program?7

void func(int *p) {​


​ static int y = 2;​
​ *p += y;​
​ y *= 2;​
}​

int main() {​
​ int x = 5;​
​ for (int i = 0; i < 3; i++) {​
​ func(&x);​
​ }​
​ printf("X : %d", x);​
​ return 0;​
}

A)​ 11
B)​ 19
C)​ 5
D)​ 35

2) What is the final value of y in the above program?

A)​ 16
B)​ 8
C)​ 2
D)​ 6

3) What would happen if the following Java program was executed?

public class Main{​


​ public static void main(String[] args){​
​ try {​
​ int x = 5 / 0;​
​ } catch (Exception e){​
​ System.out.println("General Exception");​
​ } catch (ArithmeticException e){​
​ System.out.println("Arithmetic Exception");​
​ }​
​ }​
}

A)​ Arithmetic Exception


B)​ General Exception
C)​ Compilation Error
D)​ Runtime Error

4) What is wrong with the following C program?

#include <stdio.h>​
#include <stdlib.h>​

int* getPointer() {​
​ int x = 10;​
​ return &x;​
}​

int main() {​
​ int *ptr = getPointer();​
​ printf("%d\n", *ptr);​
​ return 0;​
}

A)​ No issues, the program runs fine


B)​ Segmentation fault due to accessing freed memory
C)​ Undefined behavior due to returning a pointer to a local variable
D)​ Memory leak due to not freeing allocated memory

5) What would be the output of the following C++ program?

#include <iostream>​
using namespace std;​

template <typename T>​
void func(T val){​
​ cout<<" ITRIX solos ";​
}​

template<>​
void func<int>(int val){​
​ cout<<" Everything else ";​
}​

int main(){​
​ func(10.0);​
​ func(10);​
​ return 0;​
}

A)​ Everything else ITRIX solos


B)​ Compilation error
C)​ Race condition (undefined behaviour)
D)​ ITRIX solos Everything else

Aptitude questions - 5 (1 point)


1. If (2x-y)=4 then (6x-3y) =?

2.In a race of 200 meters, A can beat B by 20 meters, and B can beat C by 10 meters. By how many
meters can A beat C in the same race?
A) 28 meters
B) 29 meters
C) 32 meters
D) 36 meters

3. In the following question, select the odd pair of figures from the given alternatives. In each pair, the
figure to the left of (:) is related to the figure to the right of (:) by some logic/ rules/ relation :
A) ​ ​ ​ ​ B)

C) ​ ​ ​ ​ D)

4. Paw : Cat :: Hoof : ?


A. Lamb
B. Horse
C. Elephant
D. Tiger

5. Look at this series: 90 , 9, 40, 11, 61, 13, x, 15


What is the value of x?
a. 14
b. 15
c. 90
d. 23

You might also like