Pages

Thursday, 14 September 2017

MOCK AMCAT IT SKILL QUESTIONS



AUTOMATA
1.       The main() method has been implemented for you. We emphasize the submission of a fully working code over partially correct but efficient code. Using certain java packages is restricted. You can use System.out.println to debug your code. The version of JDK being used is 1.7.

A sequence of parenthesis is called balanced if it consists entirely of pairs of opening/closing parenthesis (In that order), what is well neisted. For example, sequences “(())()”. “()”  and “(()(()))” are balanced, while “(()” and “(()))(“ are not.

write a method to determine if a given string contains balanced sequence of parentheses. The input to the method balancedParenthesis of class Parentheses is a string str.  Each character in the string will be “(“or”)”. The output is the court of balanced pairs if the sequence is balanced or -1 otherwise.

For example, if the input sequence is “(()(()))”, the expected output is 4.

Test cases
TestCase 1:
Input:
(())
Expected return value:
2

TestCase 2:
Input()(
Expected return value:
-1

2.       The main() method has been implemented for you. We emphasize the submission of a fully working code over partially correct but efficient code. Using certain java packages is restricted. You can use System.out.println to debug your code. The version of JDK being used is 1.7.

Given a linked list, reverse the second half of the linked list. That is, the linked list from the middle node to the last node should get reversed.

for example, if the linked list is {2->3->6->1->4->8->9->7}
then the resulting list would be {2->3->6->1->7->9->8->4}

The input to the method reversedLinkedList of class ReverselLinkedList  consists of an object list of class LNode representing a linked list.
The method returns an object of LNode representing a linked list which is reversed after the middle element.

If there is an odd number elements in the list, then the middle element will be part of the portion reversed. The middle element is the one located at position (N+1)/2, where N is the total number of element in the list.

The class to follow for a node of the linked list is –

public class LNode
{
 public int value;
public LNode next;
}

The class shall be followed for providing the inputs and used to evaluate your output.
it has been included for you by default in your code. You do not have to write this definition again.

Test cases

Test Case 1
Input:
1->2->3->4->null
Expected Return Value:
1->2->4->->3->null

Test Case 2
Input:
11->23-> 16->9->21->null
Expected Return Value:
11->23->21->9->16->null

Explanation:
The length of the input linked list is 5. So, the middle element is the one at (5+1)/2 = 3rd position.




3.    The LeastRecentlyUsed(LRU) cache algorithm exists the element from the cache(when it's full) that was leastrecentlyused. After an element is requested from the cache, it should be added to the cache(if not already there) and considered the mostrecentlyused element in the cache.

Given the maximum size of the cache and a list of integers(to request from the cache), calculate the number of cache misses using the LRU cache algorithm. A cache miss occur when the requested integer does not exist in the cache.

Initially, the cache is empty. The input to the function LruCountMiss shall consist of an integer max_cache_size, an array pages and its length len.
The function should return an integer for the number of cache misses using the LRU cache algorithm. Assume that the array pages always has pages numbered from 1 to 50.
TESTCASES:
TESTCASE1:
INPUT:
3,[7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0],16
EXPECTED RETURN VALUE:
11
TESTCASE 2:
INPUT:
2,[2,3,1,3,2,1,4,3,2],9
EXPECTED RETURN VALUE:
8
EXPLANATION:
The following page numbers are missed one after the other 2,3,1,2,1,4,3,2.This results in 8 page misses.
Sample CODE:
int lruCountMiss(int max_cache_size, int *pages,int len)
{/
/write tour code
}

4.      Mooshak the mouse has been placed in a maze.There is a huge chunk of cheese somewhere in the maze. The maze is represented as a two dimensional array of integers, where 0 represents walls.1 repersents paths where mooshak can move and 9 represents the huge chunk of cheese.
Mooshak starts in the top left corner at 0.
Write a method is Path of class Maze Path to determine if Mooshak can reach the huge chunk of cheese. The input to is Path consists of a two dimensional array gnd for the maze matrix. the method should return 1 if there is a path from Mooshak to the cheese.and 0 if not Mooshak is not allowed to leave the maze or climb on walls.
EX: 8 by 8(8*8) matrix maze where Mooshak can get the cheese.
1 0 1 1 1 0 0 1
1 0 0 0 1 1 1 1
1 0 0 0 0 0 0 0
1 0 1 0 9 0 1 1
1 1 1 0 1 0 0 1
1 0 1 0 1 1 0 1
1 0 0 0 0 1 0 1
1 1 1 1 1 1 1 1

5.       There is a colony of 8 cells arranged in a straight line where each day every cell competes with its adjacent cells(neighbor). Each day, for each cell, if its neighbors are both active or both inactive, the cell becomes inactive the next day, otherwise it becomes active the next day. Assumptions:
The two cells on the ends have single adjacent cell, so the other adjacent cell can be assumsed to be always inactive.
Even after updating the cell state. consider its previous state for updating the state of other cells. Update the cell information of all cells simultaneously.
Write a function cellCompete which takes takes one 8 element array of integers cells representing the current state of 8 cells and one integer days representing te number of days to simulate.
An integer value of 1 represents an active cell and value of 0 represents an inactive cell.

6.       Write a function to insert an integer into a circular linked _list whose elements are sorted in ascending order 9smallest to largest).
The input to the function insertSortedList is a pointer start to some node in the circular list and an integer n between 0 and 100. Return a pointer to the newly inserted node.
The structure to follow for a node of the circular linked list is_
Struct CNode ;
Typedef struct CNode cnode;
Struct CNode
{
Int  value;
Cnode* next;
};
Cnode* insertSortedList (cnode* start,int n)
{
//WRITE YOUR CODE HERE
}
//FUNCTION SIGNATURE ENDS

7.    A system that can run multiple concurrent jobs on a single CPU have a process of choosing which task hast to run when, and how to break them up, called “scheduling”. The Round-Robin policy for scheduling runs each job for a fixed amount of time before switching to the next job. The waiting time fora job is the total time that it spends waiting to be run. Each job arrives at particular time for scheduling and certain time to run, when a new job arrives, It is scheduled after existing jobs already waiting for CPU time
Given list of job submission, calculate the average waiting time for all jobs using Round-Robin policy.
The input to the function waitingTimeRobin consist of two integer arrays containing job arrival and run times, an integer n representing number of jobs and am integer q  representing the fixed amount of time used by Round-Robin policy. The list of job arrival time and run time sorted in ascending order by arrival time. For jobs arriving at same time, process them in the order they are found in the arrival array. You can assume that jobs arrive in such a way that CPU is never idle.
The function should return floating point value for the average waiting time which is calculated using round robin policy.
Assume 0<=jobs arrival time < 100 and 0<job run time <100.
This has been on request!

8.       Every day, Mike goes to his job by a bus, where he buys a ticket. On the ticket, there is a letter-code that can be represented as a string of upper-case Latin letters.
Mike believes that the day will be successful in case exactly two different letters in the code alternate. Otherwise, he believes that the day will be unlucky. Please see note section for formal definition of alternating code.
You are given a ticket code. Please determine, whether the day will be successful for Mike or not. Print "YES" or "NO" (without quotes) corresponding to the situation.
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first and only line of each test case contains a single string S denoting the letter code on the ticket.
Output
For each test case, output a single line containing "YES" (without quotes) in case the day will be successful and "NO" otherwise.
Note
Two letters x, y where x != y are said to be alternating in a code, if code is of form "xyxyxy...".
Constraints
1 ≤ T ≤ 100
S consists only of upper-case Latin letters
Subtask 1 (50 points):
|S| = 2
Subtask 2 (50 points):
2 ≤ |S| ≤ 100
Example
Input:
2
ABABAB
ABC
Output:
YES
NO






9.       Jem is famous for his laziness at school. He always leaves things to last minute. Now Jem has N problems in the assignment of "Advanced topics in algorithm" class to solved. The assignment is due tomorrow and as you may guess he hasn't touch any of the problems. Fortunately he got a plan as always.
The first step will be buying a pack of Red Bull and then to work as hard as he can. Here is how he is going to spend the remaining time:
Jem will not take a break until he finishes at least half of the remaining problems. Formally, if N is even then he will take he first break after finishing N / 2 problems. If N is odd then the break will be after he done (N + 1) / 2 problems. Each of his break will last for B minutes. Initially, he takes M minutes in solving a problem, after each break he will take twice more time in solving a problem, i.e. 2 * M minutes per problem after the first break.
Jem will start working soon and ask you to help him calculate how much time it will take until he finish the last problem!
Input
The first line contains a single integer T represents the number of test cases in the input.
Each line in the next T line contains three integers N, B and M represents a test case.
Output
For each test case output a single line containing an integer represent how much time Jem will need (in minutes).
Constraints
·                     1 ≤ T ≤ 100
·                     1 ≤ N, B, M ≤ 108

Example

                    Input:
                    2
                    9 1 2
                    123456 123456 123456
 
                    Output:
                    45
                    131351258112

10.  There is a colony of 8 cells arranged in a straight line where each day every cell competes with its adjacent cells(neighbour).
Each day, for each cell, if its neighbours are both active or both inactive, the cell becomes inactive the next day,. otherwise itbecomes active the next day.

Assumptions:
The two cells on the ends have single adjacent cell, so the other adjacent cell can be assumsed to be always inactive.
Even after updating the cell state. consider its pervious state for updating the state of other cells. Update the cell informationof allcells simultaneously.
Write a fuction cellCompete which takes takes one 8 element array of integers cells representing the current state of 8 cells and one integer days representing te number of days to simulate.
An integer value of 1 represents an active cell and value of 0 represents an inactive cell.

program:
int* cellCompete(int* cells,int days)
{
//write your code here
}
//function signature ends
TESTCASES 1:
INPUT:
[1,0,0,0,0,1,0,0],1
EXPECTED RETURN VALUE:
[0,1,0,0,1,0,1,0]
TESTCASE 2:
INPUT:
[1,1,1,0,1,1,1,1,],2
EXPECTED RETURN VALUE:
[0,0,0,0,0,1,1,0]


11.  Write a function to insert an integer into a circular linked _list whose elements are sorted in ascending order 9smallest to largest).
The input to the function insertSortedList is a pointer start to some node in the circular list and an integer n between 0 and 100. Return a pointer to the newly inserted node.
The structure to follow for a node of the circular linked list is_
Struct CNode ;
Typedef struct CNode cnode;
Struct CNode
{
Int  value;
Cnode* next;
};
Cnode* insertSortedList (cnode* start,int n
{
//WRITE YOUR CODE HERE
}
//FUNCTION SIGNATURE ENDS
TestCase 1:
Input:
[3->4->6->1->2->^],5
Expected Return Value:
[5->6->1->2->3->4->^]
TestCase  2:
Input:
[1->2->3->4->5->^],0
Expected Return Value:
[0->1->2->3->4->5->^]


12.  A system that can run multiple concurrent jobs on a single CPU have a process of choosing which task hast to run when, and how to break them up, called “scheduling”. The Round-Robin policy for scheduling runs each job for a fixed amount of time before switching to the next job. The waiting time fora job is the total time that it spends waiting to be run. Each job arrives at particular time for scheduling and certain time to run, when a new job arrives, It is scheduled after existing jobs already waiting for CPU time
Given list of job submission, calculate the average waiting time for all jobs using Round-Robin policy.
The input to the function waitingTimeRobin consist of two integer arrays containing job arrival and run times, an integer n representing number of jobs and am integer q  representing the fixed amount of time used by Round-Robin policy. The list of job arrival time and run time sorted in ascending order by arrival time. For jobs arriving at same time, process them in the order they are found in the arrival array. You can assume that jobs arrive in such a way that CPU is never idle.
The function should return floating point value for the average waiting time which is calculated using round robin policy.
Assume 0<=jobs arrival time < 100 and 0<job run time <100.



13.  Mooshak the mouse has been placed in a maze.There is a huge chunk of cheese somewhere in the  maze.
The maze is represented as a two-dimentional array of integers, where 0 represents  walls.1 repersents paths where mooshak can move and 9 represents the huge chunk of cheese. Mooshak starts in the top-left corner at 0.0
Write a method isPath of class MazePath to determine if Mooshak can reach the huge chunk of cheese. The input to isPath  consists of a two- dimentional array gnd for the maze matrix. the method  should return 1 if there is a path from Mooshak to the cheese.and 0 if not Mooshak is not allowed to leave the maze or climb on walls.
EX:8 by 8(8*8)  matrix maze where Mooshak can get the cheese.
1 0 1 1 1 0 0 1
1 0 0 0 1 1 1 1
1 0 0 0 0 0 0 0
1 0 1 0 9 0 1 1
1 1 1 0 1 0 0 1
1 0 1 0 1 1 0 1
1 0 0 0 0 1 0 1
1 1 1 1 1 1 1 1
Test Cases:
Case 1:
Input:[[1,1,1,][9,1,1],[0,1,0]]
Expected return value :1
Explanation:
The piece of cheese is placed at(1,0) on the grid Mooshak can move from (0,0) to (1,0) to reach it or can move from (0,0) to (0,1) to (1,1) to (1,0)
Test case 2:
Input:
[[0,0,0],[9,1,1],[0,1,1]]
Expected return value:0
Explanation:
Mooshak cannot move anywhere as there exists a wall right on (0,0).
















Computer Science

Ques 1- Processes P1, P2 and P3 are processed by the First Come, First Served (FCFS) scheduling algorithm. What will be the values of the average waiting time, average turnaround time and average throughput, respectively?
Process
Burst Time (in milliseconds)

P1
24
P2
3
P3
3

a.       3,13,10
b.      17,27,10
c.       13,3,16
d.      17,13,16

Ques 2- Passage
JOB 1
150
JOB 2
350
JOB 3
A part of a system’s memory is shown in the image. JOB 1, JOB 2and JOB 3 are in the memory. The free space can be allocated to the new jobs that arrive in an order according to the different memory allocation strategies.
Which technique will satisfy the request of the memory blocks of size 250,70, 150?
a.       First fit
b.      Next fit
c.       Either first fit or next fit
d.      Neither first fit nor next fit.

Ques 3.
Group A
Group B
A.      Process
1.       Passive entity
B.      Program
2.       Degree of multiprogramming
C.      Long term scheduler
3.       Active entity
D.      Message passing
4.       Interprocess communication

Refer to the given table. Match the terms related to process management in group A with their characteristics in group B.
a.       A-3, B-1, C-2, D-4
b.      A-3, B-2, C-1, D-4
c.       A-1,B-3,C-4,D-2
d.      A-1,B-3,C-2,D-4
Ques 4-
Group A
Group B
A.      Next fit allocation
1.       Processor sharing
B.      Mapping of address
2.       Contiguous memory allocation
C.      Round-robin scheduling
3.       Memory management unit
D.      Push migration
4.       Load balancing

Refer to the given table. Match the technique in Group A with their functions in Group B.
a.       A-4,B-2,C-3,D-1
b.      A-3,B-4,C-1,D-2
c.       A-2,B-3,C-1,D-4
d.      A-2,B-1,C-4,D-3

Ques 5. Refer to the given table. Match the allocation technique in Group A with their drawbacks in Group B.
Group A
Group B
A.      Contiguous allocation
1.       Extra memoryconsume
B.      Linked list allocation
2.Slow random access
C. FAT allocation
3. Disk fragmentation
a.       A-1,B-2,C-3
b.      A-1,B-3,C-2
c.       A-3,B-2,C-1
d.      A-2,B-1,C-3
Ques 6- Suppose a disk drive has 100 cylinders, numbered from 0 to 99. The drive is currently serving a request at cylinder 40 and the disk arm is moving towards 99. The queue of pending requests is: 35, 65, 55, 45, 85, 75. What is the total distance (in cylinders) moved by the disk arm to satisfy all the pending requests for C -LOOK disk scheduling algorithm, starting from the current head position?
a.       75
b.      95
c.       123
d.      193
Ques 7-Which of the following is a threat to system?
a.       Torjan horse
b.      Worms
c.       Trap door
d.      Logic bomb

Ques 8- A worm is made of ______and______  .
a.       Grappling hook and main program
b.      Main program and secondary program
c.       Grappling hook and secondary program.

Ques 9- Any program residing in the memory contains a set of instructions that need to be executed by the computer in a sequential manner. This cycle for every instruction is known as the instruction cycle. The cycle consists of the following steps that may or may not be the proper sequence of execution.
1, Fetch the operand from the memory
2. Execution
3. Fetch the instruction
4. Decode the instruction
5. Result
What will be the proper sequence of the instructions in the instruction cycle?
a.       3-4-1-2-5
b.      3-4-2-5-1
c.       2-3-1-4-5
d.      1-2-3-4-5
.
Ques 10. Which of the following statement is incorrect?
a.       Pseudo instruction are machine instructions.
b.      Dynamic RAM is faster than static RAM.
c.       NAND gate is a universal gate
d.      Negative numbers are represented by 2’s complement.
Ques 11. What is the minimum number of bits required to store -256 to +256 in a computer?
a.       7
b.      8
c.       9
d.      10
Ques 12. Which of the following states don’t occur in the life cycle of a process?
a.       Ready
b.      Running
c.       Terminated
d.      Waiting
e.      Abort

Ques 13. A DBA uses log- based recovery method to ensure atomicity for a transaction ‘T’ and realize after some time that it is aborted. Which of the following operation should be used to ensure atomicity?
a.       Undo (T)
b.      Abort(T)
c.       Redo (T)
d.      Commit (T)

Ques 14. Cooperating processes require an interprocess communication (IPC) mechanism that will allow them to exchange data and information_ Which of thefollowing is/are an IPC method(s)?
1.     Message passing
2.     Cooperation
3.     Shared memory
a.     1 and 3
b.     Only 2
c.     Only3
d.     2 and 3
e.     Only 1

Ques 15.
T0
T1
T0
T1
read (A)

read (A)

write (A)

write (A)

read (B)


read (A)
write (B)


write (A)

read (A)
read (B)


write (A)
write (B)


read (B)

read(B)

write (B)

write (B)
Schedule 1                                                          schedule 2
There are two schedules - Schedule 1 and Schedule 2 as shown in the table. Consider a system with two data items, A and B, that are both read and written by two transactions, TO and Ti. These transactions are executed in a chronological order from top to bottom. The instructions of TO are in the left column and the instructions of T1 are in the right column.
Which of the following options is true about Schedule 1?
a.     It is a conflicting schedule
b.     It is a nonserial schedule
c.     It is a nonconflictserializable schedule
d.     It is a serial schedule
Explanation - This means that if a schedule can be transformed to any serial schedule without changing orders of conflicting operations (but changing orders of non-conflicting, while preserving operation order inside each transaction), then the outcome of both schedules is the same, and the schedule is conflict-serializable
Ques 16.
Segment
base
length
0
210
600
1
2300
140
2
100
90
3
1300
460
4
2000
110
      Segment table           
Refer to the segment table and map the several logic address spaces ( segment number , byte) given below in their physical addresses.
1.       1, 430
2.       1,10
3.       3,180
4.       4,200
a.       640,2310,1480,2110
b.      640,2310,1480,2200
c.       830,150,640,310
d.      None of the above

Ques 17. Which of the following statements are true?
1.       TCP is a connection-oriented protocol
2.       UDP is a connectionless protocol.
3.       TCP is faster than UDP  
4.       TCP is more secure than UDP.
a.       1 and 2
b.      3 and 4
c.       1,2 and 4
d.      2,3 and 4
e.       All of these

Ques 18. A dedicated path is needed in           switiching before the data is sent from the sender to the receiver while it is not needed in     switching.
a.       Packet, circuit
b.      Circuit, packet
c.       Packet , time division
d.      Space division , packet.

Ques 19.
Group a
group b
a.       Distance vector interior routing protocol
1.       Open shortest path first.

b.      Distance vector exterior routing protocol
2.       Enhanced interior gateway routing protocol

c.       Link state interior routing protocol
3.       Routing information protocol
hybrid interior routing protocol
4.       Border gateway protocol
Match the routing strategies in group A with their exampleas in group B.
a.       A-4, B-2, C-3, D-1
b.      A-1, B-4, C-2, D-3
c.       A-3, B-4, C-1, D-2
d.      A-4, B-3, C-1, D-2
Ques20 .which of the following statement is true about bus topology?
a.       It is not easy to reconfigure.
b.      If the backbone link is broken, then the network is not incapacitated.
c.       It requires more cables as compared to mesh topology
d.      It is a point to point configuration.
Ques 21.
Which of the following statement is correct about the shown ER diagram?
a.       “phone number” is a weak attribute and “age” is a derived attribute.
b.      “phone number ” is a derived attribute and “age” is a multivalued attribute.
c.       “phone number ” is a multivalued attribute and “age” is a derived attribute.
d.      “phone number ” is a strong attribute and “age” is a weak attribute.

Ques 22. Which of the following statements is/are true regarding tuple relational calcus?
1.       TRC is a declarative language.
2.       TRC makes use of predicate calcus.
3.       In TRC , x=> y means y is true if and only if x is true.
A.      only 1
B.      2 and 3
C.      1 and 2
D.      1and 3

Ques 23. Which of the following queries can be used to reterive rows from table Bank. Where the column “name” contains “ru” and the values in the column “balance” is more than 10,000?
a.       Select * From Bank Where  name like %ru%AND balance>10000.
b.      Select * From Bank Where  name like ‘_ru_’ AND balance>10000.
c.       Select * From Bank Where  name=‘_ru_’ AND balance>10000.
d.      Select * From Bank Where  name=%ru%AND balance>10000.
Ques 24.
The data in the two tables “”students_info” and “extra_info” is shown in the given image. How many rows will be there in the output when the following query is executed?
SELECT a.name, a.sport_participation from student_infob INNER JOIN extra_info a ON a.hobbies=b.hobbies;
a.       2
b.      3
c.       4
d.      Error in query.
Ques 25. The number of tuples in a relation is called      and the number of attributes is called.     .
a.       Degree, cardinality
b.      Cardinality, degree
c.       Domain, degree
d.      Domain, cardinality

Ques 26. The column “car_number” is common in the two tables. “car ( car_number, car_type,mfd)” and “owner( name, age, car_number, number)”. Which query will retrieve “car_type” where the name of the owner is ‘nik’?
a.       SELECT car_type FROM car WHERE car_number LIKE (SELECT* FROM owner where name=’NIK’).
b.      SELECT car_type FROM car WHERE car_number(SELECT car_number FROM owner WHERE name=’NIK’).
c.       SELECT car_type FROM car WHERE car_number=(SELECT *FROM owner WHERE name=’NIK’).
d.      SELECT car_type FROM car WHERE car_number BETWEEN (SELECT car_number FROM Owner WHERE name=’NIK’).
It is a serial schedule

.
It is a serial schedule




















Computer Science Paper 2


1.       Which of the following statements is\are true about the ICMP protocol?
1. It stands for Internet control message protocol.
2. It is an application layer protocol.
3. It is used by hosts & gateways to send notifications of datagram problems to the sender.
4. It handles control & error messages.
A]  Only 1                            B] Only 2                              C] 3 &4                  D] 1, 2 & 3            E] 1, 3  & 4
2.       The processes P1, P2 and P3 shown in the table arrive at the same time and are processed by the Shortest Job First (SJF) scheduling algorithm., Calculate the average waiting time in milliseconds.
            Processes
          Burst Time
     ( in milliseconds)
