Tuesday, 15 July 2014

Citicorp Written Test

1 comments

Written Test


Section-1 : C programming 25 Questions 35 mins.
Section-2 : Quants 16 Questions 16 min.
Section-3 : Logical Aptitude 15 Questions 14 min
Section-4 : C Programming 2 Questions 80 min

NOTE : Different question set for each student,programming questions are also different. No switching is allowed between the question.

Sample Programming Questions

Question-1


You are given a string and u need to encrypt it

for eg:
01234 0123 012 0123456
hello dere and welcome (given string)
hfnos dfth .. ..       (output string)

So you need to add the index of character to itself. Also if the character is 'z' and you have to add say 3 to it then it should wrap around and be 'c'. If it is 'Z' then it should be 'C'

Question-2


you are given a matrix (m x n) of which elements in its first row and col are 0 rest of them are 1 except one, and that one element is 9 you have to find location of that 9. It should be done with dynamic programming.

Question-3


A adjacency matrix is given and  you need to find whether it represents Graph or Tree?

Question-4


To traverse the link list and find if there is a cycle in that link list.

All The Best.
Read More..

Google Written Test

0 comments

Section A


Question-1


Quick-sort is run on two inputs shown below to sort in ascending order
(i) 1,2,3, ….,n
(ii) n, n - 1, n - 2, …., 2, 1
Let C1 and C2 be the number of comparisons made for the inputs (i) and (ii) respectively. Then,
a) C1 < C2
b) C1 > C2
c) C1 = C2
d) We cannot say anything for arbitrary n

Question-2


Which of the following languages over {0, 1} is regular?
a) 0i1j such that i ≤ j
b) 0iw1j such that w ∈ {0, 1}∗ and i ≥ 0
c) All strings of 0s and 1s such that every pth character is 0 where p is prime
d) None of the above

Question-3


We are given a set X = {x1, x2, ..., xn} where xi = 2i. A sample S (which is a subset of X) is
drawn by selecting each xi independently with probability pi = 1 / 2. The expected value of the
smallest number in sample S is:
a) 1 / n
b) 2
c) sqrt(n)
d) n

Question-4


Let S be an NP-complete problem and Q and R be two other problems not known to be in
NP. Q is polynomial time reducible to S and S is polynomial-time reducible to R. Which one of
the following statements is true?
a) R is NP-complete
b) R is NP-hard
c) Q is NP-complete
d) Q is NP-hard

Question-5


For any string s ∈ (0 + 1)*, let d(s) denote the decimal value of s (eg: d(101) = 5, d(011) = 3).
Let L = {s ∈ (0+1)* | d(s) mod 5 = 2 and d(s) mod 7 = 4}. Which of the following statements is
true?
a) L is recursively enumerable, but not recursive
b) L is is recursive, but not context-free
c) L is context-free, but not regular
d) L is regular
Common data for questions 6 and 7
The 2n vertices of a graph G corresponds to all subsets of a set of size n. Two vertices of G are
adjacent if and only if the corresponding sets intersect in exactly 2 elements

Question-6


The number of vertices of degree zero in G is:
a) 1
b) n
c) 2n - 1
d) None

Question-7


The number of connected components in G is:
a) 2n
b) n + 2
c) n C 2
d) None

Question-8


There are 5 nested loops written as follows,
int counter = 0;
for (int loop_1=0; loop_1 < 10; loop_1++) {
for (int loop_2=loop_1 + 1; loop_2 < 10; loop_2++) {
for (int loop_3=loop_2 + 1; loop_3 < 10; loop_3++) {
for (int loop_4=loop_3 + 1; loop_4 < 10; loop_4++) {
for (int loop_5=loop_4 + 1; loop_5 < 10; loop_5++) {
counter++;
}
}
}
}
}
What will be the value of counter in the end (after all the loops finished running)?
a) 15C5
b) 14C5
c) 10C5
d) 10 * 9 * 8 * 7 * 6 * 5

Question-9


The enter_CS() and leave_CS() functions to implement critical section of a
process are realized using test-and-set instruction as follows:
void enter_CS(X) {
while(test-and-set(X));
}
void leave_CS(X) {
x=0;
}
In the above solution , X is a memory location associated with the CS and is
initialized to 0. Now consider the following statements:
1. The above solution to CS problem is deadlock free
2. The solution is not starvation free
3. The processes enter CS in FIFO order
4. More than one process can enter CS at the same time
Which of the above statements is TRUE
a) 1
b) 1 and 2
c) 1 and 3
d) 2 and 4

