IBM Written test Questions with answers SECTION#1 1. If a car starts from A towards B with some velocity. Due to some problem in the engine after traveling 30km, the car goes with 4/5 th of its actual velocity .The car reaches B 45 min later to the actual time. If the car engine fails after traveling 45km, the car reaches the destination B 36min late to the actual time What is the initial velocity of car and what is the distance between A and B in km Ans. 20 & 130. 2. A person has Rs 100/- in his pocket, he can as 25 pencils or 15 books. He kept 15% of the money for traveling expenses and purchased 5 pencils. So how many books he can purchase with the remaining money. 3. The values of shares (in Rs).of A, B and C from January to June are as follows. Month A B C January 30 60 80 February 35 65 85 March 45 75 65 April 40 75 82 May 55 75 85 June 50 75 80 i) During this period which share has undergone maximium fluctuation? ii) In which month it is possible to buy B and C selling A? iii) In which month the share values are very low? iv) By purchasing one share of A and 4 each of B and C in the beginning of the period, when should these be sold to get maximum profit? 4. In a two-digit, if it is known that its unit's digit exceeds its ten's digit by 2 and that the product of the given number and the sum of its digits is equal to 144, then the number is: Ans: 24 5. The value of [ (0.96)3 - (0.1)3 ] / [(0.96)2 + 0.096 + (0.1) 2] ans: 0.86 6. The ratio of the number of boys and girls in a college is 7 : 8. If the percentage increase in the number of boys and girls be 20% and 10% respectively, what will be the new ratio? Ans: 21:22 7. find the next no in the series 15, 31, 63, 127, 255, (....) Ans: 511 8. A car owner buys petrol at Rs.7.50, Rs. 8 and Rs. 8.50 per liter for three successive years. What approximately is the average cost per litre of petrol if he spends Rs. 4000 each year? Ans: 7.89 9. In Arun's opinion, his weight is greater than 65 kg but less than 72 kg. His brother doest not agree with Arun and he thinks that Arun's weight is greater than 60 kg but less than 70 kg. His mother's view is that his weight cannot be greater than 68 kg. If all are them are correct in their estimation, what is the average of different probable weights of Arun? Ans:67kg 10. Two numbers A and B are such that the sum of 5% of A and 4% of B is two-third of the sum of 6% of A and 8% of B. Find the ratio of A : B. Ans:4:3 11. The L.C.M. of two numbers is 48. The numbers are in the ratio 2 : 3. Then sum of the number is: Ans:40 12. Let N be the greatest number that will divide 1305, 4665 and 6905, leaving the same remainder in each case. Then sum of the digits in N is: Ans:4 13. Find the odd one 11, 48, 100, 384, 768, 3072 Ans:100 14. If a quarter kg of potato costs 60 paise, how many paise will 200 gm cost? Ans:48 paise 15. 3 pumps, working 8 hours a day, can empty a tank in 2 days. How many hours a day must 4 pumps work to empty the tank in 1 day? Ans: 12 16. 50 men took a dip in a water tank 40 m long and 20 m broad on a religious day. If the average displacement of water by a man is 4 m3, then the rise in the water level in the tank will be: Ans:25 17. m and n are whole numbers such that mn = 121, the value of (m - 1)n + 1 is: Ans:1000 18.a=2, b=3, c=6 Find the value of c/(a+b)-(a+b)/c Ans. 11/30 19. What does the hexa number E78 in radix (a) 12455 (b) 14153 (c) 14256 (d) 13541 (e) 131112 Ans. (d) 20. Q is not equal to zero and k = (Q x n - s)/2 What is n? (a) (2 x k + s)/Q (b) (2 x s x k)/Q (c) (2 x k - s)/Q (d) (2 x k + s x Q)/Q (e) (k + s)/Q Questions 21 - 25 are to be answered on the following data A causes B or C, but not both F occurs only if B occurs D occurs if B or C occurs E occurs only if C occurs J occurs only if E or F occurs D causes G,H or both H occurs if E occurs G occurs if F occurs 21. If A occurs which of the following must occurs? I. F and G II. E and H III.D (a) I only (b) II only (c) III only (d) I,II, & III (e) I & II (or) II & III but not both Ans. (e) 22. If B occurs which must occur? (a) D (b) D and G (c) G and H (d) F and G (e) J Ans. (a) 23.If J occurs which must have occurred (a) E (b) either B or C (c) both E & F (d) B (e) both B & C Ans. (b) 24. Which may occurs as a result of cause not mentioned I.D II. A III. F (a) I only (b) II only (c) I & II (d) II & III (e) I,II & III Ans. (c) 25. E occurs which one cannot occurs (a) A (b) F (c) D (d) C (e) J Ans. (b) 26.A 5 litre jug contains 4 litres of a salt water solution that is 15 percent salt. If 1.5 litres of the solution spills out of the jug, and the jug is then filled to capacity with water,approximately what percent of the resulting solution in the jug is salt? (A)7.5% (B)9.5% (C) 10.5% (D)12% (E)15% 27. Working independently, Tina can do a certain job in 12 hours. Working independently, Ann can do the same job in 9 hours. If Tina Works independently at the job for 8 hours and then Ann. 28.Directions to solve Read the paragraph carefully and answer the qustions: Six knights - P, Q,R,S,T and U - assemble for a long journey in Two ravelling parties. For security, each travelling party Consists of at least two knights. The two parties travel by separate routes, northern and southern. After one month, the routes of the northern and southern groups converge for a brief time and at that point the knights can, if they wish, rearrange their travelling parties before continuing, again in two parties along separate northern and southern routes. Throughout the entire trip, the composition of traveling parties must be in accord with the following conditions P and R are deadly enemies and, although they may meet briefly,can never travel together. p must travel in the same party with sQ can’t travel by the southern route U can’t change a. If one of the two parties of knights consists of P and U and two other knights and travels by the southern route,the other members of this party besides P and U must be a) Q and S b) Q and T c) R and S d) R and T e) S and T Ans: e b.If each of the two parties of knights consists of exactly three members, which of the following is not a possible travelling party and route? a) P,S,U by the northern route b) P,S,T by the northern route c) P,S,T by the southern route d) P,S,U by the southern route e) Q,R,T by the southern route Ans: b c. If one of the two parties of knights consists of U and two other knights and travels by the northern route, the other memnbers of this party besides U must be a) P and S b) P and T c) Q and R d) Q and T e) R and T Ans: c d. If each of the two parties of knights consists of exactly three members of different parties, and R travels by the northern route,then T must travel by the a) southern route with P and S b) southern route with Q and R c) southern route with R and U d) northern route with Q and R e) northern route with R and U Ans: a e. If, when the two parties of knights encounter one another after a month, exactly one knight changes from one travelling party to the other travelling party, that knight must be a) P b) Q c) R d) S e) T Ans: e Questions 29 - 32: A, B, C, D, E and F are six positive integers such that B + C + D + E = 4A C + F = 3A C + D + E = 2F F = 2D E + F = 2C + 1 If A is a prime number between 12 and 20, then 29. The value of F is (A) 14 (B) 16 (C) 20 (D) 24 (E) 28 30. Which of the following must be true? (A) D is the lowest integer and D = 14 (B) C is the greatest integer and C = 23 (C) B is the lowest integer and B = 12 (D) F is the greatest integer and F = 24 (E) A is the lowest integer and A = 13 1.What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array? The program may crash if some important data gets overwritten. 2. what is the output: void main(){ int a[4]={2,3); printf(“%d”,a[3]); } ANS: 0 3. #include <stdio.h> void main() { int a[2][3] = {1, 2, 3, 4, 5}; int i = 0, j = 0; for (i = 0; i < 2; i++) for (j = 0; j < 3; j++) printf("%d", a[i][j]); } a) 1 2 3 4 5 0 4. What is the output of this C code? #include <stdio.h> void main() { int a[2][3] = {1, 2, 3, , 4, 5}; int i = 0, j = 0; for (i = 0; i < 2; i++) for (j = 0; j < 3; j++) printf("%d", a[i][j]); } d) error 5. #include<stdio.h> int main() { int size, i; scanf("%d", &size); int arr[size]; for(i=1; i<=size; i++) { scanf("%d", arr[i]); printf("%d", arr[i]); } return 0; } The code is erroneous since the statement declaring array is invalid. * constant exp required 6.What would be the output of the following program? main() { char str1[] = "Hello"; char str2[] = "Hello"; if(str1 == str2) printf("\n Equal"); else printf("\nUnequal"); } B. Unequal (compare the address) 7 What would be the output of the following program? main() { printf("%c","abcdefgh"[4]); } no -o/p 1. WAP to calculate sum of even and odd digits separately. Ex: 2345 Sum of even digits=2+4=6 Sum of odd digits=3+5=8 #include<stdio.h> #include<conio.h> void main() { int n,d,evn=0,odd=0; printf("enter a number"); scanf("%d",&n); while(n>0) { d=n%10; if(d%2==0) { evn=evn+d; } else { odd=odd+d; } n=n/10; } printf("sum of even digits=%d\n",evn); printf("sum of odd digits=%d\n",odd); getch(); } 2. WAP to count only even digits in a number. Ex: 234 = 2 #include<stdio.h> #include<conio.h> void main() { int n,d,evn=0; printf("enter a number"); scanf("%d",&n); while(n>0) { d=n%10; if(d%2==0) { evn++; } n=n/10; } printf("Even digits are=%d",evn); getch(); } 3. WAP to calculate sum of only first and last digit of a number. Ex: 3456 = 3+6=9 #include<stdio.h> #include<conio.h> void main() { int n,d,fs,ls,s=0; clrscr(); printf("enter a number"); scanf("%d",&n); ls=n%10; while(n>0) { fs=n%10; n=n/10; } s=fs+ls; printf("Sum of First and Last Digit=%d",s ); getch(); } 4. WAP to find largest and smallest number from given array elements. #include<stdio.h> #include<conio.h> void main() { int ar[5],i,large,small; clrscr(); for(i=0;i<5;i++) { scanf("%d",&ar[i]); } large=ar[0]; small=ar[0]; for(i=0;i<5;i++) { if(large<ar[i]) { large=ar[i]; } else { small=ar[0]; } } printf("Largest value=%d\n",large); printf("Smallest value=%d",small); getch(); } 5. WAP to sort an array in ascending order using bubble sort technique. #include<stdio.h> #include<conio.h> void main() { int ar[5],i,j,temp; clrscr(); printf("Enter Array Elements"); for(i=0;i<5;i++) { scanf("%d",&ar[i]); } printf("Un-Sorted Array:\n"); for(i=0;i<5;i++) { printf("%d\t",ar[i]); } for(i=0;i<4;i++) { for(j=0;j<4;j++) { if(ar[j]>ar[j+1]) { temp=ar[j]; ar[j]=ar[j+1]; ar[j+1]=temp; } } } printf("\nSorted Array:\n"); for(i=0;i<5;i++) { printf("%d\t",ar[i]); } getch(); } 6. WAP to input a number and find it in the given array elements. #include<stdio.h> #include<conio.h> void main() { int ar[5],i,n,idx,fg=0; clrscr(); printf("Enter Array Elements"); for(i=0;i<5;i++) { scanf("%d",&ar[i]); } printf("enter number to search"); scanf("%d",&n); for(i=0;i<4;i++) { if(ar[i]==n) { fg=1; idx=i; } } if(fg==1) { printf("No. is present at index %d\n",idx); } else { printf("No. is not present"); } getch(); } IBM Interview Questions 1.What is the difference between C and Java? 1.JAVA is Object-Oriented while C is procedural. 2.Java is an Interpreted language while C is a compiled language. 3.C is a low-level language while JAVA is a high-level language. 4.C uses the top-down approach while JAVA uses the bottom-up approach. 5.Pointer go backstage in JAVA while C requires explicit handling of point 2.What is the difference between array and pointer? Pointer is a variable in a program is something with a name, the value of which can vary. The way the compiler and linker handles this is that it assigns a specific block of memory within the computer to hold the value of that variable. An array is a conceptual data representation consisting of a list of more than one item of a particular scalar type (int, float, char, structure, etc.) where each element is accessed by its index.3.What is the difference between Strings and Arrays? - String can hold only char data. Where as an array can hold any data type. - An array size can not be changed. Where as a string size can be changed if it is a char pointer - The last element of an array is an element of the specific type. The last character of a string is a null – ‘\0’ character. - The length of an array is to specified in [] at the time of declaration (except char[]). The length of the string is the number of characters + one (null character). 3.What is Recursion Function? a) A recursive function is a function which calls itself. b) The speed of a recursive program is slower because of stack overheads. (This attribute is evident if you run above C program.) c) A recursive function must have recursive conditions, terminating conditions, and recursive expressions. 5.Diffrence between default and copy constructor? 4.What are abstract class? An abstract class is a class which does not fully represent an object. Instead, it represents a broad range of different classes of objects. However, this representation extends only to the features that those classes of objects have in common. Thus, an abstract class provides only a partial description of its objects 5.Define Deadlock? In an operating system, a deadlock is a situation which occurs when a process enters a waiting state because a resource requested by it is being held by another waiting process, which in turn is waiting for another resource. If a process is unable to change its state indefinitely because the resources requested by it are being used by other waiting process, then the system is said to be in a deadlock. 6.What is linked list? Linked list is one of the fundamental data structures, and can be used to implement other data structures. In a linked list there are different numbers of nodes. Each node is consists of two fields. The first field holds the value or data and the second field holds the reference to the next node or null if the linked list is empty. 7.What is the difference bet do loop & do while loop? The difference between a "do ...while" loop and a "while {} " loop is that the while loop tests its condition before execution of the contents of the loop begins; the "do" loop tests its condition after it's been executed at least once. As noted above, if the test condition is false as the while loop is entered the block of code is never executed. Since the condition is tested at the bottom of a do loop, its block of code is always executed at least once.10.What is polymorphism & inheritance property? Polymorphism is the ability to use an operator or function in different ways. Polymorphism gives different meanings or functions to the operators or functions. Poly, referring to many, signifies the many uses of these operators and functions. A single function usage or an operator functioning in many ways can be called polymorphism. Polymorphism refers to codes, operations or objects that behave differently in different contexts. 8.What is OOPS concept? Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance. Many modern programming languages now support OOP, at least as an option. 9.What are dynamic and static memory location? The allocation of memory for the specific fixed purposes of a program in a predetermined fashion controlled by the compiler is said to be static memory allocation. The allocation of memory (and possibly its later deallocation) during the running of a program and under the control of the program is said to be dynamic memory allocation. 10.Write a program in C to sort a list of numbers in ascending order? 11.Write a program in java to print the odd no. between 1 to 100? 12.What is the differentiate b/w analog and digital communication? 13.What is the difference between Truncate and Delete? 14.What is the difference between DBMS and RDBMS? 15.What are the advantages of SQL? These are the advantages of PL/SQL. Block Structures: PL SQL consists of blocks of code, which can be nested within each other. Each block forms a unit of a task or a logical module. PL/SQL Blocks can be stored in the database and reused. Procedural Language Capability: PL SQL consists of procedural language constructs such as conditional statements (if else statements) and loops like (FOR loops). Better Performance: PL SQL engine processes multiple SQL statements simultaneously as a single block, thereby reducing network traffic. Error Handling: PL/SQL handles errors or exceptions effectively during the execution of a PL/SQL program. Once an exception is caught, specific actions can be taken depending upon the type of the exception or it can be displayed to the user with a message. Hide data complexity 16.What is the difference between Dbms and OODbms? 17.Difference between SQL and PL /SQL? 18.Difference between DBMS and File System 19.What is the basic difference between a Join and a Union? Union: It combines the results of two or more queries into a single result set consisting of all the rows belonging to all queries in the union. Basic Rules: The number and the order of the columns must be the same in all queries. The data types must be compatible. Join: To retrieve data from two tables or more than two tables then use joins. Types: Inner Join, Outer Join(Right outer join, left outer join), cross join, Equi join, Self join. The number and the order of the columns need not be the same in all queries. 20.what is a root? "root" refers to the top-level directory of a file system. The word is derived from a tree root, since it represents the starting point of a hierarchical tree structure. The folders within the tree represent the branches, while the actual files are considered the leaves. However, unlike a real life tree, a data tree can be visualized upside down, with the root at the top and directories and subdirectories spanning downward. The root node of a file system is also called the root directory. On a Windows-based PC, "C:\" represents the root directory of the C drive. If you ever use a terminal program to view files and folders on a computer, you can use the command "cd /" (change directory to root) to navigate to the root directory. "Root" is also the name of the user who has administrative privleges on a Unix or Linux server. IBM Technical Interview Questions: Can you tell advantages of RDBMS over simple custom DBMS? Which is the layer of an Operating System that takes care of the system resource usage at the lowest level? Can you tell any two advantages of stored procedures? What is Recursion Function? Define Deadlock. What is linked list? What the difference between do loop & do while loop? IBM HR Interview Questions: What has been your greatest failure, and what did you learn from it? What salary are you looking for? Where do you see yourself five years down the line?