P1
8
P2
3
P3
5

A] 3.6                                    B] 5.6                                     C] 6.3                     D] 7.3
3.       What is Bleady’s Anamoly?
A] For some page replacement algorithms, page fault may increase as the number of allocated frames increases.
B] For some page replacement algorithms, page fault may decrease as the number of allocated frames increases.
C] For some page replacement algorithms, page fault may decrease as the number of allocated frames decrease.
D] For some page replacement algorithms, page fault do not dependon the number of frames.
4.       Consider the following reference string.
1,2,3,4,2,1,2,3,5,6,2,1,7,6,3,2
A page fault will occur as a program accesses a page that is mapped in the virtual address space, but not loaded in the physical memeory. All the frame s are initially empty. Thus the first unique page will cost one fault each.
What will be the no of page faults if the FIFO replacement policy is used with 3 page frames?
A] 11                                      B] 12                                      C] 15                      D] 17
5.       Assume that a pipelining is implemented and data given are:
b=3; Pj=0.4; Pt=0.6;
where
b= jump penalty((loss of cycle due to jump)
Pj=probability that instruction is a jump
Pt=probability that jump is taken
What will be the average instruction time?
A] 0.71                                  B] 3.14                                  C] 0.11                  D] 0.6
6.       Which of the following statements are true about timestamp-based concurrency control?
A] There are three types of timestamps – read, write & exclusive
B] Every timestamp value is unique and different from the others
C] A timestamp is lock based concurrency control method
D] A lower valued timestamp occurs later in time than a higher valued timestamp
7.       An operating system has to schedule all the processes in the main memory (using a scheduling algorithm) to run on the CPU at equal intervals. Each time a clock interrupt occurs, the interrupt handler checks how much time the current running process has used. If it has used up its entire time slice,than the CPU scheduling algorithm in the kernel picks a different process to run. What is each switch of the CPU from one process to another called?
A] Task Switching                                                             B] CPU Switching
C] Context Switching                                                      D] Process Switching
8.       Which of the following statements is incorrect about the virtual memory?
A] It enables a program to execute on a computer without the main memory
B] It is generally implemented be the demand paging concept
C] It gives the illusion to the user  that the main memory is equal to the capacity of secondary storage media
D] It helps improve the processor utilization
9.       Which of the following is true  about the given ER diagram?
                                                                                                                                                                                                                                                                                                                                                                                                                                                                XXX                                                                                                                                                                                                                X                                                                             R                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Y                                                                                                             
