Professional Documents
Culture Documents
144 Captitude
144 Captitude
***********************************************************************
1. Apti+Coding(basics)
2. Self Introduction(In front of CEO)
3. Technical(Basics of C & java)
4. Two HR rounds
***************************************************
Time and Distance
Time and Work
Compound Interest
Partnership
Problems on Ages
Clock
********************************************
A can do a work in 15 days and B in 20 days. If they work on it together for 4
days, then the fraction of the work that is left is :
A.
1
4
B.
1
10
C.
7
15
D.
2.
A can lay railway track between two given stations in 16 days and B can do the same
job in 12 days. With help of C, they did the job in 4 days only. Then, C alone can
do the job in:
A.
9 1 days
5
B.
9 2 days
5
C.
9 3 days
5
D. 10
3.
A, B and C can do a piece of work in 20, 30 and 60 days respectively. In how many
days can A do the work if he is assisted by B and C on every third day?
A. 12 days
B. 15 days
C. 16 days
D. 18 days
4.
A is thrice as good as workman as B and therefore is able to finish a job in 60
days less than B. Working together, they can do it in:
A. 20 days
B.
22 1 days
2
C. 25 days
D. 30 days
5.
A alone can do a piece of work in 6 days and B alone in 8 days. A and B undertook
to do it for Rs. 3200. With the help of C, they completed the work in 3 days. How
much is to be paid to C?
A. Rs. 375
B. Rs. 400
C. Rs. 600
D. Rs. 800
11.
A can finish a work in 18 days and B can do the same work in 15 days. B worked for
10 days and left the job. In how many days, A alone can finish the remaining work?
A. 5
B.
5 1
2
C. 6
D. 8
View Answer Discuss in Forum Workspace Report
12.
4 men and 6 women can complete a work in 8 days, while 3 men and 7 women can
complete it in 10 days. In how many days will 10 women complete it?
A. 35
B. 40
C. 45
D. 50
View Answer Discuss in Forum Workspace Report
13.
A and B can together finish a work 30 days. They worked together for 20 days and
then B left. After another 20 days, A finished the remaining work. In how many days
A alone can finish the work?
A. 40
B. 50
C. 54
D. 60
View Answer Discuss in Forum Workspace Report
14.
P can complete a work in 12 days working 8 hours a day. Q can complete the same
work in 8 days working 10 hours a day. If both P and Q work together, working 8
hours a day, in how many days can they complete the work?
A.
5 5
11
B.
5 6
11
C.
6 5
11
D.
6 6
11
***********************************************************************************
***************
int main()
{
fun("IndiaBIX", 1, 4, 7, 11, 0);
return 0;
}
void fun(char *msg, ...)
{
va_list ptr;
int num;
va_start(ptr, msg);
num = va_arg(ptr, int);
num = va_arg(ptr, int);
printf("%d", num);
}
A. IndiaBIX 1 7 11 0
B. 1
C. 4
D. 7
View Answer Discuss in Forum C Compiler Report
2.
What will be the output of the program?
#include<stdio.h>
#include<stdarg.h>
void fun1(char, int, int *, float *, char *);
void fun2(char ch, ...);
void (*p1)(char, int, int *, float *, char *);
void (*p2)(char ch, ...);
int main()
{
char ch='A'; int i=10;
float f=3.14; char *p="Hello";
p1=fun1;
p2=fun2;
(*p1)(ch, i, &i, &f, p);
(*p2)(ch, i, &i, &f, p);
return 0;
}
void fun1(char ch, int i, int *pi, float *pf, char *p)
{
printf("%c %d %d %f %s \n", ch, i, *pi, *pf, p);
}
void fun2(char ch, ...)
{
int i, *pi; float *pf; char *p;
va_list list;
printf("%c ", ch);
va_start(list, ch);
i = va_arg(list, int);
printf("%d ", i);
pi = va_arg(list, int*);
printf("%d ", *pi);
pf = va_arg(list, float*);
printf("%f ", *pf);
p = va_arg(list, char *);
printf("%s", p);
}
A. A 10 3.14
A 10 3.14
B. A 10 10 3.140000 Hello
A 10 10 3.140000 Hello
C. A 10 Hello
A 10 Hello
D. Error
View Answer Discuss in Forum C Compiler Report
3.
What will be the output of the program?
#include<stdio.h>
#include<stdarg.h>
void dumplist(int, ...);
int main()
{
dumplist(2, 4, 8);
dumplist(3, 6, 9, 7);
return 0;
}
void dumplist(int n, ...)
{
va_list p; int i;
va_start(p, n);
while(n-->0)
{
i = va_arg(p, int);
printf("%d", i);
}
va_end(p);
printf("\n");
}
A. 2 4
3 6
B. 2 4 8
3, 6, 9, 7
C. 4 8
6 9 7
D. 1 1 1
1 1 1 1
View Answer Discuss in Forum C Compiler Report
4.
What will be the output of the program?
#include<stdio.h>
#include<stdarg.h>
void display(int num, ...);
int main()
{
display(4, 'A', 'B', 'C', 'D');
return 0;
}
void display(int num, ...)
{
char c, c1; int j;
va_list ptr, ptr1;
va_start(ptr, num);
va_start(ptr1, num);
for(j=1; j<=num; j++)
{
c = va_arg(ptr, int);
printf("%c", c);
c1 = va_arg(ptr1, int);
printf("%d\n", c1);
}
}
A. A, A
B, B
C, C
D, D
B. A, a
B, b
C, c
D, d
C. A, 65
B, 66
C, 67
D, 68
D. A, 0
B, 0
C, 0
C, 0
View Answer Discuss in Forum C Compiler Report
5.
What will be the output of the program?
#include<stdio.h>
#include<stdarg.h>
void fun1(int num, ...);
void fun2(int num, ...);
int main()
{
fun1(1, "Apple", "Boys", "Cats", "Dogs");
fun2(2, 12, 13, 14);
return 0;
}
void fun1(int num, ...)
{
char *str;
va_list ptr;
va_start(ptr, num);
str = va_arg(ptr, char *);
printf("%s ", str);
}
void fun2(int num, ...)
{
va_list ptr;
va_start(ptr, num);
num = va_arg(ptr, int);
printf("%d", num);
}
A. Dogs 12
B. Cats 14
C. Boys 13
D. Apple 12
LINUX QUESTION
*******************************************
https://www.indiabix.com/computer-science/linux/
*******************************************
What command is used to count the total number of lines, words, and characters
contained in a file?
A. countw
B. wcount
C. wc
D. count p
E. None of the above
2.
What command is used to remove files?
A. dm
B. rm
C. delete
D. erase
E. None of the above
3.
What command is used to remove the directory?
A. rdir
B. remove
C. rd
D. rmdir
E. None of the above
View Answer Discuss in Forum Workspace Report
4.
What command is used with vi editor to delete a single character?
A. x
B. y
C. a
D. z
E. None of the above
View Answer Discuss in Forum Workspace Report
5.
What hardware architectures are not supported by Red Hat?
A. SPARC
B. IBM-compatible
C. Alpha
D. Macintosh
E. None of the above
***********************************************************************************
***********************************************************************************
********
SECOND
coding round:
***********************************************************************************
*******
1. Quick sort(Compulsory)
2. find second largest element of an array without sorting
3. check weather even or odd without using division and modulus operator
4. count number of occurance of each character in a string.
5. find power of a number.
**********************************************************************************
2ND ROUND
Coding Round - answer any 3 from 5 questions.Just write code in a paper (c/c+
+/java/perl/php)
*************************************************************************
INTERVIEW
****************************************************************
3. Technical Interview - (Face to face interview) self introduction, project
related questions, simple programs, basic cs questions
***********************************************************************************
************************
1. Quick sort(Compulsory)
2. find second largest element of an array without sorting
3. check weather even or odd without using division and modulus operator
4. count number of occurance of each character in a string.
5. find power of a number.
quick sort
some integers have to stored using command line argument and find the index value
of one them
1. Which two method you need to implement for key Object in HashMap ?
In order to use any object as Key in HashMap, it must implements equals and
hashcode method in Java. Read How HashMap works in Java for detailed explanation
on how equals and hashcode method is used to put and get object from HashMap.
2. What is immutable object? Can you write immutable object?Immutable classes are
Java classes whose objects can not be modified once created. Any modification in
Immutable object result in new object. For example is String is immutable in Java.
Mostly Immutable are also final in Java, in order to prevent sub class from
overriding methods in Java which can compromise Immutability. You can achieve same
functionality by making member as non final but private and not modifying them
except in constructor.
does not put the object in String pool , we need to call String.intern() method
which is used to put them into String pool explicitly. its only when you create
String object as String literal e.g. String s = "Test" Java automatically put that
into String pool.
Classic Java questions which some people thing tricky and some consider very easy.
StringBuilder in Java is introduced in Java 5 and only difference between both of
them is that Stringbuffer methods are synchronized while StringBuilder is non
synchronized. See StringBuilder vs StringBuffer for more differences.
5. Write code to find the First non repeated character in the String ?
Another good Java interview question, This question is mainly asked by Amazon and
equivalent companies. See first non repeated character in the string : Amazon
interview question
7. How do you handle error condition while writing stored procedure or accessing
stored procedure from java?
This is one of the tough Java interview question and its open for all, my friend
didn't know the answer so he didn't mind telling me. my take is that stored
procedure should return error code if some operation fails but if stored procedure
itself fail than catching SQLException is only choice.
12. Can you write code for iterating over hashmap in Java 4 and Java 5 ?
Tricky one but he managed to write using while and for loop.
14. What will be the problem if you don't override hashcode() method ?
You will not be able to recover your object from hash Map if that is used as key in
HashMap.
See here How HashMap works in Java for detailed explanation.
16. What is the difference when String is gets created using literal or new()
operator ?
When we create string with new() its created in heap and not added into string pool
while String created using literal are created in String pool itself which exists
in Perm area of heap.
17. Does not overriding hashcode() method has any performance implication ?
This is a good question and open to all , as per my knowledge a poor hashcode
function will result in frequent collision in HashMap which eventually increase
time for adding an object into Hash Map.
18. What�s wrong using HashMap in multithreaded environment? When get() method go
to infinite loop ?
Another good question. His answer was during concurrent access and re-sizing.
Let's first discuss about Memory Barrier which are the base for our further
discussions. There are two type of memory barrier instructions in JMM - read
barriers and write barrier.
A read barrier invalidates the local memory (cache, registers, etc) and then reads
the contents from the main memory, so that changes made by other threads becomes
visible to the current Thread.
A write barrier flushes out the contents of the processor's local memory to the
main memory, so that changes made by the current Thread becomes visible to the
other threads.
JMM semantics for synchronized
When a thread acquires monitor of an object, by entering into a synchronized block
of code, it performs a read barrier (invalidates the local memory and reads from
the heap instead). Similarly exiting from a synchronized block as part of releasing
the associated monitor, it performs a write barrier (flushes changes to the main
memory)
Thus modifications to a shared state using synchronized block by one Thread, is
guaranteed to be visible to subsequent synchronized reads by other threads. This
guarantee is provided by JMM in presence of synchronized code block.
Thread A
-------------
data = new Data();
flag = true; <-- writing to volatile will flush data as well as flag to main
memory
Thread B
-------------
if(flag==true){ <-- as="" barrier="" data.="" flag="" font="" for="" from=""
perform="" read="" reading="" volatile="" well="" will="">
use data; <!--- data is guaranteed to visible even though it is not declared
volatile because of the JMM semantics of volatile flag.
}
20. What will happen if you call return statement or System.exit on try or catch
block ? will finally block execute?
This is a very popular tricky Java question and its tricky because many programmer
think that finally block always executed. This question challenge that concept by
putting return statement in try or catch block or calling System.exit from try or
catch block. Answer of this tricky question in Java is that finally block will
execute even if you put return statement in try block or catch block but finally
block won't run if you call System.exit form try or catch.
20. What will happen if we put a key object in a HashMap which is already there ?
This tricky Java questions is part of How HashMap works in Java, which is also a
popular topic to create confusing and tricky question in Java. well if you put the
same key again than it will replace the old mapping because HashMap doesn't allow
duplicate keys.
22. What is the issue with following implementation of compareTo() method in Java
23. How do you ensure that N thread can access N resources without deadlock
If you are not well versed in writing multi-threading code then this is real tricky
question for you. This Java question can be tricky even for experienced and senior
programmer, who are not really exposed to deadlock and race conditions. Key point
here is order, if you acquire resources in a particular order and release resources
in reverse order you can prevent deadlock.
***********************************************************************************
*****************
INTERVIEW REVIEW
*************************************************
Terralogic (Bengaluru) in April 2016.
Interview
there were total 4 rounds . Aptitude , codeing , technical (will ask you questions
based on what you have menstioned in your resume . ) and manager round (he will
basically ask u abt youself and wat have you did in your project , basically its
kind of communication round nothing technical)
Interview Questions
can we add hello world program as jar file
I interviewed at Terralogic (Bengaluru) in April 2017.
Interview
I had attended the walk in interview at Terralogic. There were 4 rounds on day 1:
1. Aptitude-(60 questions -60 minutes) linux, c, general aptitude questions. I
didnt attend linux questions. c and aptitude questions were easy to get qualified
for next round.
2. Coding Round - answer any 3 from 5 questions.Just write code in a paper (c/c+
+/java/perl/php)
3. Technical Interview - (Face to face interview) self introduction, project
related questions, simple programs, basic cs questions
4. Managerial round- Due to lack of time. This round was set a Interaction with
CEO.
After 2 weeks ,they called me and told i have cleared all 4 rounds n asked to
attend the managerial round once again.
That day there was a face to face interview with manager. He asked basic questions
like linked list , programs that were asked in coding round, about project etc..
Then there was a round of technical interview .. They asked some programs :to find
factors of 8 using logical operators, stack related questions.
Again after 2-3 weeks they send offer letter...
Show Less
Interview Questions
coding round: