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

Mock Interview Question Final

Mock interview questions

Uploaded by

Ajay
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)
115 views6 pages

Mock Interview Question Final

Mock interview questions

Uploaded by

Ajay
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

CEI INDIA DRIVE – 2025 BATCH

TECHNICAL MOCK TEST


Total Marks: 50

1. In tree construction which of the following is a suitable efficient data is structure?


A) Array B) Linked List C) Stack D) Queue

2. A characteristic of data that binary search uses but linear search ignores is
A) length of the list B) order of the list 2
C) the maximum n value of the list D) None of these

3. The time complexity of the linear search algorithm is


A) O(log n) B) O(n) C) O(n2) D) O(1)

4. Which variable cannot be used outside its scope?


A) Local variable B) Global variable C) Constant D) Bi-variable

5. ANSI C approves how many maximum case labels?


A) 257 B) 275 C) 260 D) 259

6. A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-


order traversal of the heap is given below: 10, 8, 5, 3, 2 two new elements "1 and "7 are
inserted in the heap in that order. The level-order traversal of the heap after the insertion of
the elements is:
A) 10, 8, 7, 1,2, 3,5 B) 10, 8, 7, 2, 3, 1, 5
C) 10, 8, 7, 3, 2, 1, 5 D) 10, 8, 7, 5, 3, 2, 1

7. We are given a set of n distinct elements and an unlabelled binary tree with n nodes. In
how many ways can we populate the tree with the given set so that it becomes a binary search
tree?
A) n! B) 0 C) (1/(n+1),2nCn D) 1

8. The default executable generation on UNIX for a C program is


A) a B) out.a C) a.exe D) a.out

9. Which is private member functions access Scope?


A) Member functions which are accessible in derived class
B) Member functions which can only be used within the class
C) Member functions which can’t be accessed inside the class
D) Member functions which can used outside the class

10. Sorting is not possible by using which of the following methods?


A) Insertion B) Selection C) Exchange D) Deletion

11. What is the output of the following code snippet?


#include<stdio.h>
main() {
Const int a = 5;
printf("%d", A);}
A) Compiler Error B) 5 C) Runtime Error D) 6
12. What will be the value of one.title, one.price and two.title?
class book
{
private:
string title, grade
integer price, tax
public: function book( ){title ="Sanskrit"; price = 100; tax = 5;)
function input(string name ){title = name}
}
function main {
book one, two
input("Maths")
}

A) Maths, cannot be determined, cannot be determined B) Sanskrit, 100, Sanskrit


C) Maths, 100, Sanskrit D) Maths, 100, cannot be determined

13. What is the output of the following program?


#include<stdio.h>
main()
{
union abc
{
int x;
char ch;
}var;
var.ch = 'A!;
printf("%d", var.x)
}
A) Garbage Value B) 65 C) A D)97

14. What is the output of the following program?


#include <stdio.h>
main()
{
char s1[50], s2/501= "Hello";
s1 = s2;
printf("%s", s1);
}
A) Runtime Error B) Hello C) No Output D) Compile Error

15. What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1 (head->next);
printf("%d", head->data);
}
A) Prints all nodes of linked list in reverse order
B) Prints alternate nodes of Linked List
C) Prints alternate nodes in the reverse order
D) Prints all nodes of the linked list

16. How to measure the size of any variable without “size of” operator?

17. How to merge two sorted linked list, so the resulting linked list is also sorted?

18. Suggest an efficient method to count the no. of 1’s in a 32bit no. Remember without using
loop & testing each bit?

19. How to swap the left and right children for each node of the given root node of a binary
tree?

20. Write a Program in C to Print all natural numbers up to N without using a semi-colon?

21. We cannot use the keyword ‘break’ simply within _________.


A) while B) for C) if-else D) do-while

22. Out of the following operations, which one is not possible in the case of a register variable?
A) Global declaration of the register variable
B) Copying the value from the memory variable
C) Reading any value into the register variable
D) All of the above

23. The correct format of declaring a function is:


A) type_of_return name_of_function (argument type);
B) type_of_return name_of_function (argument type){}
C) type_of_return (argument type) name_of_function;
D) all of the above

24. Determine what’s true for x, if we define x as “int *x[10];”?