A] Every X must have Y associated to it via R.
B] R is a partial relation
C] Every y must have an X associated to it via R
D] Y is a weak entity
10.   A decimal 74 is represented by 8 bits in memory. Match various compliments of 74 in Group A with their corresponding values in Group B. The values in group B are in Decimal.
Group A
Group B
A  1’s Compliment
1   25
B  7’s Compliment
2   437
C  9’s Compliment
3   164
D  15’s Compliment
4 181

A] A-4, B-2, C-1, D-3                                                                        B] A-3, B-1, C-4, D-2
C] A-4, B-3, C-1, D-2                                                                        D] A-2, B-4, C-1, D-3
11.   At times it is advantageous to swap process in the memory and to bring it back into the memory after some time, such that its execution can be resumed from the point it stopped. Which of the following handles this swapping process?
A] Medium-term scheduler                                                        B] Swapping scheduler
C] Long term scheduler                                                                 D] Short term sheduler.
12.   Passage
Group A
Group B
A   Safe State
1  Atomicity
B   Mutual Exclusion
2  Deadlock prevention
C   Locking Protocol
3  Deadlock Avoidance
D   Checkpoints
4 Serializability

A] A-2, B-3, C-4, D-1                                                                        B] A-3, B-2, C-1, D-4
C] A-3, B-2, C-4, D-1                                                                        D] A-1, B-4, C-3, D-2
13.  
Employee_id
Passage

  Work_for
