What is the outcome of the line of code "cout<<abs(-
16.5);"?




1) 16


2) 17


3) 16.5

Answers were Sorted based on User's Feedback



What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / shailaja

the outcome of this code is 16.5
bcz it will return the absolute value of parameter.

Is This Answer Correct ?    18 Yes 6 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / prabakaran

1)16
because abs() is used to calculate the absalute value of
integer only,so it convert the floating point value -16.5
into -16,and
calculate tha abs() value

Is This Answer Correct ?    8 Yes 2 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / rajavel

16.5
this is abs value

Is This Answer Correct ?    7 Yes 2 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / d n gavade

abs() function returns absolute value of given arguments in
integer form because its return type is integer.
so answer will be 16.

if it is fabs() then only we get answer in float,double.

Is This Answer Correct ?    5 Yes 1 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / neeraj

16

Is This Answer Correct ?    5 Yes 2 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / pds

16

Is This Answer Correct ?    3 Yes 1 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / ankit

I ran it on my PC and got the result as 16

Is This Answer Correct ?    3 Yes 1 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / arash s

16
just read what is "absolute" and u will know why.

Is This Answer Correct ?    1 Yes 0 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / nathusingh rathod

Right answer for this question is 16. Had there been fabs
then result would have been 16.5 but as there is only abs()
so it will return integer value i.e 16.

Is This Answer Correct ?    1 Yes 0 No

What is the outcome of the line of code "cout<<abs(- 16.5);"? 1) 16 ..

Answer / deep

16.5

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

which is best institute to learn c,c++ in ameerpet hyderabad

1 Answers  


What do you mean by stack program? Get me an example stack program?

4 Answers  


Why is polymorphism important in oop?

0 Answers  


Write a program to find out the number of palindromes in a sentence.

1 Answers   TCS,


What are the fields of vtable

1 Answers   Mphasis,






What are the 4 main oop principles?

0 Answers  


Why static functions always uses static variables?

3 Answers  


Why it is called runtime polymorphism?

0 Answers  


what uses of c++ language?

3 Answers  


Given two strings like x=?hello? and y=?open?, remove any character from string x which is also used in string y, thus making the result x=?hll?.

13 Answers   IBM,


How to call a non virtual function in the derived class by using base class pointer

3 Answers   HCL,


given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy

0 Answers   DELL,


Categories