Wednesday 28 September 2011

8085 microprocessor questions

  1. What are the various registers in 8085? - Accumulator register, Temporary register, Instruction register, Stack Pointer, Program Counter are the various registers in 8085 .
  2. In 8085 name the 16 bit registers? - Stack pointer and Program counter all have 16 bits.
  3. What are the various flags used in 8085? - Sign flag, Zero flag, Auxillary flag, Parity flag, Carry flag.
  4. What is Stack Pointer? - Stack pointer is a special purpose 16-bit register in the Microprocessor, which holds the address of the top of the stack.
  5. What is Program counter? - Program counter holds the address of either the first byte of the next instruction to be fetched for execution or the address of the next byte of a multi byte instruction, which has not been completely fetched. In both the cases it gets incremented automatically one by one as the instruction bytes get fetched. Also Program register keeps the address of the next instruction.
  6. Which Stack is used in 8085? - LIFO (Last In First Out) stack is used in 8085.In this type of Stack the last stored information can be retrieved first.
  7. What happens when HLT instruction is executed in processor? - The Micro Processor enters into Halt-State and the buses are tri-stated.
  8. What is meant by a bus? - A bus is a group of conducting lines that carriers data, address, & control signals.
  9. What is Tri-state logic? - Three Logic Levels are used and they are High, Low, High impedance state. The high and low are normal logic levels & high impedance state is electrical open circuit conditions. Tri-state logic has a third line called enable line.
  10. Give an example of one address microprocessor? - 8085 is a one address microprocessor.
  11. In what way interrupts are classified in 8085? - In 8085 the interrupts are classified as Hardware and Software interrupts.
  12. What are Hardware interrupts? - TRAP, RST7.5, RST6.5, RST5.5, INTR.
  13. What are Software interrupts? - RST0, RST1, RST2, RST3, RST4, RST5, RST6, RST7.
  14. Which interrupt has the highest priority? - TRAP has the highest priority.
  15. Name 5 different addressing modes? - Immediate, Direct, Register, Register indirect, Implied addressing modes.
  16. How many interrupts are there in 8085? - There are 12 interrupts in 8085.
  17. What is clock frequency for 8085? - 3 MHz is the maximum clock frequency for 8085.
  18. What is the RST for the TRAP? - RST 4.5 is called as TRAP.
  19. In 8085 which is called as High order / Low order Register? - Flag is called as Low order register & Accumulator is called as High order Register.
  20. What are input & output devices? - Keyboards, Floppy disk are the examples of input devices. Printer, LED / LCD display, CRT Monitor are the examples of output devices.
  21. Can an RC circuit be used as clock source for 8085? - Yes, it can be used, if an accurate clock frequency is not required. Also, the component cost is low compared to LC or Crystal.
  22. Why crystal is a preferred clock source? - Because of high stability, large Q (Quality Factor) & the frequency that doesn’t drift with aging. Crystal is used as a clock source most of the times.
  23. Which interrupt is not level-sensitive in 8085? - RST 7.5 is a raising edge-triggering interrupt.
  24. What does Quality factor mean? - The Quality factor is also defined, as Q. So it is a number, which reflects the lossness of a circuit. Higher the Q, the lower are the losses.
  25. What are level-triggering interrupt? - RST 6.5 & RST 5.5 are level-triggering interrupts.

Tuesday 27 September 2011

Logical Questions: You are standing next to a well, and you have two jugs. ....

You are standing next to a well, and you have two jugs. One jug has a content of 3 liters and the other one has a content of 5 liters. How can you get just 4 liters of water using only these two jugs?

Solution 1: Fill the 5 liter jug. Then fill the 3 liter jug to the top with water from the 5 liter jug. Now you have 2 liters of water in the 5 liter jug. Dump out the 3 liter jug and pour what's in the 5 liter jug into the 3 liter jug. Then refill the 5 liter jug, and fill up the 3 liter jug to the top. Since there were already 2 liters of water in the 3 liter jug, 1 liter is removed from the 5 liter jug, leaving 4 liters of water in the 5 liter jug. Solution 2: Fill the 3 liter jug and pour it into the 5 liter jug. Then refill the 3 liter jug and fill up the 5 liter jug to the top. Since there were already 3 liters of water in the 5 liter jug, 2 liters of water are removed from the 3 liter jug, leaving 1 liter of water in the 3 liter jug. Then dump out the 5 liter jug and pour what's in the 3 liter jug into the 5 liter jug. Refill the 3 liter jug and pour it into the 5 liter jug. Now you have 4 liters of water in the 5 liter jug.