Telephone_number
     Employee
                                                                                                                                                                                                                                                                                                                                                                                                                                                manager                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              worker                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Which of  the following refer to a role shown in the ER- Diagram?
A] works_for                     B] employee id                 C] manager                         D] employee                                                                                                                                                                                                     
14.   Identify the sheduling technique in which the process keeps the CPU till its termination once it id allocated to that process.
A] Cascading scheduling                                                               B] Preemptive scheduling
C] Non-Preemptive scheduling                                                 D] Round Robin scheduling
15.   Which of the following statements is\are true about the kernel?
1.It connects the application software to the hardware of the computer
2.Monolithic kernel & microkernel are types of  kernel
3.The Kernel has full access to the system’s memory
A] Only 1                              B] Only 2                              C] 1 & 2                                 D] 2 & 3
E] All of these
16.   Identify the network topology whose characterstics are listed below.
1.It is configured from point to point
2.It provides fault isolation
3.If one the links becomes unusable, then the entire system does not become incapacitated.
A] Star                                  B] Tree                                 C] Mesh                               D] Bus
17.   The head of the moving head disk with 100 tracks  numbered from 0-99 is currently serving at a track at 40. The queue of request is 30, 70, 90, 40,60. And is processesd by the STSF disk scheduling algorithm. What will be the total head movementto serve these requests?
A] 70                                      B] 80                                      C] 100                                    D] 110
18.   Refer to the given table. Match the computer architectureterms in Group A with their examples in Group B.
Group A
Group B
A   Grub
1   System Disk
B   Boot Disk
2   ROM
C   Firmware
3…Bootstrap Program

A] A-3, B-1, C-2                                                               B] A-2, B-1, C-3                 
C] A-2, B-3, C-2                                                                                D] A-2, B-3, C-1
19.   A transaction has to be programmed such that it is completed only if database operations are completed and commited, otherwise transaction is aborted or rolled back. Which database characterstic is implemented in this situation
A] Atomiocity                    B] Durability                       C] Isolation                         D] Consistency
20.   A database contains three tables – Saving_accnt(cid, accnt_no, owner, balance), Current_accnt(cid, accnt_no, owner, balance) and Customer(cid, accnt_no). “a” is the alias for Saving_accnt table and b is alias for Current_accnt table . Which of the following queries should be used to show the details of a customer who holds the saving accounts as well as current account account?
A] Select a.cid, a.accnt_no, a.owner, a.balance FROM Saving_accnt a INNER JOIN Current_accnt b ON a.cid=b.cid;
B] Select a.cid, a.accnt_no, a.owner, a.balance FROM Saving_accnt a CROSS JOIN Current_accnt b ON a.cid=b.cid;
C] Select a.cid, a.accnt_no, a.owner, a.balance FROM Saving_accnt a LEFT INNER JOIN Current_accnt b ON a.cid=b.cid;
D] Select a.cid, a.accnt_no, a.owner, a.balance FROM Saving_accnt a OUTER JOIN Current_accnt b ON a.cid=b.cid;
21.   Match the communication systems in Group A with their examples in Group B
Group A
Group B
A   Simplex
1   Telephone
B   Half Duplex
2    Radio
C   Full Duplex
3..Walkie-Talkie

A] A-2, B-3, C-1                                                                 B] A-1, B-2, C-3
C] A-3, B-2, C-1                                                                  D] A-2, B-1, C-3
22.   Which of the following statements is\ are true?
1.Switches can be considered as multiport bridges.
2.Routers operate at the OSI network layer
3.Routing protocols and routable protocols are the same
4.Dyanamic routers are more secure than static routers
A] Only 2                              B] 1 & 2                                 C] 1, 3 & 4                            D] 1, 2 & 4














23.   Which raid level is shown in the given image.

                                A2                           A3                           A4          
A1                           A2                           A3                           A4          
A1
 











                                                                                                                                                                                                                               

A] Raid level 0                            B] Raid level 1                    C] Raid level 2                    D] Raid level 3

24.   Calculate the number of frames that the memory will have if page size is 4 bytes and the physical memory is 16 bytes.
A] 4 frames of 4bytes each                                                          B] 16 frames of 1byte each
C] 2 frames of 8bytes each                                                          D] 1 frame of 16bytes
25.   Which of the following indices should be used to create  an index on a table with the requirments given below.
1.Insertions & deletions must be simple
2.It should be easy to maintain the index.
3.High performance is required when data is accessed randomly
4.The queries that are executed on the table most often are equality queries.
A] Hash Table index                                                                        B] Non-clustered index
C] B-Tree index                                                                                 D] Clustered index


Computer Programming
PAPER 1
Q1. For which of the following is the stack implementation useful?
A. Radix Search                                                                 B. Breadth first Search                  
C. Recursion                                                                       D. None of the above
Q2. A stack is implemented as a linear array A [0…..N-1]. A programmer writes the function given below to pop out an element from the stack.
function POP(top, N)
{
if(X)
{
Top=top-1
}
else
{
print”Underflow”
}
return top
}
Which of the following should substitute the condition “X”?
A. top<N-1                          B. top<N                              C. top>1                               D. top>=0
Q3. What will the output of the following pseudocode statements be?
(Note: Assume that when two data types are processed through an operator, the answer maintains the same data type as that of the input. Also, all data types have enough range to accommodate any number. If two different data types are operated upon, the result assumes the data type that is more expressive.)
integer a=456,b,c,d=10
b=a/d
c=a-b
print c
A. 410                                    B. 410.4                C. 411.4                D. 411
Q4. Function main is the starting point of execution of a program. Which of the following options shall help in making an executable program without the use of main function in the program?
A. Any function can be made and marked as starting point using a language dependent syntax
B. Two macros can be used. One to hold the name of a function and its working and the other to call the first macro
C. Any program without a main function shall not do anything but can only produce a blank screen
D. It is not possible to run a program without a main function in a program
Q5. Which of the following implies that there are two loops that are nested?
A. Two loops, one after the other                                            B. Two loops, one inside the other
C. One loop with two different iteration counts                                 D. Two loops with the same iteration count
Q6. In an implementation of a linked list, each node contains data and address. Which of the following can the address field possibly contain?
A. Address of the next node in sequence                             B. Its own address
C. Address of the last one                                                            D. Address of the first node
Q7.
class rocket
private:
integer height, weight
public:                   //1 Statement 1
function input( int a, int b)
{
height= a;
weight = b; }
}
function main ( )
{
rocket rocket1, rocket2
}
Refer to the pseudocode given in the 'Passage'. The code is similar to that in C++ and is self-explanatory. An accessible member function and a data member for an object are accessed by the statements objectname.functionname and objectname.datamembermame, respectively. What can be inferred from this code?
A. "rocket" is a class with "rocket1" and "rocket2" as its objects, with "height" and "weight" as its attributes.
B. "rocket" is a class with "rocket1" and "rocket2" as its objects, with "height" and "weight" as its objects.
C. "rocket" is a class with "rocket1". "rocket2", "height" and "weight" as its attributes.
D. "rocket" is a class with "rocket1", "rocket2", "height" and "weight" as its objects.
Q8. The program to print the larger of the two numbers entered by a user is given below. Which of the following should be substituted in place of "??" in Statement 1 of the code to get the desired output?
int number1 , number 2
input number1, number 2
if (??) // Statement 1
print number1
else
print number2
end if
A. number1>number2                                                   B. number2>number1
C. number2 equals number1                                      D. number1 <= number2
Q9. Which of the following statements is TRUE about a variable?
A. A variable cannot be used before it is declared.
B. A variable cannot be used after it is declared.
C. A variable cannot be used in the function it is declared in.
D. A variable can always be used.
Q10. A programmer writes a code snippet in which a set of three lines occurs ten times in different parts of the program. What programming concept should be used to shorten the code length?
A. For loops                        B. Functions                       C. Arrays                              D. Classes
Q11. Archana makes a program to create a number guessing game. She takes input from user, and gives him hints on whether it is equal to, lesser or greater than the actual number. Thus asking questions such as " Is 97 greater than, equal to or lesser than the actual number? " lower the sample space. Assuming that her range is from 1 to 100, what will be the least number of questions required to guess the actual number?
A. 6                                        B. 7                                         C. 8                                         D.10
Q12. In which of the following situations can a constructor be invoked?
A. When an object is created                                                      B. When an object is assigned the value 0
C. Only at the end of the code                                                   D. When the scope of the object is over
Q13. Which of the following can be inherited by a derived class from a base class?
A. Data members                                                                             B. Member functions
C. Constructors and destructors                                                                D. Data members and member functions
Q14. Preeti writes a program in a low level language, now she wants to translate it into a higher language without rewriting the program. What another program she must use for this purpose?
A. Compiler                                        B. Decompiler                                    C. Interpreter
D. Executer                                         E. Cross Compiler
Q15. The function given below computes the factorial of the number "n" entered by a user. What should be the "MISSING STATEMENT" in order to make the code work properly?
function factorial(n)
{
if (n equals 1)
 return 1
else
 -- MISSING STATEMENT –
end
}
A. return factorial(n-1)                                                                  B. return n*factorial(n)
C. return n*(n-1)                                                                              D. return n*factorial(n-1)
Q16. A programmer wants the program given below to print the largest number out of three numbers entered by the user.
int number1, number 2, number3, temp;
input number1, number2, number3;
if (number1 >number2)
temp = number1
else
temp = number2
end if
if (??) // Statement 1
temp = number3
end if
print temp
Which of the following should be substituted in place of "??" in Statement 1 in the code?
A. number3 >number2                                                                  B. temp <number3
C. temp >number3                                                                          D. number3 >number1
Q17. A sorting mechanism uses the binary tree concept such that any number in the tree is larger than all the numbers in the sub-tree below it. What is this method called?
A. Selection sort                               B. Insertion sort                                C. Heap Sort                       D. Quick sort
Q18. A queue is implemented as a singly linked-list. Each mode has an element and a pointer to another node. The Rear and the Front contain the addresses of the rear and the front node, respectively. What can be inferred about the linked list if the condition (rear is equal front) is true?
A. It has no elements                                                                     B. It has one element
C. There is an error                                                                          D. None of the above
Q19. The following operations are performed on an empty stack "A"
PUSH(1)
PUSH(2)
POP
PUSH(5)
PUSH(6)
 POP
