Company : Huawei

Website : http://www.huawei.com

Website : http://www.huawei.com

1. B2CD, _____, BCD4, B5CD, BC6D

A.B2C2D B.BC3D C.B2C3D D.BCD7

Answer: B

Explanation:

Because the letters are the same, concentrate on the number series, which is a simple 2, 3, 4, 5, 6 series, and follows each letter in order.

2. DEF, DEF2, DE2F2, _____, D2E2F3

A.DEF3 B.D3EF3 C.D2E3F D.D2E2F2

Answer: D

Explanation:

In this series, the letters remain the same: DEF. The subscript numbers follow this series: 111, 112, 122, 222, 223, 233, 333, ...

3. 10 women can complete a work in 7 days and 10 children take 14 days to complete the work. How many days will 5 women and 10 children take to complete the work?

A.3 B.5 C.7 D.Cannot be determined

Answer: C

Explanation:

1 woman's 1 day's work=1/70 1 child's 1 day's work =1/140 (5 women + 10 children)'s day's work =5/70 +10/140=1/14 +1/14=1/7 5 women and 10 children will complete the work in 7 days.

4. 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

Answer: B

Explanation:

C's 1 day's work = 1/3 - [1/6 + 1/8]= 1/3 - 7/24= 1/24 A's wages : B's wages : C's wages = 1/6: 1/8: 1/24= 4 : 3 : 1. C's share (for 3 days) = Rs.[3 x 1/24 x 3200] = Rs. 400.

5. The product of two numbers is 9375 and the quotient, when the larger one is divided by the smaller, is 15. The sum of the numbers is:

A.380 B.395 C.400 D.425

Answer: C

Explanation:

Let the numbers be x and y. Then, xy = 9375 and x/y=15 Xy/(x/y)=9375/15 y2 = 625. y = 25. x = 15y = (15 x 25) = 375. Sum of the numbers = x + y = 375 + 25 = 400.

6. The length of a rectangle is halved, while its breadth is tripled. What is the percentage change in area?

A.25% increase B.50% increase C.50% decrease D.75% decrease

Answer: B

Explanation:

Let original length = x and original breadth = y. Original area = xy. New length =x/2 New breadth = 3y. New area=[(x/2)*3y]=(3/2)xy Increase % =[(1/2)xy*(1/xy)*100]%=50%

7. The difference between the length and breadth of a rectangle is 23 m. If its perimeter is 206 m, then its area is:

A.1520 m2 B.2420 m2 C.2480 m2 D.2520 m2

Answer: D

Explanation:

We have: (l - b) = 23 and 2(l + b) = 206 or (l + b) = 103. Solving the two equations, we get: l = 63 and b = 40. Area = (l x b) = (63 x 40) m2 = 2520 m2.

8. In a certain school, 20% of students are below 8 years of age. The number of students above 8 years of age is 2/3 of the number of students of 8 years age which is 48. What is the total number of students in the school?

A.72 B.80 C.120 D.100

Answer: D

9. Point out the error in the program?

#include int main()

{

struct emp

{

char name[20];

float sal;

};

struct emp e[10];

int i;

for(i=0; i<=9; i++)

scanf("%s %f", e[i].name, &e[i].sal);

return 0;

}

A.Error: invalid structure member B.Error: Floating point formats not linked C.No error D.None of above

Answer: B

Explanation:

At run time it will show an error then program will be terminated. Sample output: Turbo C (Windwos) Sample 12.123 scanf : floating point formats not linked Abnormal program termination

10. Point out the error in the program?

#include int main()

{

struct emp

{

char name[20];

float sal;

};

struct emp e[10];

int i;

for(i=0; i<=9; i++)

scanf("%s %f", e[i].name, &e[i].sal);

return 0;

}

A.Error: invalid structure member B.Error: Floating point formats not linked C.No error D.None of above

Answer: B

Explanation:

At run time it will show an error then program will be terminated. Sample output: Turbo C (Windwos) c:\>myprogram Sample 12.123 scanf : floating point formats not linked Abnormal program termination

11. The fourth proportional to 5, 8, 15 is:

A.18 B.24 C.19 D.20

Answer: B

Explanation:

Let the fourth proportional to 5, 8, 15 be x. Then, 5 : 8 : 15 : x 5x = (8 x 15) x=(8*15)/5=24

12. If 40% of a number is equal to two-third of another number, what is the ratio of first number to the second number?

A.2 : 5 B.3 : 7 C.5 : 3 D.7 : 3

Answer: C

Explanation:

Let 40% of A=2/3 B Then,40 A/100=2B/3 => 2A/5=2B/3 => A/B-[2/3 - 5/2]=5/3p A : B = 5 : 3.

13. The salaries A, B, C are in the ratio 2 : 3 : 5. If the increments of 15%, 10% and 20% are allowed respectively in their salaries, then what will be new ratio of their salaries?