TCS Placement Paper On January 2010


TCS Placement Paper On January 2010
TCS ON 29th & 30th JANUARY:
Hi guys I am vamsi from CRR College of engineering, TCS came to our campus on 29th and 30th Jan 2010.
First there will be a pre placement talk, please listen it carefully and take some notes this may be very useful in interviews.
The exam is an online one, there is no sectional cutoff so attempt all of them. The pattern is the same as earlier.
There will be three sections.
1. Verbal-32 questions-20 minutes.
2. Aptitude section-38 questions-40 minutes.
3. Critical reasoning-12 questions-30 minutes.
Though the pattern is same the questions are a bit different from previous ones. Every person will get one section very tuff and the other two sections easy compared to it. I got verbal very toughly. The software used by them is QUBEX. There will be a timer at the top right corner of the window, after every one minute the window will refresh itself, if the time of the section is completed the next section starts immediately, so in the last minute try to attempt all the questions left because in aptitude section you will not have enough time for solving all of them.
VERBAL:
10 synonyms, 10 antonyms, passage containing 6 blanks and another passage having 6 questions.
I don’t know even one antonym and synonym I just kept B or C for all the questions. I read the passage for 7 minutes but can’t understand it properly. The question with blanks is comparatively easy one.

APTITUDE:

The questions in this section are totally different from the previous papers not even one question is repeated from them. They concentrated more on data sufficiency I got nearly 15 questions only on them and also they are very easy too.
This section is divided in to two groups.
The first one has 30 questions mainly questions on data sufficiency.
The second section has 8 questions on data interpretation. 2 parts comprising of 4 questions each. One is a passage and the other is bar or pie chart or both. It is better to answer these questions first because they are easy compared to other ones and as the time is not sufficient for answering all the questions.
I remember only a few models which I am giving here.
1.) How old will C be after 10 years?
Statement 1: Five years ago the average of A and B is 15 years. Statement 2: Average age of A, B and C is 20 years now.
a) Statement 1 is sufficient to answer but statement 2 alone is not enough.
b) Statement 2 is sufficient to answer but statement 1 alone is not enough.
c) Statement 1 or statement 2 is alone sufficient to answer.
d) Both statement 1 and statement 2 are not sufficient to answer the question.
e) Both statement 1 and statement 2 are together sufficient to answer the question.
Ans: e
2.) What is the ratio between two numbers? Statement 1: The sum of two numbers is twice their difference. Statement 2: The smaller number is 6. Ans: a
Options are same for all these type of questions.
3.) The sum of ages P, Q and R is 96 years. What is the age of Q? Statement 1: P is 6 years older than R. Statement 2: The total of ages of Q, R is 56 years. Ans: e
4.) What is the cost price of the article? Statement 1: The profit earned is one-third of the cost price. Statement 2: The article is sold for Rs.400. Ans: e
5.) A and B are in a partnership business of one year. At the end of the year, a profit of RS.20, 000 was earned. What is A’s share? Statement 1: A invested Rs.50, 000. Statement 2: B withdrew his capital after 8 months. Ans: d
6.) A and B together can complete a task in 7 days. B alone can do it in 20 days. What part of the work was carried out by A? Statement 1: A completed the job after A and B worked together for 5 days. Statement 2: Part of the work done by A could have been done by B and C together in 6 days. Ans: a
7.) How much time did X take to reach destination? Statement 1: The ratio between the speeds of X and Y are 3:4. Statement 2: Y takes 36 minutes to reach the destination. Ans: e
other questions can be answered very easily.
CRITICAL REASONING:
This section is same as the earlier papers i.e. most of them are from Barrons, but all the names are changed. I got a passage which is not from Barrons but it is very easy. I will give the details of the passages which I and my friends got but it is good to do all the passages in Barrons 12th edition which are having 4 or more questions. Try to solve them if not simply mug them up, even the order of questions and the options does not change.
1. Large and small universities –model paper 1–section 5–question no (8-12).
2. Eight varsity baseball players– model paper 2 – section 1 – question no (1-4).
3. Byram and Adoniaram – model paper 2 – section 6 – question no (1-4).
4. A, B, C and W may cause D– model paper 4 – section 6 – question no (8-12).
5. Scurvy- model paper 5 – section 7 – question no (21-25).
I cleared the written exam and the interviews are on the following day.
INTERVIEWS:
There said that there is no elimination after each round and once if you get in, technical, management and human resource rounds will be completed one after the other, but some of us are eliminated after technical round. The interview’s started at around 10.30 am. There is a team of 21 members from TCS. There are 10 TR, 4 MR and two HR panels.
It is good to prepare for the basic questions which are often asked and answer them with confidence, because what they check is your confidence level but not the level of knowledge you have.
1. Tell me about yourself?
2. Why TCS?
3. What do you know about TCS?
4. Why software?
5. Why should I hire you?
6. Your strengths and weakness?
7. Why your percentage is low (IF)? (My percentage is less and I faced this question in every round so guys if yours is less be prepared with a convincing answer)
It is always a good practice to ask questions when the interviewer gives you a chance. Because this shows the enthusiasm you have for the company. But don’t ask any stupid questions.
TECHNICAL ROUND:
I was called for the TR at around 2 pm, there are 2 members in the panel both are from ECE and I am from electrical.
Int1: Tell me about yourself?
Me: Told.
Int: Why software?
Me: Told.
Int: Took my file and started asking questions on the subjects in my mark lists….
Int: What is micro processor? Draw NAND gate? What is an IC? Diff b/w an IC and DC? What is stator, rotor? Components in a generator? Explain the principle of operation? What are a coil and some basic principles from electrical….
Me: Told most of them and If you don’t know them say I cant recall them or if you want some time take time I asked for some time and took 2 minutes to recall a concept and explained them.
Int: Do you have a pc at home? And what is its configuration?
Me: Told.
Int: How do you verify it? What is REGEDIT? And some other questions on it?
Int: Write any program you know in C?
Me: I started writing ARMSTRONG numbers program.
Int: Are you coming into software field for high salaries?
Me: No sir. I completed the program. He gave me another program and I wrote it.
Int: What is process to do a project?
Me: Told.
Int: Are you interested in doing a project individually or in a team?
Me: In a team sir.
Int: Why? Can you explain?
Me: Explained.
Int:You can be placed anywhere in India. Will you go?
Me: Yes sir.
Int: Can you work in any time or you have any limitations?
Me: Yes sir, I can work in any time, I have no such limitations.
Int: Do you have any questions?
Me: Yes sir and I asked him.
Int: Answered the question.
Int: Ok you can leave.
Me: They wished me all the best.
They will check some basic knowledge in our core subjects and some programming skills and confidence levels. So be cool while answering the questions.
Some of us completed the technical round in morning itself and are waiting for management round up to 3 pm and then they announced a list of 10 members who are eliminated in the technical round. Then I was called for management round.
MANAGEMENT ROUND:
Me: G.afnun sir.
Int: G.afnun, take your seat. What should I call you, with full name or just vamsi?
Me: Anything sir.
Int: How would you describe you?
Me: Told.
Int: What are your weaknesses?
Me: Told.
Int: Is that all?
Me: Yes sir.
Int: Why software?
Me: Told.
Int: Then why didn’t join in computers
?
Me: Told.
Int: Are you willing to go Sri Lanka if you are given job?
Me: Yes sir.
Int: If your parents don’t allow you?
Me: I will convince them sir.
Int: How?
Me: Told.
Int: What if you got an offer with more salary after some time in TCS? Will you leave the job?
Me: No sir. I won’t. (Who won’t?? Even the interviewer leaves the job if he gets one!!)
Int: Some more questions like goals, further studies etc.
Me: Explained them.
Int: OK. All the best.
The round is to test the management skills
of a person. In most of them stress tests are done i.e. they will be asking some questions to know how you behave under stress situations, you must stick to one ans only. In my interview I was confused that I contradicted my own statement which I didn’t. They will try to confuse you but be cool and answer them with confidence.
HR ROUND:
There are two lady hr’s for us. They only check the confidence levels of the student.
Me: Tell me about your family?
Int: Told.
Me: Why TCS?
Int: Told.
Me: What are values of TCS?
Int: Told.
Int: What is vision of TCS?
Me: Don’t know mam.
Int: Why your percentage is low?
Me: Told.
Int: What did you learn in the four years of your study here?
Me: Told.
Int: Are willing to go any where?
Me: Yes mam.
Int: Any questions?
Me: Asked a question on higher educational opportunities provided by TCS.
Int: She explained it.
Int: You can leave. All the best.
My h.r is over by 5 pm and they announced the results at 6.30 pm in the seminar hall. They took a total of 35 members from 58 who cleared written exam. Finally my name is announced and I am in TCS!!!!!!!!!!!!!!!!!!!!!!!!!
I would like to thank all, who have helped me directly or indirectly. My sister who helped me answer many questions in TR, MR and HR. Many people who have written their experiences and my friends.