What will the stack contain after these operations?
(Note: The top of the stack is underlined in the options below)
A. 5 6                                     B. 1 5                                     C. 5 6                                     D. 1 5
Q20. A programmer mistakenly writes "gor" instead of the keyword "for" used in loops, while writing a program in C++. What will this result in?
A. The code would not compile.
B. The code would give an error while execution.
C. The code may work for some inputs and not for the others.
D. The code would not create any problem.
Q21. A sorting algorithm traverses through a list, comparing adjacent elements and switching them under certain conditions. What is this sorting algorithm called?
A. Insertion sort                               B. Heap sort                       C. Quick sort                       D. Bubble sort
Q22. Why is an algorithm designer concerned primarily about the run time and not the compile time while calculating time complexity of an algorithm?
A. Run time is always more than the compile time.
B. Compile time is always more than the run time.
C. Compile time is a function of run time.
D. A program needs to be compiled once but can be run several times.
Q23. For the given list of numbers, how many swaps will take place in Bubble Sort so that the list becomes sorted? (Assume that the list is being sorted in ascending order)
List: 23, 56, 78, 53, 11, 65
A. 4                                        B. 5                                         C. 6                                                         D.7
Q24. Two programmers independently write a program to find the mass of one mole of water, that includes the masses of hydrogen and oxygen.
The first programmer defines the variables as:
 integer hydrogen, oxygen, water // Code A
The second programmer defines three quantities as:
integer a, b, c // Code B
Which of the two is a better programming practice and why?
A. Code B is better because variable names are shorter.
B. Code A is better because the variable names are understandable and non-confusing.
C. Code A would run correctly while Code B would give an error.
D. Code B would run correctly while Code A would give an error.
Q25. A programmer writes a sorting algorithm that takes different amount of time to sort two different lists of equal size. What is the possible difference between the two lists?
A. All numbers in one list are more than 100 while in the other are less than 100.
B. The ordering of numbers with respect to the magnitude in the two lists has different properties.
C. One list has all negative numbers while the other has all positive numbers.
D. One list contains 0 as an element while the other does not.

Computer Programming
PAPER 2
1.       A function in the base class is redefined in the inherited class. What is the term used to describe this solution?
A] Inheritance                   B] Overriding                     C] Overloading                  D] Encapsulation
2.       Which of the following is the lowest level format to which the computer converts a program in a higher language before execution?
A] English Code                                 B] Machine Code             C] Assembly language    D] System language
3.       Which of the following implies that there are two loops that are nested?
A] Two loops, one after the other                            B] Two loops, one Inside the other
C] One loop with two different iteration counts D] Two loops with the same iteration count
4.       Passage
function preordertraverse(node)
{
 print node
àvalue
 if (condition X)
{preordertraverse(node
à left)}
 if (condition Y)
 { preordertraverse(node
àright)}
  return
}

Consider a binary tree implementation. The root address is stored in the variable root. The address of a node is given in the variable node. The value of the node and its right and left child nodes can be accessed using the statement given below.
node
à value
 node
à right
 node
à left

A programmer writes the function given in the passage to do a preorder traversal of the tree.
What are condition X and condition Y?
A] Condition X: node
à left isnotequal Null
     Condition Y: node
à right isnotequal Null
B] Condition X: node
à right isnotequal Null
     Condition Y: node
à left isnotequal Null
C] Condition X: node
à left isequal Null
     Condition Y: node
à right isequa Null
D] Condition X: node
à right isnotequal Null
     Condition Y: node
à left isnotequal Null

5.       Passage
function print_me(integer n) //statement 1
{
 if (n<1) return //statement 2
print n //statement 3
print_me(n-1) //statement 4
}

Choose the correct answer.
A pseudo-code is used which is self explanatory.
// in pseudo code refers to comment

Pooja has written the following code to print numbers from 0 to n in reverse order using the recursive approach. Find if there exists any error in the given code.
A] Statement 1                 B] statement 2                  C] statement 3                  D] There is no error

6.       In which of the following situations can a constructor be invoked?
A] When an object is created
B] When an object is assigned the value 0
C] Only at the end of the code
D] When the scope of the object is over
7.       What happens if some indentations are made in some statements of a code written in C++?
A] Faster execution of the code                                                B] Lower memory requirement for the code
C] Correction of errors in the code                           D] Better readability of the code
8.       In an implementation of a linked list, each node contains data and address, which of the following can the address field possibly contain?
A] Address of the next node in sequence                             B] Its own address
C] Address of the last node                                                         D] Address of the first node
9.       Consider the given queen structure-
_ , ­_ , _ , _, A , B_,_,_,_
FRONT = 5, REAR = 6.
What will be the values of FRONT and REAR respectively after the following operations?
REMOVE A
ADD C, D
A] 6,8                    B] 5, 8                    C] 5,7                     D] 6,6. Items will not be inserted.
10.   Assume the following precedence (high to low). Operations in the same row have the same precedence.
(.)
* /
+  -
AND
OR

The precedence is from left to right in the expression for the operators with equal precedence.

Which of the following statements is TRUE about the output of the code statements given below?

Integer a = 40, b= 35, c= 20, d= 10
print a*b/c-d
print a* b/ (c-d)
A] The outputs differ by 80.                                        B] The outputs are the same.
C] The outputs differ by 50.                                         D] The outputs differ by 160.
11.   Which of the following statements is TRUE about a variable?
A] A variable cannot be used before it is declared.
B] A variable cannot be used after it is declared.
C] A variable cannot be used in the function it is declared in.
D] A variable can always be used.
12.   The program to print the larger of the two numbers entered by a user is given below. Which of the following should be substituted in place of “??” in statement 1 of the code to get the desired output?

int number 1, number 2
input number1, number 2
if (??) // statement 1
print number1
else
print number2
end if

A] number1>number2                                                                  B] number2>number1
C] number2 equals number1                                                      D] number1<=number2
13.   The function given below computes the factorial of the number “n” entered by a user. What should be the “MISSING STATEMENT” in order to make the code work properly?
function factorial(n)
{
 if ( n equals 1)
 return 1
else
-- MISSING STATEMENT--
end
}