Question-10


The following 'C' code prints:
void f(char *x) {
x++;
*x = ‘a’;
}
int main() {
char *str = "hello";
f(str);
printf("%s", str);
}
a) hello
b) allo
c) hallo
d) empty string

Question-11


An insurance company issues a policy on a small boat under the following
conditions:
The replacement cost of $5000 will be paid for a total loss. If it is not a total loss,
but the damage is more than $2000, then $1500 will be paid. Nothing will be
paid for damage costing $2000 or less and of course nothing is paid out if there
is no damage. The company estimates the probability of the first three events
as .02, .10, and .30 respectively. The amount the company should charge for the
policy if it wishes to make a profit of $50 per policy on average is:
a) $250
b) $201
c) $300
d) $1200

Question-12


We are given an array A with 8 distinct elements. Arrays B and C have 5 and 3
elements respectively and they are populated with elements from A. (The union of
elements in B and C give the elements in A)
In how many ways can the arrays B & C be populated such that both B and C have
elements in sorted (ascending) order.
a) 56
b) 128
c) 256
d) None

Question-13


Increasing the RAM of a computer typically improves performance because:
a. Virtual memory increases
b. Larger RAMs are faster
c. Fewer segmentation faults occur
d. Fewer page faults occur

Question-14


Suppose we want to synchronize two concurrent processes P and Q using binary
semaphores S and T. The code for the processes P and Q is shown below.
Process P:
while (1) {
W:
print '0’;
print '0';
X:
}
Process Q:
while (1) {
Y:
print '1'
print '1'
Z:
}
Synchronization statements can be inserted only at points W, X, Y and Z.
V() increments the semaphore, whereas P() decrements it
Which of the following will always lead to an output staring with '001100110011' ?
a) P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T initially 1
b) P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S initially 1, and T initially 0
c) P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1
d) P(S) at W, V(S) at X, p(T) at Y, V(T) at Z, S initially 1, and T initially 0

Question-15



Which of the following statements are true?
I Shortest remaining time first scheduling may cause starvation
II Preemptive scheduling may cause starvation
III Round robin is better than first come first serve in terms of response time
a) I only
b) I and III only
c) II and III only
d) I, II and III

Question-16


A 4-stage pipeline has the stage delays as 150, 120, 160 and 140 ns (nano seconds)
respectively. Registers that are used between the stages have a delay of 5 ns each. Assuming
constant clocking rate, the total time taken to process 1000 data items on this pipeline will
approximately be
a. 120 us (micro seconds)
b. 165 us
c. 180 us
d. 175 us

Question-17


Consider a disk system with 100 cylinders. The requests to access the cylinders occur in
following sequences
4, 34, 10, 7, 19, 73, 2, 15, 6, 20
Assuming that the head is currently at cylinder 50, what is the time taken to satisfy all requests
it it takes 1ms to move from one cylinder to adjacent one and shortest seek time first policy is
used?
a. 95ms
b. 119ms
c. 233ms
d. 276ms

Section B : Code


1. Write the code to find lexicographic minimum in a circular array, e.g. for the array
BCABDADAB, the lexicographic mininum is ABBCABDAD.

explain logic and write code in paper.

All The Best.
Read More..

Monday, 14 July 2014

Cisco Campus Selection

0 comments

WRITTEN TEST


No. of Questions : 50(20 Qunt + 30 Technical)
Time Limit : 60 Mins
Question type : MCQ

-No negative marking. Mark all answers luck matters :P


Subject Covered in Aptitude Test:


-Digital Logic Desing
-Number Representation
-Flip Flops
-Virtual Memory
-Microprocessor
-DBMS
-OS

Sample Questions :


1. 8 queens problem Recursive

2. Venn diagram ques

3. Area of a circle ques

4. One ques on semaphore

5. Diff between PAM and AM

6. JK flip flop

7. hamming code

8. Boolean function

9. SUB B instruction of 8085

10. RST of 8085

11. minimum number of NAND gates required in Y=A+AB’+AB’C