A banana plantation is located next to a desert. The plantation owner has 3000 bananas that he wants to transport to the market by camel, across a 1000 kilometer stretch of desert. The owner has only one camel, which carries a maximum of 1000 bananas at any moment in time, and eats one banana every kilometre it travels. What is the largest number of bananas that can be delivered at the market?

A banana plantation is located next to a desert. The plantation owner has 3000 bananas that he wants to transport to the market by camel, across a 1000 kilometer stretch of desert. The owner has only one camel, which carries a maximum of 1000 bananas at any moment in time, and eats one banana every kilometre it travels. What is the largest number of bananas that can be delivered at the market? 


Answer:
750 bananas !!!

First of all travel 500 km (3 times)
first take 1000 bananas and put in half way and return again take 1000 banana drop in half way return and again take 1000 banana and drop it half way, i.e., at 500 km distance.
so now you have 1500 banana left at half distance.

Now take 1000 bananas and travel 250 km, drop it there and return and take 500 remaining bananas and travel 250 km and drop it. so now you have 1000 bananas left and a distance of 250 km is remaining. so take 1000 bananas and go. So at last you left with 750 bananas.


It's always 1 to 6, it's always 15 to 20, it's always 5, but it's never 21, unless it's flying. What is this?

Answer:

The answer is: a dice. An explanation: "It's always 1 to 6": the numbers on the faces of the dice, "it's always 15 to 20": the sum of the exposed faces when the dice comes to rest after being thrown, "it's always 5": the number of exposed faces when the dice is at rest, "but it's never 21": the sum of the exposed faces is never 21 when the dice is at rest, "unless it's flying": the sum of all exposed faces when the dice is flying is 21 (1 + 2 + 3 + 4 + 5 + 6)