A] return factorial(n-1)                                                  B] return n*factorial(n)
C] return n*(n-1)                                                             D] return n*factorial(n-1)
14.   If x1(n) is O(y1(n)) and x2 is O(y2(n)), then which of the following is true in context of asymptotic complexity notations?
A] x1(n) + x2(n) is O(min(y1(n), y2(n)))
B] x1(n) + x2(n) is O(max(y1(n), y2(n)))
C] x1(n)+x2(n) is O(y1(n)*y2(n))
C] x1(n)+x2(n) is O(y1(n)-y2(n))

15.   In which of the following areas of a class are data and functions directly accessible outside the class?
A] Public              B ] Private           C] Protected                      D] None of the above
16.   A programmer writes the program given below to print the sum of the first ten multiples of 5. What should be the “Missing Statement 5”?

integer i = 0
integer sum = 0
while (i<=50)
{
sum = sum + i
__ Missing Statement 5 __
}
print sum

A] i = 5                  B] i = 5 * i                             C] i = i + 1                             D] i = i + 5
17.   A programmer wants the program given below to print the largest number out of three numbers entered by user.
int number1, number2, number3, temp;
input number1, number2, number3;

if (number1>number2)
temp = number1
else
temp = number2
end if

if (??) // Statement 1
temp = number3
end if
print temp

Which of the following should be substituted in place of “??” in statement 1 in the code?
A] number3>number2                                                  B] number3>temp
C] number3<temp                                                          D] number3>number1

18.   A sorting mechanism uses the binary tree concept such that any number in the tree is larger than all the numbers in the sub-tree below it. What is this method called?
A] Selection sort               B] Insertion sort                               C] Heap sort                       D] Quick sort

19.   Every element of a data structure has an address and a key associated with it. A search mechanism deals with two or more values assigned to the same address by using the key. What is this search mechanism?
A] Linear search                                                                                B] Binary Search              
C] Hash coded search                                                     D] none of the above

20.   Passage
union MyUnion
{
  structure MyStructure
{
    integer m
    float n
    character o
}MyStr
 integer p
}MyUn

Given that the size of integer is 2 units, float is 4 units and character is 1 unit, what will be the amount of money occupied by MyUn object?
A] 2 units                             B] 6 units                             C] 7 units                             D] 9 units

21.   A queue is implemented as a singly linked- list. Each node has an element and a pointer to another node. The Rear and the Front contain the addresses of the rear and the front nodes, respectively. What can be inferred about the linked list if the condition ( rear isequal front)  is true?
A] It has no elements                                                     B] It has one element
C] There is an error                                                         D] None of the above

22.   What is an algorithm designer concerned primarily about the run time and not the compile time while calculating time complexity of an algorithm?
A] Run time is always more than the compile time.
B] Compile time is always more than the run time.
C] Compile time is a function of run time.
D] A program needs to be compiled once but can be run several times.

23.   A sorting algorithm traverses through a list, comparing adjacent elements and switching them under certain conditions. What is this sorting algorithm called?
A] Insertion sort               B] Heap Sort                       C] Quick sort                      D] Bubble sort

24.   In which of the following methods is sorting NOT possible?
A] Insertion                        B] Selection                        C] Exchange                       D] Deletion




























Computer Programming
PAPER 3

  1. What will happen if some indentations are made in some statements of a code written in C++?
    A] A Faster execution of the code.
    B] Lower memory requirement for the code
    C] Correction of errors in the code
    D] Better readability of the code.
  2. When a byte code is interpreted, how does it get affected in contrast with the compiled machine code?
    A] It has the same running time as the machine code
    B] It runs faster than the compiled machine code.
    C] It runs slower than the compiled machine code.
    D] Interpretation does not make any difference in byte code running time.
  3. function modify(a,b)
{
integer c, d=2;
c=a*d+b;
return c;
}
function calculate()
{
integer a=5, b=20,c;
integer d=10;
c=modify(a,b);
c=c+d;
print c;
}
Consider the code given. Assume that a & b are passed by value. What will be the output of the program be when the function calculate() is executed?
A] 80                           B] 40                           C] 32                           D] 72
  1. An integer ‘X’ is saved as an unsigned 8 bit number 00001011. What is X?
    A] 22                           B] 11                           C] 10                           D] None of the above
  2. Which of the following sort techniques has the worst case functioning time less than O(n*n)?
    A] Heap sort                B] Quick sort               C] Insertion sort           D] Selection sort
  3. Integer MyVar1=5
function main()
{
integer MyVar1=9
print MyVar1
print//missing code
}
Consider the pseudo code. Assume that main is starting point of execution of the program , which of the following options should replace the // missing code so as to print the value global MyVar1(value=5)?
A] MyVar1.MyVar1
B] MyVar1[0]
C] ::MyVar1
D] No local variable should have the same name as global variable.
  1. Which of the following Data Structures may produce an overflow error even though the current number of elements in it is lower than its size?
    A] A queue implemented in the linear way
    B] A queue implemented in a circularly connected array
    C] A stack implemented in a linear way
    D] None of the above
  2. Which of the following properties is not possessed by Heaps?
    A] Shape property                                                                   B] Order property
    C] Heap property                                                                     D] Number property
  3. What does the following function do?
function operation (int a, int b)
{
if (a>b)
return operation(b,a)
else
return a
}
A] Always return first parameter                                 B] Returns min of (a,b)
C] Returns the max of (a,b)                                         D] Loops forever
  1. Function modify(y,z)
{
y=y+1
z=z+1
return  y-z
}
Function calculate()
{
Integer a=5, b=10, c;
c=modify(a,b)
Print a
Print space
Print c
}
Consider the given pseudo code.  Assume that ‘a’ & ‘b’ are passed by value. What will be the output of the program be when the function calculate() executes?
A] 11  -5                                  B] 10  -5                      C] 6    -5                      D] 5    -5
  1. Ravi uses the given statement in his code
    Result=(num1+num2)/(num1-num2)
    He ran his code several times but got error occasionally. Which of the following option is used to refer to such an error?
    A] Logical error                       B] Syntax error                        C] Semantic error         D] Latent error
  2. What is the maximum number of edges in an undirected graph with ‘n’ vertices?
    A] n*(n-1)/2                            B] n*(n+1)/2                C] n*n                         D] 2*n
  3. Which of the following statement is not true in context of anonymous Union data type?
    A] It is a Union that does not have any name
    B] It is not followed by a declaratory
    C] It defines an unnamed object
    D] It defines a data type
  4. Aprajita wants to make a function that is not bound to any identifier. Which of the following functions should she incorporate in her program?
    A] Anonymous function                                                          B] Friend function
    C] NULL function                                                       D] Global function
  5. Talika needs to implement heterogeneous linked list for her project. Which of the following pointers will help her do the same?
    A] Void pointer
    B] NULL pointer
    C] Wild pointer
    D] Hetrogeneous list follows the same procedure as homogeneous linked list. Hence no different
    pointer is required
  6. The program to print the sum of all cubes that lie between 0 & 100 is given below. Does this program have any error? If yes, which statement should be modified to correct the program?
Integer i=0, a  //Statement 1
Integer sum =0;
a=(i*i*i)
while(i<100)  //Statement 2
{
sum=sum+a   // Statement 3
i=i+1
a=(i*i*i)      // Statement 4
}
Print sum
A] Statement 1                         B] Statement 2                         C] Statement 3
D] Statement 4                         E] No Error
  1. What will be returned if f(a,b) is called in the following functions?
Function g(int n)
{
If(n>0)
Return 1;
Else
Return -1;
}
Function f(int a, int b)
{
If(a>b)
Return g(a-b);
If((a<b)
Return g(-b+a);
Return 0;
}
A] Always +1
B] 1 if a>b, -1 ifa<b, 0 otherwise
C] -1 if a>b, 1 ifa<b, 0 otherwise
D] 0 if a equals b, -1 otherwise
  1. Sneha uses a runtime environment in which a program runs slowly for few minutes and after that executes quickly. Which of the following options is true regarding the involved environment?
    A] The environment uses the dynamic compilation
    B] The environment uses the static compilation
    C] The program involves functioning on pointes
    D] Information not enough to comment on the environment
  2. A language has 28 different letters in total. Each word in the language consists of maximum 7 letters. A programmer wants to create a data type to store a word of this language. She decides to store a word as array of letters. How many bits she should assign to a datatype to store all kind of words in the language?
    A] 7                             B] 35                           C] 28                           D] 196
  3. How can the largest number in the list of 20 numbers be found?
    A] Use Bubble sort to sort the numbers in descending order and then print the first number
    B] Use Selection sort to sort the numbers in descending order and then print the first number
    C] Implement one iteration of selection sort for descending order and print the first number in series
    D] None of the above
  4. Integer  num, reverse=0, n
    Input num
    n=num
    while(num!=0)
    {
    // missing statement
    Num=num/10
    }
    Consider the pseudo code. Radha wants to reverse a number using the given code. What should be the missing statement in the given code?
    A] reverse=reverse*10+num%10                                B] reverse=reverse+num%10
    C] reverse=reverse*10+num                                        D] reverse=reverse*10+num/10