A.3 : 3 : 10 B.10 : 11 : 20 C.23:33:60 D.32 :43:53

Answer: C

Explanation:

Let A = 2k, B = 3k and C = 5k. A's new salary = 115/ 100 of 2k =[115/ 100 x 2k]= 23k/ 10 B's new salary = 110/ 100 of 3k = [110/ 100x 3k] = 33k/ 10 C's new salary = 120/ 100 of 5k = [120/ 100 x 5k] = 6k New ratio = 23k : 33k : 6k = 23 : 33 : 60

14. A bag contains 6 black and 8 white balls. One ball is drawn at random. What is the probability that the ball drawn is white?

A.3/4 B.4/7 C.1/8 D.3/7

Answer: B

Explanation:

Let number of balls = (6 + 8) = 14. Number of white balls = 8. P (drawing a white ball)=8/14=4/7

15. One card is drawn at random from a pack of 52 cards. What is the probability that the card drawn is a face card?

A.1/13 B.3/13 C.1/4 D.9/5

Answer: B

Explanation:

Clearly, there are 52 cards, out of which there are 12 face cards. P (getting a face card)=12/52=3/13

16. Two cards are drawn together from a pack of 52 cards. The probability that one is a spade and one is a heart, is:

A.3 /20 B.29/ 34 C.47/ 100 D.13 /102

Answer: D

Explanation:

Let S be the sample space. Then, n(S) = 52C2 = 52 * 51/ (2*1)= 1326. Let E = event of getting 1 spade and 1 heart. n(E) = number of ways of choosing 1 spade out of 13 and 1 heart out of 13 = (13C1 x 13C1) = (13 x 13) = 169. P(E) =n (E)/n(S) = 169/ 1326= 13/102

17. A bag contains 4 white, 5 red and 6 blue balls. Three balls are drawn at random from the bag. The probability that all of them are red, is:

A.1/ 22 B.3/ 22 C.2/ 91 D.2/ 81

Answer: C

Explanation:

Let S be the sample space. Then, n(S)= number of ways of drawing 3 balls out of 15 = 15C3 = (15 x 14 x 13)/ (3 x 2 x 1) = 455. Let E = event of getting all the 3 red balls. n(E) = 5C3 = 5C2 = (5 x 4)/ (2 x 1)= 10. P(E) = n(E) / n(S)= 10/ 455 = 2/ 91

18. A card is drawn from a pack of 52 cards. The probability of getting a queen of club or a king of heart is:

A.1 /13 B.2 /13 C.1 /26 D.1 /52

Answer: C

Explanation:

Here, n(S) = 52. Let E = event of getting a queen of club or a king of heart. Then, n(E) = 2. P(E) =n(E)/ n(S)= 2/ 52= 1/ 26

19. Two number are in the ratio 3 : 5. If 9 is subtracted from each, the new numbers are in the ratio 12 : 23. The smaller number is:

A.27 B.33 C.49 D.55

Answer: B

Explanation:

Let the numbers be 3x and 5x. Then ,(3x-9)/(5x-9)=12/13 23(3x - 9) = 12(5x - 9) 9x = 99 x = 11. The smaller number = (3 x 11) = 33.

20. In a bag, there are coins of 25 p, 10 p and 5 p in the ratio of 1 : 2 : 3. If there is Rs. 30 in all, how many 5 p coins are there?

A.50 B.100 C.150 D.200

Answer: C

Explanation:

Let the number of 25 p, 10 p and 5 p coins be x, 2x, 3x respectively. Then, sum of their values=Rs[(25x/100)+(10*2x)/100+(5*3x)/100]=Rs 60x/100 60x/100=30 =>x=(30*100)/60=50 Hence, the number of 5 p coins = (3 x 50) = 150.

21. What will be the output of the program ?

#include int main()

{

char p[] = "%d\n";

p[1] = 'c';

printf(p, 65);

return 0;

}

A.A B.a C.c D.65

Answer: A

Explanation:

Step 1: char p[] = "%d\n"; The variable p is declared as an array of characters and initialized with string "%d" Step 2: p[1] = 'c'; Here, we overwrite the second element of array p by 'c'. So array p becomes "%c". Step 3: printf(p, 65); becomes printf("%c", 65); Therefore it prints the ASCII value of 65. The output is 'A'.

22. What will be the output of the program ?

#include

#include

int main()

{

char str1[20] = "Hello", str2[20] = " World";

printf("%s\n", strcpy(str2, strcat(str1, str2)));

return 0;

}

A.Hello B.World C.Hello World D.WorldHello

Answer: C

Explanation:

Step 1: char str1[20] = "Hello", str2[20] = " World"; The variable str1and str2 is declared as an array of characters and initialized with value "Hello" and " World" respectively. Step 2: printf("%s\n", strcpy(str2, strcat(str1, str2))); => strcat (str1, str2)) it append the string str2 to str1. The result will be stored in str1. Therefore str1 contains "Hello World". => strcpy(str2, "Hello World") it copies the "Hello World" to the variablestr2. Hence it prints "Hello World".