A) This definition will only allocate 10 pointers but will not initialize them
B) The initialization must be explicitly performed
C) The definition will only allocate 10 pointers but will not initialize them. Also, the
initialization has to be explicitly performed
D) Error
25. Out of the following, which one is not valid as an if-else statement?
A) if ((char) x){} B) if (x){} C) if (func1 (x)){} D) if (if (x == 1)){}

26. The output of the C code mentioned below would be:


#include <stdio.h>
struct employee
{
int id;
char rank[5];
}
void main()
{
struct employee e;
s.no = 30;
printf(“howdy”);
}
A) hello B) Compile-time error C) 5, 30 D) Varies
27. What is the output of the following C code if there is no error in stream fp?
#include <stdio.h>
int main()
{
FILE *fp;
fp = fopen("newfile", "w");
printf("%d\n", ferror(fp));
return 0;
}
A) Compilation error B) 0 C) 1 D) Any nonzero value
28. What is the output of the above program?
#include <stdio.h>
int main()
{
int i = 3;
printf(\"%d\", (++i)++);
return 0;
}
A) 3 B) 4 C) 5 D) compile time error
29. The output of the C code mentioned below would be:
#include <stdio.h>
int main()
{
unsigned int i = 65000;
while (i++ != 0);
printf("%d", i);
return 0;
}
A) infinite Loop B) 0 C) 1 D) Run time error

30. For the following declaration of a function in C, pick the best statement?
int [] fun(void (*fptr)(int *));
A) It will result in compile error.
B) No compile error. fun is a function which takes a function pointer fptr as argument and
return an array of int.
C) No compile error. fun is a function which takes a function pointer fptr as argument and
returns an array of int. Also, fptr is a function pointer which takes int pointer as argument and
returns void.
D) No compile error. fun is a function which takes a function pointer fptr as argument and
returns an array of int. The array of int depends on the body of fun i.e. what size array is
returned. Also, fptr is a function pointer which takes int pointer as argument and returns void.

31 A City Bus is a Ring Route Bus which runs in circular fashion. That is, the Bus once started
at Source Bus Stop, halts at each Bus Stop in its Route and at the end it reaches to Source Bus
stop again. If there are n number of Stops and if bus starts at Bus Stop number 1, then after nth
Bus Stop, the next stop in the Route will be Bus Stop number1 always. If there are n stops,
there will be n paths. One path connects 2 stops. Distances (in meters) for all paths in Ring
Route is given in array Path[] as below. Path = 1800, 600. 750, 900, 1400, 1200, 1100, 1500]
Fare is determined based on the distance covered from source to destination stop as Distance d
between Input Source and Destination Stops can be measured by looking at values in array
Path[] and fare can be calculated as per following criteria: If d = 1000 meters, then fare= 5 INR
- (When calculating fare for other distances, the calculated fare containing any fraction value
should be celled. For example, for distance 900, when fare initially calculated is 4.5 which
must be ceiled to 5) Path is circular in function. Value at each index indicate distance till current
stop from previous one. And each index positions can be mapped with values at same index in
Busstops[] array, which is a string array holding abbreviation of names for all stops as
"THANERAILWAYSTN" "TH", "GAONDEVI"="GA", "ICEFACTROY" "IC")
"HARINIWASCIRCLE"="HA", "TEENHATHNAKA" "TE", "LUISWADI"="LU",
"NITINCOMPANYJUNCTION"="NI", "CADBURRYJUNCTION"="CA" Given, n=8,
where n is number of total Bus Stops. Bus Stops =["TH", "GA", "IC", "НА", "TE", "LU", "NI",
"CA"), Write a code with function getFare(String Source, String Destination) which takes Input
as source and destination stops(in the format containing first 2 characters of Name of the
Busstop) and calculate and return travel fare. (5 Marks)

32. PASCAL TRIANGLE. (5 Marks)

1
121
12321
1234321
123454321
12345654321
1234567654321

33. Creating a music or media player using linked lists is a fascinating project that
demonstrates the use of data structures in a practical application. Design a basic media player
that can handle a playlist of songs.Use a suitable linked list to allow easy navigation in both
directions (forward and backward). (10 Marks)

You might also like