12. If 423 is multiplied by x and answer is 45569, and 55 are wrong digits, find the right product.
Answer : 35

13. What is a numb that leaves remainder 3 when divided by 5, 6, 7, 8 but 0 when divided by 9.

14. Address of RST6 in 8085

15. No of binary trees possible with n nodes?

16. A goat is tied to a corner of u square, with 7m rope. find the area of grazing?

17. Why Avalanche diode preferred to PIn diodel?

18. One question on flipflop

19. What is Zener diode?


-Two aptitude questions on averages.

-Three on ordering(A can come before B blah blah blah)

-One heights and distances(pythagorean)

-One directions.



Personal Interviews:


-Questions on Processors (core2duo , i3 etc)
-OS (multi-processor scheduling)
-DBMS (transactions)
-Networks(internet super server, TCP, Ping command etc)
-Compilers (phases of compilation)
-A puzzle.

All The Best.
Read More..

Microsoft Campus Selection Guide

0 comments


Selection Procedure


Written Test


Number of Questions : 15 + 2 Coding
Time : 30 Minutes + 1 hour for Coding

Area Cover :
C, C++(Questions from "Test Your C++ skill"), OS(Pagging), COA(Caching)

Note : Given answer of the following questions may or may not correct.

Sample Questions:


1. 48 bit architecture , what is size of virtual address space? 2^48 bytes

2. 1 rabbit couple. Couple will start producing other couple only when their age is one month.Initially in first month one couple is there.
how many couples will be at the end of year.

Hint : fibonacci series


3. Some cpp codes and asked output. (i.e. Virtual Functions from "Test your C++ skill")

4. C codes and output.

5. Find bugs in given code.

6. Complexity of BFS if adjacency list is given.

7. What is used in Demand paging

a) sequential search b) binary search

8. If pointer to function is declared then how to call that function.

9. In a tree every node has 2 children or 0 children. if there are 'n' nodes with 2 children then
how many with 0 children? ans: n+1

10. If we add a constant weight to each edge in a graph will the shortest path “between any two
vertices” change ?

Ans: (May or may not change) //*this will be Depends, not NO, consider a graph whose one
path from A to B has 4 edges of 1 and other path with 2 and 3, now add 1 to all edges..now
shortest path becomes 2 and 3*

11. how many '0' in 100! ? ans: 24 (/5+⅘)100/5+20

12. For recursive fibonacci , what is its complexity ? ans : O(2 pow n)

13.
i=2,
printf("%d%d",++i,++i)

Ans : May be depend on compiler. Check it.

14.
int c[]={2,3,4,5,6},
int *p=c, int *q=c,
(1)for(i=1 to 5){printf("%d",*c); q++}
(2)for(i=1 to 5){printf("%d",*p); p++}


15. x=4|3<<4 ; x= ? ans : 52

16. x= 2, y= 4, z=10 ; if (x<y<z) {printf("abc")} else {printf("pqr")} ?  Ans : abc

17. x=1; mask = ~(x<<5 1)

18. What is
(1) mask & 48
(2) mask & 64
(3) mask & 121

Ans: 32 64 105

19. In an page fault system implementation , what is “good” way to access pages ?
(1) Linear search
(2) Arithmetic indirection
(3) Binary search .
(4) Vector Operation


Ans : 4)and (1)..it was a multiple correct type

20. which of the foll gives most efficient way to access elements sequentially?
(1) LL
(2) DLL
(3) vectors

21. what is the output ?

class A {public: void foo(){printf("a");}};
class B : public A { public: void foo(){printf("b")}};
class C : public B { public: void foo(){printf("c")}};

void foo(B &b){
b.foo();
}

main(){
C c;
foo(c);
}

output : b

22. What is the data structure that has O(log n)complexity on averaging for the operations:
search, insert, delete.

Ans : AVL Tree correct?

23. Find the output:

#include<stdio.h>
int fun(int num) {
while(num > 0) {
num=num*fun(num1);
}
return num;
}
void main() {
x = fun(8);
printf(“%d”,x);
}

Ans : 0

24. Find the output:

int fun(int num)
{
if(num<3)
return 3;
return num+fun(num2);
}
main()
{
int x=fun(12);
int y=fun(13);
printf(“%d %d”,x,y);
}