22.  Consider the given conditions in regards to the circular queue
1. (FRONT=0) and (REAR=CAPACITY-1)
2. FRONT=REAR
3. FRONT=CAPACITY-REAR
Which of the above conditions tests the overflow condition of the circular queue?
A] Only 1                                B] Only 2                     C] Only 3                     D] Both 1 and 2
E] Both 1 and 3
  1. A programmer prepares a questionnaire with “true” or “false” type of questions. He wants to define a data type that stores the responses of the candidates for questions. Which of the following is the most suited data type for this purpose?
    A] Integer                                B] Boolean                  C] Float                        D] Character
24.  What is a function contained within a class?
A] A member function                                                           B] An operator
C] A class function                                                    D] A method

25.  Which of the following will create an object named pigeon of the class bird in C++?
A] pigeon bird                                                             B] bird pigeon             
C] Object pigeon of bird                                              D] None of the above

26.  Akshit has a large list of fixed length numbers. He need to sort this list using an efficient technique. Which of the following techniques can be used?
A] Selection sort                                                          B] Radix sort
C] Shell sort                                                                 D] Quick sort
27.  Function myfunc1( int n)
{
Return n*2
}
Function myfunc2(int n)
{
Print(“The value is”, n)
}
Which of the given 2 functions can be categorized as per procedure?
A] myfunc1()                         
B] myfunc2()              
C] Both a & b
D] A function cannot be a procedure
28.  In terms of storage, which of the following would  you use to have a complexity in terms of numbers of vertices & edges
1.      Adjacency List
2.      Incidence List
3.      Adjacency Matrix
A] Only 1                                B] Only 2                     C] Only 3                     D] Both 1 & 2
E] Both 2 & 3
29.  Which of the following refers to data hiding in OOPs
A] A class does not have functions as private members
B] A class has both data & functions, in the data in the class
C] Data in the private & protected area of the class is not directly accessible & can only be accessed through the member functions in the public area of the class
D] A single class can have many objects
30.  Which of the following processes is the construct given below used
If(condition) then A else B
A] Decision making                                                     B] Iteration
C] Recursion                                                                D] Object Oriented Programming
31.  What is the term given to the concept of binding an object with its identifier?
A] Dynamic Binding                                                    B] Name Binding
C] Dynamic Dispatching                                              D] Name Dispatching
32.  In linear list of elements, a deletion can be made from one end(front) and an insertion can be made at the other end(rear). What is this linear list known as?
A] Queue                                 B] Stack                       C] Tree                        D] Branch
33.  What is the first step for developing a working program to solve a problem
A] To write the program in the programming language
B] To write a step by step algorithm to solve a problem
C] To compile the required library
D] To debug the code
34.  How is the Bubble sort algorithm different from the modified Bubble sort algorithm?
A] Former uses more space than the later
B] Former is comparatively easier to implement in terms of codes
C] Former does not stop comparing once the array is sorted unlike the later
D] There is no difference between the two.
  1. Which of the following gives the maximum number of nodes at level “l” of a binary tree?
    (Note: The root is at level 1.)
    A] 2 I-1                                  B] 3I-1                                   C] 2I                                      D] 2I-1
  2. A developer writes the program given below to print the sum of the squares of the first five whole numbers (0….4). Is the program correct? If not, which statement should be modified to correct the program?
integer i=0 // Statement 1
integer sum =0 // Statement 2
while(i<5)// Statement 3
{
Sum=i*I // Statement 4
i=i+1 // Statement 5
}
print sum // Statement 6

A] No error, the program is correct
C] Statement 1
B] Statement 4
D] Statement 6


  1. Consider the following:
Class rocket
{
Private:
        integer height,weight
        public: //statement 1
        function input(int a,int b)
         {
height=a;
weight=b;
         }
}
function main()
{
rocket rocket 1,rocket2
}
What can we infer from this code?
Choose the correct answer. A pseudo-code which is similar to that of c++ and self-explanatory. An accessible member function or data member for an object are accessed by the statement object name, function name or object name data member name respectively.
A]  rocket is a class with rocket 1 and rocket2 as its objects.height and weight are attributes of a rocket.
B] rocket is a class with rocket1 and rocket2 as its attributes.height and weight are objects of the class rocket.
C] rocket is a class with rocket1,rocket2,height and weight as its attributes
D] rocket is a class with rocket1, rocket2, height, weight as its objects.

  1. There are two loops which are nested. This implies which one of the following? Choose the correct answer?
    A] Two loops, one after the other                                B] Two one inside the other
    C] One loop with two different iteration counts.                      D] Two loops with one iteration counts
  2. In an implementation of a linked list, each node contains data and address. Which of the following can the address field possibly contain?
    A] Address of the next node in sequence                    B] Its own address
    C] Address of the last one                                           D. Address of the first node
  3. How many pointers will have to be changed when a new node is to be deleted  in a linear linked list in the middle?
    A] 0                                                                             B] 1
    C] 2                                                                             D] All the pointers will be changed
  4. In which of the following situations can a constructor be invoked?
    A] When an object is created                                      
    B] When an object is assigned the value 0
    C] Only at the end of the code                                                
    D] When the scope of the object is over
  5. Which of the following statements is TRUE about a variable?
    A] A variable cannot be used before it is declared.
    B] A variable cannot be used after it is declared.
    C] A variable cannot be used in the function it is declared in.
    D] A variable can always be used.

  1. A programmer wants the program given below to print the largest number out of two numbers entered by the user. Which of the following should be substituted in place of "??" in Statement 1 in the code? 
int number1, number 2
input number1, number2
if (??)// Statement 1
print number1
else
print number2
endif
A]  number1 >number2                                                           B] number2 >number1
C] number2 equals number1                                        D] number1 <=number2
  1. In which area of a class are data and function directly accessible outside the class? Choose the correct answer


      A] Public                     B] Private                     C] Protected                 D] None of these

  1. The function given below computes the factorial of the number "n" entered by a user. What should be the "MISSING STATEMENT" in order to make the code work properly?
function factorial(n)
{
if (n equals 1)
 return 1
else
 -- MISSING STATEMENT –
end
}
A] return factorial(n-1)                                                B] return n*factorial(n)
            C] return n*(n-1)                                             D] return n*factorial(n-1)
  1. Every element of a data structure has an address and a key associated with it. A search mechanism deals with two or more values assigned to the same address by using the key. What is this search mechanism?
    A] Linear search                                                          B] Hash coded search                      
    C] Binary search                                                          D] None of this

  1. A football seller stores footballs in a large container to store footballs which is closed from below. Footballs are piled one on top of the other in the box. When new balls are supplied, Pragya puts the balls in the box from the top. When a customer buys a ball, she delivers the ball at the top of the pile to the customer. Each ball has a code.  She wants to store the ball codes in the data structure to keep track of her inventory. What data structure should she use? Choose the correct answer?
    A] Queue                     B] Stack                       C] Array                      D] Graph
  2. The following operations are performed on an empty stack "A"
PUSH(1)
PUSH(2)
POP
PUSH(5)
PUSH(6)
 POP
