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

Sample Questions

Uploaded by

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

Sample Questions

Uploaded by

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

Validate a Binary Search Tree

Given a binary tree, write a function to determine whether it is a binary search tree (BST). A binary
search tree is defined as a binary tree in which for every node, the left subtree contains only nodes with
values less than the node’s value, and the right subtree contains only nodes with values greater than the
node’s value. Additionally, both the left and right subtrees must also be binary search trees. How would
you implement a solution to check if the given tree is a BST? (DO NOT USE RECURSION)

Youngest Missing Member

You are given an array age [] of N Age of Members and array member [] of M Name, LastName, Age of
Members,

The task is to find the name of the youngest missing member from the array age.

Note: 1) If all ages are provided then return null

2) ages might not be in ascending order

3) If more than one youngest member is missing then return first occurrence of the youngest

member

Input:

N = 5 age[] = {1,2,3,4,5},

M= 10 member[]= {‘Ram,D,1’ ,Dev,B,2’, ‘Adam,Jobs,3’. ‘Adam,Jobs,4’, ‘Ema,K,5’. ‘Leena,Jack,7’.


‘Patric,Queen,8’, ‘Liam,Jones,9’. ‘Riya,N,10’. ‘Dilip,K,22’}

Output: Leena

Explanation: Youngest member’s age not mentioned in age[] is 7 and Leena’s age is 7

Binary Addition

Given binary strings str1 and str2, add them and return the sum as a binary string.

Example:

Input 1:

Str1 = 100

Str2 = 010

Output:

110
Input2:

Str1 = 111

Str2 = 11

Output:

1010

Constraints

1<=str1, str2< = 1000

Keys in a B Tree

What is the maximum number of keys in a B-tree of order 6 and of height 4?

In computer science, a B-tree is a self-balancing tree data structure that maintains sorted data and
allows searches, sequential access, insertions, and deletions in logarithmic time. B tree is a specialized
m-way tree is widely used for disk access.

 7776
 7775
 16384
 16383

Abstract Reasoning 7

What number logically replaces (?).

12 11

15 12

50

10 20

? 5
 60
 62
 53
 57

Memory management techniques in OS

Which memory management technique is considered fast for modern day operating systems ?

 Best Fit
 First Fit
 Next Fit
 Worst Fit

C variables and memory sections

Consider the following code-snippet:

Static int a;

Static int b = 10;

Void func() {

Int c;

Where are the variables a,b,c stored in RAM recpectively?

 Stack, Heap, BSS


 Heap, Code, BSS
 BSS, Data, Stack
 Data, BSS, Stack

TCP connection

Which one of the following state is FALSE?

A) Three packets are sent to establish TCP connection


B) The ACK packet from receiver during TCP connection has both SYN and ACK bit set
C) Four packets are sent to terminate the TCP connection

 Only A
 Only C
 Both B and C
 None of these

IP Magic

Consider the following IP addresses:

A. 201.119.1.30
B. 201.119.1.33
C. 201.119.1.46

If subnet mask is 255.255.255.240 then which IP belong to same subnet.

 A and B
 B and C
 A, B and C
 None

File transfer to a remote server

A linux system administrator needs to securely transfer a file named myapp.log from a local

Server to a remote server using SSH. The system administrator has regular user privileges, and

the myapp.log can only be accessed by the root user.

Which command should the administrator use?

 sudo scp -i /root/ .ssh/id_rsa /path/to/myapp.log [email protected]: /remote-dir/my-

Location/

 sudo -u root scp /path/to/myapp.log [email protected]: /remote-dir/my-location/


 sudo -u root chown root /path/to/myapp.log && sudo -u root scp /path/to/myapp.log

[email protected]:/remove-dir/my-location/

 sudo -u root scp -i /root/ssh/id_rsa /path/to/myapp.log [email protected]: /remove-dir/


my-location/
? 5

You might also like