A traveler, on his way to Eindhoven, reaches a road junction, where he can turn left or right. He knows that only one of the two roads leads to Eindhoven, but unfortunately, he does not know which one. Fortunately, he sees two twin-brothers standing at the road junction, and he decides to ask them for directions. The traveler knows that one of the two brothers always tells the truth and the other one always lies. Unfortunately, he does not know which one always tells the truth and which one always lies. How can the traveler find out the way to Eindhoven by asking just one question to one of the two brothers? 

The question that the traveler should ask is: "Does the left road lead to Eindhoven according to your brother?" If the answer is "Yes", the traveler should turn right, and if the answer is "No", the traveler should turn left. Explanation: There are four possible cases: The traveler asks the question to the truth-telling brother, and the left road leads to Eindhoven. The truth-telling brother knows that his lying brother would say that the left road does not lead to Eindhoven, and so he answers "No". The traveler asks the question to the truth-telling brother, and the right road leads to Eindhoven. The truth-telling brother knows that his lying brother would say that the left road leads to Eindhoven, and so he answers "Yes". The traveler asks the question to the lying brother, and the left road leads to Eindhoven. The lying brother knows that his truth-telling brother would say that the left road leads to Eindhoven, and so he lies "No". The traveler asks the question to the lying brother, and the right road leads to Eindhoven. The lying brother knows that his truth-telling brother would say that the left road does not lead to Eindhoven, and so he lies "Yes"..

Barbara has boxes in three sizes: large, standard, and small. She puts 11 large boxes on a table. She leaves some of these boxes empty, and in all the other boxes she puts 8 standard boxes. She leaves some of these standard boxes empty, and in all the other standard boxes she puts 8 (empty) small boxes. Now, 102 of all the boxes on the table are empty. How many boxes has Barbara used in total?

It's a tough one.

Barbara uses 11 big boxed. that's for sure. Out of this, x big boxes are empty and 11-x boxes are filled - each with 8 medium boxes.

It comes to be that Barbara uses total of (11-x)*8 medium boxes. out of this y medium boxes are empty and (11-x)*8-y medium boxes contain small boxes - each contains 8 small boxes.

It comes to be that Barbara uses [(11-x)*8-y]*8 small boxes and it's GIVEN that all the small boxes are empty.

Now build the equation of the empty boxes:
x + y + [(11-x)*8-y]*8 = 102

Arranging the equation yields:
9x + y = 86