What will the stack contain after these operations?
(Note: The top of the stack is underlined in the options below)
A] 5 6                          B] 1 5                          C] 5 6                          D]  1 5

  1. A full binary tree with “n” non-leaf nodes contain?
    A] 2n+1 nodes             B] log n                 C. n+1                  D. 2n nodes
  2. A programmer mistakenly writes "gor" instead of the keyword "for" used in loops, while writing a program in C++. What will this result in?
    A] The code would not compile.
    B] The code would give an error while execution.
    C] The code may work for some inputs and not for the others.
    D] The code would not create any problem.
  3. Why is an algorithm designer concerned primarily about the run time and not the compile time while calculating time complexity of an algorithm?
    A] Run time is always more than the compile time.
    B] Compile time is always more than the run time.
    C] Compile time is a function of run time.
    D] A program needs to be compiled once but can be run several times.
  4. Sorting is not possible by using which of the following method?  Choose the correct answer ?
    A] Insertion                 B] Selection                 C] Exchange                D] Deletion
  5. A programmer writes a sorting algorithm that takes different amount of time to sort two different lists of equal size. What is the possible difference between the two lists?
    A] All numbers in one list are more than 100 while in the other are less than 100.
    B] The ordering of numbers with respect to the magnitude in the two lists has different properties.
    C] One list has all negative numbers while the other has all positive numbers.
    D] One list contains 0 as an element while the other does not.
  6. Program
    Class brush
{
Private
Integer size, c
Rcode
Function getdata() {……….}// statement 1
Public
Integer name // statement 2
Function putdata() {……..}
}
Function main
{
Brush b1, b2
Print b1 name // statement 3
B2 getdata () // statement 4
}
Refer to the pseudo-code given in the ‘program’. The code is similar to that in c++ and is self-explanatory. An accessible member function and a data member for an object are accessed by the statements objectname. Functionname and objectname. Datamembername, respectively. Which statement should be deleted from the code to rectify the error in it?
A] Statement 1                         B] Statement 2             C] Statement 3             D] Statement 4
  1. Mary is making a database of animals in a zoo and their properties .The possible animals are dog, lion and zebra. Each one has as attribute is Herbivorous, color and is Nocturnal .She uses the object-oriented programming paradigm for this .How will she conceptualize the system?
    A] Class: Animal; objects: dog, lion and zebra; data members: is Herbivorous, color and is Nocturnal
    B] Class: Animal; objects: is Herbivorous, color and is Nocturnal; data members: dog, lion and zebra
    C] Classes: dog, lion and zebra: objects: Animal; data members: is Herbivorous, color and is Nocturnal
    D] None of these
  2. What is the term used to describe the situation, when a function in the base class is redefined in inherited class?
    A] Inheritance                          B] Overriding               C] Overloading                      D]Encapsulation
  3. For which of the following is the stack implementation useful?
    A] Radix Search                                                          B] Breadth first Search           
    C] Recursion                                                                D] None of the above
  4. A programmer wants to print the following pattern on the screen:
1
1 2
1 2 3
He writes the following program:
integer i=1 //statement1
while(i<=3)
{
int  j //statement2
while(j<=i) //statement3
{
print j
print blank space
j=j+1 //ststement4
}
print end-of-line //takes the cursor to the nextline
i=i+1
}
Choose the correct answer:
            A] Statement 1                         B] Statement 2             C] Statement 3             D] Statement 4             E] Program does not have error
  1. A data type is stored as a 6 bit signed integer. Which of the following options cannot be represented by this data type?
    A] -12                                      B] 0                             C] 32                           D] 18
  2. The function given below takes a number “n” and calculates the sum of first n natural numbers. Which of the following statement should be inserted in place of  ?? to get the required output?
function {
if(??)
       return 1
else
       return (n+sum(n-1))
end
}
A] n equals 1                           B] n equals 2               C] n>=1                       D] n>1
  1. A programmer wants the program given below to print the largest number out of three numbers entered by the user.
    int number1, number 2, number3, temp;
    input number1, number2, number3;
    if (number1 >number2)
    temp = number1
    else
    temp = number2
    end if
    if (??) // Statement 1
    temp = number3
    end if
    print temp
    Which of the following should be substituted in place of "??" in Statement 1 in the code?
    A] number3 >number2                                                            B] temp <number3
    C] temp >number3                                                       D] number3 >number1
  2. Which of these is NOT a data type?
    A] Integer                    B] character                             C] Boolean                  D] array
  3. A sorting algorithm traverses through a list, comparing adjacent elements and switching them under certain conditions. What is this sorting algorithm called?
    A] Insertion sort           B] Heap sort                            C] Quick sort               D] Bubble sort
  4. In an implementation of a linked list, each node contains data and address. Which of the following can the address field possibly contain?
    A] Address of the next node in sequence                    B] Its own address
    C] Address of the last one                                           D] Address of the first node
  5. A programmer tries to debug a code of 10,000 line code. She knows there is a logical error in the first 25 lines of the code. Which of the following options will be an efficient way of debugging?
    A] Compile the whole code and step into it line by line                        
    B] Use an interpreter on the first 25 lines
    C] Compile the whole code and run it                                                         
    D] None of above can be used to debug the code
  6. Sorting is not possible by using which of the following method?  Choose the correct answer ?
    A] Insertion                 B] Selection                             C] Exchange                D] Deletion
  7. What will be the output of the following pseudo-code statements?
     Integer a = 456, b, c, d = 10
     b = a/d
     c = a-b
     print c
A] 410                         B] 410.4                                  C] 411.4                      D] 411
  1. A programmer writes a program to find an element in the array A[5] with the following elements in order: 8 30 40 45 70. She runs the program to find a number X. X  is found in the first iteration of binary search. What is the value of X? Choose the correct answer.
    A] 40                           B] 8                                         C] 70                           D] 30
  2. Output of  the following program.
integer i=0,j
                                while( i < 2  )
                                {
                                                j = 0;
                                                while ( j <= 3*i )
                                                {
                                                                print j
                                                                print blank space
                                                                j = j + 3
                                                }
                                                print end-of-line //takes the cursor to the next line
                                                i = i + 1
                                }
                What will be the output of the program?
            A] 0                             B] 0 3                          C] 0                        D] 0 3 6
                  0 3                                 0 3 6                                     0 3 6                       0 3 6 9
                                                                                          0 3 6 9                   0 3 6 9 12


  1. Integer a = 40, b = 35, c = 20, d = 10
Comment about the output of the following two statements:
print a * b / c - d
print a * b / (c - d)
A] Differ by 80                       B] Same                       C] Differ by 50                        D] Differ by 160

  1. A sort, which uses the binary tree concept such that any number in the tree is larger than all the numbers in the sub tree below it, is called
    A] Selection sort          B] Insertion sort           C] Heap Sort                D] Quick sort
  2. Which of the following abstract data types can be used to represent many – to- many relations? Choose the correct answer?
    A] Tree                                    B] Stack                       C] Graph                      D] Queue
  3. For the given array, find the arrangement of the elements after 3rd pass of selection sort. Assume that the array is being sorted in ascending order list ; 33,22, 11, 77, 66, 88, 55
    A] 22, 11, 33, 66, 77, 55, 88                           B] 11, 22, 33, 55, 66, 77, 88
    C] 11, 22, 33, 55, 66, 88, 77                           D] 11, 22, 33, 77, 66, 88, 55
  4. Two programmers independently write a program to find the mass of one mole of water, that includes the masses of hydrogen and oxygen.
    The first programmer defines the variables as:
    integer hydrogen, oxygen, water // Code A
The second programmer defines three quantities as:
integer a, b, c // Code B
Which of the two is a better programming practice and why?
A] Code B is better because variable names are shorter.
B] Code A is better because the variable names are understandable and non-confusing.
C] Code A would run correctly while Code B would give an error.
D] Code B would run correctly while Code A would give an error.

  1. A stack is implemented as a linear array A [0…..N-1]. A programmer writes the function given below to pop out an element from the stack.
function POP(top, N)
{
if(X)
{
Top=top-1
}
else
{
print”Underflow”
}
return top
}
Which of the following should substitute the condition “X”?
A] top<N-1                  B] top<N                      C] top>1                      D] top>=0

  1. Which of the following statements is TRUE about a breadth first search?
    A] Beginning from a node, all the adjacent nodes are traversed first
    B] Beginning from a node each adjacent node explored before traversing the next adjacent node
    C]
    Beginning from a node, the nodes are traversed in cyclic order
    D] None of the above.
  2. What is implied by the argument of a function?
    A] Variables passed to it when it is called                    B] The value is returns on execution|
    C] The execution code inside it                                               D] Its return type
  3. A programmer writes a code snippet in which a set of three lines occurs ten times in different parts of the program. What programming concept should be used to shorten the code length?
    A] For loops                B] Functions                C] Arrays                     D] Classes
  4. A queue is implemented as a singly linked-list. Each mode has an element and a pointer to another node. The Rear and the Front contain the addresses of the rear and the front node, respectively. What can be inferred about the linked list if the condition (rear is equal front) is true?
    A] It has no elements                                                   B] It has one element
    C] There is an error                                                      D] None of the above
  5. The algorithm design technique used in quick sort algorithm is? Choose the correct answer
    A] Dynamic programming                                           B] Back tracking
    C] Divide and conquer                                                D] Greedy search
  6. The program to print the larger of the two numbers entered by a user is given below. Which of the following should be substituted in place of "??" in Statement 1 of the code to get the desired output?
int number1 , number 2
input number1, number 2
if (??) // Statement 1
print number1
else
print number2
end if
A] number1>number2                                                             B] number2>number1
C] number2 equals number1                                       D] number1 <= number2

  1. Integer a = 50, b = 25, c = 5
Comment about the output of the following two statements:
print a * b / c + c
A] 120                                     B]125                          C] 255                         D] 250

  1. A complete binary tree with five levels has how many nodes? (root is level 1) Choose the correct answer?
    A] 15                                       B] 25                           C] 63                           D] 31


Suggested Courses for Summer Training

Dear Students, Following are the evaluated vendors through the School of Professional Enhancement -1 for all students, who will be u...