TCS Placement: Sample Questions 223 - 224 of 502

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 223

Write in Short Short Answer▾

Can I use “int” data type to store the value 32768? Why?

Edit

Explanation

  • No. “Int” data type is capable of storing values from -32768 to 32767.
  • 32768 can be used as “long int” instead.
  • “unsigned int” can also be used if negative values are not to be used.
  • C compiler will not throw any error when 32768 is assigned to an integer type variable. But the actual value in that integer type variable will be -32768.
  • In C programming language the range or size of integer data type is circular- a value greater than 32767, is automatically converted to next value that՚s, -32768.
  • A value less than -32768 is automatically converted to the next value: 32767.

Question 224

Question MCQ▾

Apples cost L rupees per kilogram for the first 30 kilograms and Q per kilogram for each additional kilogram. If the price paid for 33 kilograms of Apples is ₹ 1167 and for 36 kilograms of apples if ₹ 1284, then the cost of the first 10 kg of apples is:

Choices

Choice (4)

a.

₹ 117

b.

₹ 1053

c.

₹ 350

d.

₹ 281

Edit

Answer

c.

Explanation

Price for 30 kg of apples with ₹ L per kilogram = 30L

Price for 3 kg of apples with ₹ Q per kilogram = 3Q

Price for 6 kg of apples with ₹ Q per kilogram = 6Q

Total price for 33 kg of apples

Total price for 36 kg of apples

Solving both the equations,

Q = 39 and L = 35

So, cost price for first 10 kg of apples .