We know that x is between 1 and 10 (including) and y is between 1 and 79 (including) (it's given that there is at least one big and one medium empty boxes).

Now denote total amounts of big, medium and small boxes:

TB = 11
TM = (11-x)*8
TS = [(11-x)*8-y]*8

And try to put the numbers in the equation:

x=1 y=77 TS=24
x=2 y=68 TS=32
... ... ...

Finally calculate and add up the totals:

11 + 80 + 24 = 115
11 + 72 + 32 = 115
... ... ... = 115

As you can see, there might be various combinations of big, medium and small boxes that lead to the correct answer BUT there is only one correct answer.
 

Saturday 17 September 2011

30 simple Java questions

  1. How could Java classes direct program messages to the system console, but error messages, say to a file?
    The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:
    Stream st =
     new Stream (new
      FileOutputStream ("techinterviews_com.txt"));
    System.setErr(st);
    System.setOut(st); 
  2. What’s the difference between an interface and an abstract class?
    An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
  3. Why would you use a synchronized block vs. synchronized method?
    Synchronized blocks place locks for shorter periods than synchronized methods.
  4. Explain the usage of the keyword transient?
    This keyword indicates that the value of this member variable does not have to be serialized with the object. When the class will be de-serialized, this variable will be initialized with a default value of its data type (i.e. zero for integers).
  5. How can you force garbage collection?
    You can’t force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.
  6. How do you know if an explicit object casting is needed?
    If you assign a superclass object to a variable of a subclass’s data type, you need to do explicit casting. For example:
    Object a;Customer b; b = (Customer) a;
    When you assign a subclass to a variable having a supeclass type, the casting is performed automatically.
  7. What’s the difference between the methods sleep() and wait()
    The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.
  8. Can you write a Java class that could be used both as an applet as well as an application?
    Yes. Add a main() method to the applet.
  9. What’s the difference between constructors and other methods?
    Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.
  10. Can you call one constructor from another if a class has multiple constructors
    Yes. Use this() syntax.
  11. Explain the usage of Java packages.
    This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.
  12. If a class is located in a package, what do you need to change in the OS environment to be able to use it?
    You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Letâۉ„¢s say a class Employee belongs to a package com.xyz.hr; and is located in the file c:/dev/com.xyz.hr.Employee.java. In this case, you’d need to add c:/dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
    c:\>java com.xyz.hr.Employee
  13. What’s the difference between J2SDK 1.5 and J2SDK 5.0?
    There’s no difference, Sun Microsystems just re-branded this version.
  14. What would you use to compare two String variables - the operator == or the method equals()?
    I’d use the method equals() to compare the values of the Strings and the = = to check if two variables point at the same instance of a String object.
  15. Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written?
    A. Yes, it does. The FileNoFoundException is inherited from the IOException. Exception’s subclasses have to be caught first.
  16. Can an inner class declared inside of a method access local variables of this method?
    It’s possible if these variables are final.
  17. What can go wrong if you replace && with & in the following code:
    String a=null;
    if (a!=null && a.length()>10)
    {...}
    A single ampersand here would lead to a NullPointerException.
  18. What’s the main difference between a Vector and an ArrayList
    Java Vector class is internally synchronized and ArrayList is not.
  19. When should the method invokeLater()be used?
    This method is used to ensure that Swing components are updated through the event-dispatching thread.
  20. How can a subclass call a method or a constructor defined in a superclass?
    Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass’s constructor.
  21. What’s the difference between a queue and a stack?
    Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule.
  22. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?
    Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.
  23. What comes to mind when you hear about a young generation in Java?
    Garbage collection.
  24. What comes to mind when someone mentions a shallow copy in Java?
    Object cloning.
  25. If you’re overriding the method equals() of an object, which other method you might also consider?
    hashCode()
  26. You are planning to do an indexed search in a list of objects. Which of the two Java collections should you use: ArrayList or LinkedList?
    ArrayList
  27. How would you make a copy of an entire Java object with its state?
    Have this class implement Cloneable interface and call its method clone().
  28. How can you minimize the need of garbage collection and make the memory use more effective?
    Use object pooling and weak object references.
  29. There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java technique would you use to implement it?
    If these classes are threads I’d consider notify() or notifyAll(). For regular classes you can use the Observer interface.
  30. What access level do you need to specify in the class declaration to ensure that only classes from the same directory can access it?
    You do not need to specify any access level, and Java will use a default package access level.

C interview questions and answers

  1. What will print out? main()
    {
            char
    *p1=“name”;
            char
    *p2;
            p2=(char*)malloc(20);
            memset (p2, 0, 20);
            while(*p2++ = *p1++);
            printf
    (“%sn”,p2);
    }
    Answer:empty string.
  2. What will be printed as the result of the operation below:
    main()
    {
        int
    x=20,y=35;
        x=y++ + x++;
        y= ++y + ++x;
        printf
    (“%d%dn”,x,y); }
    Answer : 5794
  3. What will be printed as the result of the operation below:
    main()
    {
        int x=5;
        printf(“%d,%d,%dn”,x,x< <2,x>>2); }
    Answer: 5,20,1
  4. What will be printed as the result of the operation below:
    #define swap(a,b) a=a+b;b=a-b;a=a-b; void main()
    {
        int x=5, y=10;
        swap (x,y);
        printf(“%d %dn”,x,y);
        swap2(x,y);
        printf(“%d %dn”,x,y);
    }
    int swap2(int a, int b)
    {
        int temp;
        temp=a;
        b=a;
        a=temp;
        return 0;
    }
    Answer: 10, 5
    10, 5
  5. What will be printed as the result of the operation below:
    main()
    {
        char *ptr = ” Cisco Systems”;
        *ptr++; printf(“%sn”,ptr);
        ptr++;
        printf(“%sn”,ptr); }
    Answer:Cisco Systems
    isco systems
  6. What will be printed as the result of the operation below:
    main()
    {
        char s1[]=“Cisco”;
        char s2[]= “systems”;
        printf(“%s”,s1);
    }
    Answer: Cisco
  7. What will be printed as the result of the operation below:
    main()
    {
        char *p1;
        char *p2;     p1=(char *)malloc(25);
        p2=(char *)malloc(25);
        strcpy(p1,”Cisco”);
        strcpy(p2,“systems”);
        strcat(p1,p2);
        printf(“%s”,p1);
    }
    Answer: Ciscosystems
  8. The following variable is available in file1.c, who can access it?:
    static int average;
    
    Answer: all the functions in the file1.c can access the variable.
  9. WHat will be the result of the following code?
    #define TRUE 0 // some code while(TRUE)
    {
        // some code
    }
    Answer: This will not go into the loop as TRUE is defined as 0.
  10. What will be printed as the result of the operation below:
    int x;
    int modifyvalue()
    {
        return(x+=10);
    } int changevalue(int x)
    {
        return(x+=1);
    }
    void main()
    {
        int x=10;
        x++;
        changevalue(x);
        x++;
        modifyvalue();
        printf("First output:%dn",x);
        x++;
        changevalue(x);
        printf("Second output:%dn",x);
        modifyvalue();
        printf("Third output:%dn",x);
    }
    Answer: 12 , 13 , 13
  11. What will be printed as the result of the operation below:
    main()
    {
        int x=10, y=15;
        x = x++;
        y = ++y;
        printf(“%d %dn”,x,y); }
    Answer: 11, 16
  12. What will be printed as the result of the operation below:
    main()
    {
        int a=0;
        if(a==0)
            printf(“Cisco Systemsn”);
            printf(“Cisco Systemsn”); }
    Answer: Two lines with “Cisco Systems” will be printed.

Thursday 8 September 2011

Solved Aptitude Questions

1. A man starts his walking at 3PM from point A, he walks at the rate of 4km/hr in plains and 3km/hr in hills to reach the point B. During his return journey he walks at the rate of 6km/hr in hills and 4km/hr in plains and reaches the point A at 9PM.What is the distance between A and B?
Ans: 12km
Solution:
T1+T2=6
T1-time for forward journey,
T2-time for return journey
D1+D2=forward /return distance
D1-distance in plains
D2-distance in hills
D1/4 +D2/3=T1 (forward time)
D1/4 +D2/6=T2 (return time)
Adding we will get D1+D2=12 km
2. A boy asks his father, " what is the age of grand father?". Father replied " He is x years old in x^2 years", and also said, "we are talking about 20th century". what is the year of birth of grand father?
Ans: 1892
3. A boy travels in a scooter after covering 2/3rd of the distance the wheel got punctured he covered the remaining distance by walk. Walking time is twice that of the time the boy’s riding time. How many times the riding speed as that of the walking speed?
Ans: 4 times.
4. In a Knockout tournament 51 teams are participated, every team thrown out of the tournament if they lost twice. How many matches to be held to choose the winner?
Ans: 101 matches
5. A man sold 2 pens. Initial cost of each pen was Rs. 12. If he sell it together one at 25% profit and another 20% loss. Find the amount of loss or gain, if he sells them separately.
Ans: 60 Paise gain
6. Find the 3 digit no. whose last digit is the square root of the first digit and second digit is the sum of the other two digits.
Ans: 462
7. Meera was playing with her brother using 55 blocks. She gets bored playing and starts arranging the blocks such that the no. of blocks in each row is one less than that in the lower row. Find how many were there in the bottom most row?
Ans: 10
8. Two people are playing with a pair of dies. Instead of numbers, the dies have different colors on their sides. The first person wins if the same color appears  on both the dies and the second person wins if the colors are different. The odds of their winning are equal. If the first dice has 5 red sides and 1 blue side, find the color(s) on the second one.
Ans: 3 Red, 3 Blue
9. A person travels in a car with uniform speed. He observes the milestone, which has 2 digits. After one hour he observes another milestone with  same digits reversed. After another hour he observes another milestone  with same 2 digits separated by 0. Find the speed of the car?
Ans : 45
10. Three persons A, B &C went for a robbery in different directions and they theft one horse, one mule and one camel. They were caught by  the police and when interrogated gave the following statements
A: B has stolen the horse
B: I didn't rob anything.
C: both A & B are false and B has stolen the mule.
The person who has stolen the horse always tell the truth and
The person who has stolen the camel always tell the lie.
Find who has stolen which animal?
Ans:   
A- camel
B- mule
C- horse
11. One quarter of the time till now from midnight and half of the time remaining from now up to midnight adds to the present time.  What is the present time?
Ans: 9:36AM
12. After world war II three departments did as follows First department gave some tanks to 2nd &3rd departments equal to  the number they are having.  Then 2nd department gave some tanks to 1st  & 3rd departments equal to  the number they are having. Then 3rd department gave some tanks to 2nd &1st departments equal to the number they are having.  Then each department has 24 tanks.  Find the initial number of tanks of each department?
Ans :  
A-39
B-21
C-12
13. A, B, C, D&E are having their birthdays on consecutive days of the week  not necessarily in the same order. A 's birthday comes before G's as many days as B's birthday comes after E's.  D is older than E by 2 days.  This time G's birthday came on  Wednesday. Then find the day of each of their birthdays?
Ans:
Birthday of D on SUNDAY
Birthday of B on MONDAY
Birthday of E on TUESDAY
Birthday of G on WEDNESDAY
Birthday of A on THURSDAY
14. A girl 'A' told to her friend about the size and color of a snake she has seen in the beach. It is one of the colors brown/black/green and one of the sizes 35/45/55.
If it were not green or if it were not of length 35 it is 55.
If it were not black or if it were not of length 45 it is 55.
If it were not black or if it were not of length 35 it is 55.
a) What is the color of the snake?
b) What is the length of the snake?
Ans: 
a) brown
b) 55
15. There are 2 persons each having same amount of marbles in the beginning. after  that 1 person gain 20 more from second person n he eventually lose two third of it during the play n the second person now have 4 times marble of what 1st person is having now. find out how much marble did each had in the beginning.
Ans - 100 each
16. A lady was out for shopping. she spent half of her money in buying A  and gave 1 dollar to bagger. father she spent half of her remaining money and gave 2 dollar to charity. further she spent  half of remaining money n gave 3 dollar to some children. now she has left with 1 dollar. how much she had in the beginning?
Ans: $42
17. There are certain diamonds in a shop.
1 thief stole half of diamonds and 2 more.
2 thief stole half of remaining and 2 more
3. same as above
4 same as above.
5 came nothing was left for that.
how many diamonds was there???
Ans: 60 diamonds
18. There are three friends A B C.
1. Either A or B is oldest
2. Either C is oldest or A is youngest.
Who is Youngest and who is Oldest?
Ans: A is youngest n B is oldest.
19. Father says my son is five times older than my daughter. my wife is 5 times older that  my son. I am twice old from my wife and altogether (sum of our ages) is equal to my mother 's age and she is celebrating her 81 birthday. so what is my son's age?
Ans: 5 years.
20. Fodder, Wheat and Rice often eat dinner out.