23. Point out the error in the program

#include int main()

{

int i;

#if A

printf("Enter any number:");

scanf("%d", &i);

#elif B

printf("The number is odd");

return 0;

}

A.Error: unexpected end of file because there is no matching #endif B.The number is odd C.Garbage values D.None of above

Answer: A

Explanation:

The conditional macro #if must have an #endif. In this program there is no#endif statement written.

24. Point out the error in the program

#include

#define SI(p, n, r) float si; si=p*n*r/100;

int main()

{

float p=2500, r=3.5;

int n=3;

SI(p, n, r);

SI(1500, 2, 2.5);

return 0;

}

A.26250.00 7500.00 B.Nothing will print C.Error: Multiple declaration of si D.Garbage values

Answer: C

Explanation:

The macro #define SI(p, n, r) float si; si=p*n*r/100; contains the error. To remove this error, we have to modify this macro to #define SI(p,n,r) p*n*r/100

25. What will be the output of the program?

#include int main()

{

float d=2.25;

printf("%e,", d);

printf("%f,", d);

printf("%g,", d);

printf("%lf", d);

return 0;

}

A.2.2, 2.50, 2.50, 2.5 B.2.2e, 2.25f, 2.00, 2.25 C.2.250000e+000, 2.250000, 2.25, 2.250000 D.error

Answer: C

Explanation:

printf("%e,", d); Here '%e' specifies the "Scientific Notation" format. So, it prints the 2.25 as 2.250000e+000. printf("%f,", d); Here '%f' specifies the "Decimal Floating Point" format. So, it prints the 2.25 as 2.250000. printf("%g,", d); Here '%g' "Use the shorter of %e or %f". So, it prints the 2.25 as 2.25. printf("%lf,", d); Here '%lf' specifies the "Long Double" format. So, it prints the 2.25 as 2.250000.

26. What will be the output of the program?

#include

#include

int main()

{

float n=1.54;

printf("%f, %f\n", ceil(n), floor(n));

return 0;

}

A.2.000000, 1.000000 B.1.500000, 1.500000 C.1.550000, 2.000000 D.1.000000, 2.000000

Answer: A

Explanation:

ceil(x) round up the given value. It finds the smallest integer not < x. floor(x) round down the given value. It finds the smallest integer not > x. printf("%f, %f\n", ceil(n), floor(n)); In this line ceil(1.54) round up the 1.54 to 2 and floor(1.54) round down the 1.54 to 1. In the printf("%f, %f\n", ceil(n), floor(n)); statement, the format specifier "%f %f" tells output to be float value. Hence it prints 2.000000 and 1.000000.

27. What will be the output of the program?

#include

int main()

{

float a=0.7;

if(a < 0.7f)

printf("C\n");

else

printf("C++\n");

return 0;

}

A.C B.C++ C.Compiler error D.Non of above

Answer: B

Explanation:

if(a < 0.7f) here a is a float variable and 0.7f is a float constant. The float variable a is not less than 0.7f float constant. But both are equal. Hence the ifcondition is failed and it goes to else it prints 'C++'

28. What will be the output of the program?

#include

int main()

{

float f=43.20;

printf("%e, ", f);

printf("%f, ", f);

printf("%g", f);

return 0;

}

A.4.320000e+01, 43.200001, 43.2 B.4.3, 43.22, 43.21 C.4.3e, 43.20f, 43.00 D.Error

Answer: A

Explanation:

printf("%e, ", f); Here '%e' specifies the "Scientific Notation" format. So, it prints the 43.20 as 4.320000e+01. printf("%f, ", f); Here '%f' specifies the "Decimal Floating Point" format. So, it prints the 43.20 as 43.200001. printf("%g, ", f); Here '%g' "Use the shorter of %e or %f". So, it prints the 43.20 as 43.2.

29. If the size of an integer is 4 bytes, What will be the output of the program ?

#include

#include

int main()

{

printf("%d\n", strlen("123456"));

return 0;

}

A.6 B.12 C.7 D.2

Answer: A

Explanation:

The function strlen returns the number of characters int the given string. Therefore, strlen("123456") contains 6 characters. The output of the program is "6".

30. What will be the output of the program ?

#include

int main()

{

int arr[5], i=0;

while(i<5)

arr[i]=++i;

for(i=0; i<5; i++)

printf("%d, ", arr[i]);

return 0;

}

A.1, 2, 3, 4, 5, B.Garbage value, 1, 2, 3, 4, C.0, 1, 2, 3, 4, D.2, 3, 4, 5, 6,

Answer: B

Explanation:

Since C is a compiler dependent language, it may give different outputs at different platforms. We have given the TurboC Compiler (Windows) output. Please try the above programs in Windows (Turbo-C Compiler) and Linux (GCC Compiler), you will understand the difference better.