HCL Interview Question for Developer Program Engineers


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

what do you mean by precision value? can you give and example and explain?

- JustCoding September 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Precision is the number of digits in a number. Scale is the number of digits to the right of the decimal point in a number. For example, the number 123.45 has a precision of 5 and a scale of 2.

That can be calculated by using the below formulas:

Operation Result precision
e1 + e2 max(s1, s2) + max(p1-s1, p2-s2) + 1
e1 - e2 max(s1, s2) + max(p1-s1, p2-s2)
e1 * e2 p1 + p2 + 1

Here operand expressions are denoted as expression e1, with precision p1 and scale s1. Same is for e2, p2 and s2.


e1 / e2 p1 - s1 + s2 + max(6, s1 + p2 + 1)

- Saurabh October 01, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

String s="NUMBER"
precision=s.length();
scale=s.length()-s.indexOf('.')-1

- Anonymous March 12, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

include <iostream>
#include <string>
using namespace std;
int main()
{
        string value = to_string(static_cast<long double>(1234.56));
        int precision = value.size();
        int scale = value.size()-value.find('.')-1;
        cout << precision << " " << scale;
        std::cout << "The string is \"" << value << "\"\n";
        return 0;
}

- Devesh Agrawal November 20, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More