a)      each orders either coffee or tea after dinner.
b)      if fodder orders coffee, then Wheat orders the drink that Rice orders
c)      if Wheat orders coffee, then fodder orders the drink that Rice does not order
d)      if Rice orders tea, then fodder orders the drink that Wheat orders

which person/persons always  orders the same drink after dinner ?

Ans: Fodder
21. We are given 100 pieces of a puzzle. If fixing two components together is counted as 1 move ( a component can be one piece or an already fixed set of pieces), how many moves do we need to fix the entire puzzle.
Ans: 99
22. Two guys work at some speed...After some time one guy realizes he has done only half of the other guy completed which is equal to half of what is left !
So how much faster than the other is this guy supposed to do to finish with the first...
Ans: one and half times or 3/2
23. There is a square cabbage patch. He told his sister that i have a larger patch than last year and hence 211 more cabbages this year. Then how many cabbages I have this year.?
Ans:106*106=11236
24. There are three guesses on  the color of a mule
1 says: its not black
2 says: its brown or grey
3 says: its brown
At least one of them is wrong and one of them is true.....Then what’s the color of mule?
Ans: Grey
25. There are two containers on a table. A and B . A is half full of  wine, while B, which is twice A's size, is one quarter full of wine . Both containers are filled with water and the contents are poured into a  third container C. What portion of container C's mixture is wine ?
Ans:33.33%
26. A man was on his way to a marriage in a car with a constant speed. After 2 hours one of the tier is punctured and it took 10 minutes to replace it. After that they traveled with a speed of 30 miles/hr and reached the marriage 30 minutes late to the scheduled time. The driver told that they would be late by 15 minutes only if the 10 minutes was not waste. Find the distance between the two towns?
Ans: 120 miles
27. Farmer Jones sold a pair of cows for Rs. 210 , On one he made a profit of ten percent and on the other he lost ten percent. Although he made a profit of five percent. How many did each cow originally cost him?
Ans:150,50
28. I spent one-sixth of my age as a boy and one-12th in youth, remarked the boss "spent one-seventh and five years in matrimony". My son born just after that period was elected as a governor 4 years back when he was half of my present age. What is the age of the boss?
Ans: 84
29. A girl had several dollars with her. she went out for shopping and spent half of them  in shopping mall, being generous she had given 1 dollar to the beggar. After that she went for lunch and spent the half of the remaining and gave 2 dollars as tip to the waiter. Then she went to watch a movie and spent the half of remaining dollars and gave autorikshaw-wala 3 dollars. This left her with only 1 dollar. How many dollars did she had with her at the beginning.
Ans:$42.
30. A bargain hunter bought some plates for  $ 1.30 from a sale on Saturday, where price 2cents was marked off at each article .On Monday she went to return them at regular prices, and bought  some cups and saucers from that much amount of money only. The normal price of plate were equal to the price of 'one cup and one saucer'. In total she bought 16 items more than previous. saucers were only of 3 cents hence she brought 10 saucers  more than the cups, How many cups and saucers she bought  and at what price?
Ans: 8,18  Price: 12,3.
31. Mr. T has a wrong weighing pan. One arm is lengthier than other.1 kilogram on left balances 8 melons on right.1 kilogram on right balances 2 melons on left. If all melons are equal in weight, what is the weight of a single melon?
Ans:200 gms
32. A card board of 34 * 14 has to be attached to a wooden box and a total of 35 pins are to be used on the each side of the cardbox. Find the total number of pins used .
Ans: 210
33. Last Year my cousin came to my place and we played a game where the loosing one has to give one chocolate to the person who won the game .At the end of the vacation, i.e. the day my cousin was leaving she counted number of games that i won an she won. At last she gave me a total of 8 chocolates even though she won about 12 games. Find the number of games that we played.
Ans: 20
34. Here is a five digit number. The fifth digit is one fourth of the third digit and  one half of the fourth digit. Third digit is one half of the first digit. second digit is 5 more than the fifth digit.
What is that 5 digit no.?
Ans: 86421
35. A boy goes to school from his house. On one fourth of his way to school, he crosses a
 machinery station. And on one third of his way to school, he crosses a Railway station.
 He crossed the machinery station at 7:30 and he crosses the Railway station at 7:35.
 when does he leave the house & when does he reach the school ? (5M)
Ans: 7:15 - 8:15
36. Four persons A,B,C,D were there. All were of different weights. All Four gave a
 statement. Among the four statements only the person who is lightest in weight of all
 others gave a true statement.
 A Says : B is heavier than D.
 B Says : A is heavier than C.
 C Says : I am heavier than D.
 D Says : C is heavier than B.
Ans: ACDB.
37. A man was traveling to a place 30 miles away from starting point. he was speeding at 60 miles/hr. but when he came back, his car got breakdown and half an hour was wasted in repairing that. altogether he took 1 hr for return journey. Find the avg. speed of the whole journey.
Ans:60 miles/hour.

Search here for "Freshers Jobs"