Ans : 43 51

25.
unsigned int i = 1<<10;
for(; i>=0; i)
printf(“%d\n”, i);

Ans: Infinite loop

26. how to call pointer to a function:
Ans:(*foo)(2) , foo(2) (both are correct)

27.
unsigned int a=1;
unsigned int b=~1;
int z=a*b;
printf(“%d”,z);

Ans: 2

28.
int n = 1000, c = 5;
do{
n/=c;
}while(c);
printf(“%d”, n);

Ans: Arithmetic error (divide by 0)

29.
class A{
public: A()
{
cout <<”AC ”;
}
~A()
{
cout <<”AD “;
}


class B: public A
{
public: B()
{ cout<<”BC “;
}
~B(){cout <<”BD “;}


main()
{
B *b1 = new B();
B b2;
}

Ans: AC BC AC BC BD AD

30.
int fun(int num){
if(num < 3) return 3;
return num + fun(num2);
}

main(){
printf(“%d %d\n”, fun(12), fun(13));
}

Ans: 43,51

31.
void swap(int *a, int *b)
(a) call by name
(b) call by value
(c) call by reference
(d) call by pointer

Ans: Call By Pointer becoz in C++ we have both CBR and CBP and in C++ for CBR we dont
use * in operation we refer object only just by their name in CBR

32.
int fun(int num){
int val = num<<3;
val += num;
return val;
}
main(){
printf(“%d %d %d\n”, fun(0), fun(1), fun(3));
}

Ans: 0 9 27

33.
int MAX=1000;
int a[MAX][MAX];
for(i=0;i<MAX;i++)
for(j=0;j<MAX;j++)
a[j]=i*j;Q.1.
code 1:
code 2:
int MAX=1000;
int a[MAX][MAX];
for(i=0;i<MAX;i++)
for(j=0;j<MAX;j++)
a[i]=i*j;
Which is correct?
a. code 1 is faster
b. code 2 is faster
c. both are same in RISC architecture
d. both are about same

Hint : Caching Mechanism; Refer COA/OS class note of ACE

34. What is the output:

unsigned int x = 1;
int y = ~0;
printf(“%u,%d”,x,)y;
if(x==y)
printf(“same”);
else
printf(“not same”);
a. compilation error.
b. 45….,1
same
c. 45….,1
not same
d. i don’t remember

Ans : B


Sample Coding Questions


Question-1


With a specific color denoted by single character eg. for blue ‘B’. If one position is clicked
(x,y), colour present at that position would be deleted. If the same colour is present in
neighbourhood (up/down/left/right) then it would also be deleted. After deletion blank spaces
will be replaced by the value present in the cell above that. In case no value present above the1.
Given a 2D matrix. Each cell was filled cell then blank entry will be replaced by 0.

Input
x:1 y:1
BGB
BGG
BBB

Output
B00
B0B
BBB

Question-2


Given a linkedlist swap the alternative nodes (assume list have even number of nodes.)
Input : 11>12>13>14
Output : 12>11>14>13

Question-3


Given 2 strings, check if they are anagrams of each other.

Question-4


Delete every nth node in a linkedlist.

Let the LL be, 1>2>3>4>5 and n = 2, then resultant list will be: 1>3>5

Question-5


print last 10 lines of given very large string

Question-6


prune all the nodes from a BST which are not in the range minValue and maxValue

Question-7


In a TicTacToi game two players are playing where player 0 is denoted as 0 and player 1 is denoted as 1. Given a linked list of moves made by the players determine who is the winner and in how many moves he required for winning.

Struct Move{
int p; //Player number
int x; //x and y pos in the tictactoi
int y;
struct Move *next;

The sample function to write is:
void playGame(struct Move *move, int N)

Question-8


Given an array if in a position let a[i][j] =1 then print all it’s row and column 1. You should not
consider a position 1 after you made it 1 in your past computation.
sample(input):
(i)00100
(ii)10 00000 01
output:
(i)11111
(ii)11 00100 11


Refer GeekForGeeks for solution of the above coding questions.

Courtesy : Inter IIT Placement Group.

All The Best

Read More..

Copyright 2011 All Rights Reserved / Privacy Policy / Sitemap / Contact Us

Template by / Blogger Tricks / Powered by / Blogger