Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Coding/Programming Interviews:Active Template Library (ATL)ActiveXApplication DeveloperArtificial intelligenceAssemblyAssociate Software EngineerAWKAWTC ProgrammingC++ ProgrammingCGI PerlCGI ProgrammingCMMICobolCritical ReasoningData Structures TreesDCOM COMDelphiDTDE4XExtensible Stylesheet Language (XSL)FortranFull-Stack DeveloperHaskellHTML DOMILUIPhone DeveloperJasper Reports DeveloperJava DeveloperLisp ProgrammingLotus NotesMicrosoft Foundation Class (MFC)Mobile DeveloperMVC DeveloperNode.jsOOPPascalPerl ProgrammingPHPPHP DeveloperProgrammingProgramming AlgorithmsProgramming ConceptsPythonRubyRuby on RailsRuby on Rails DeveloperSenior Front End DeveloperSenior Software DeveloperSignature ProgramSOASocket ProgrammingSoftware Development EngineerSoftware engineeringSr. PHP ProgrammerStack And QueueSTLSwift DeveloperTCL (Tool Command Language)Team Leader Android DeveloperUMLUnity 2D Games DeveloperUnity 3D DeveloperUnity DeveloperVBA (Visual Basic for Applications)Visual Basic (VB)Visual C++Web DevelopmentWin32APIWindows ProgramingWordPress DevelopmentWSDLXFormsXHTMLXLinkXMLXPathXQueryXSL-FOXSLT
Copyright © 2018. All Rights Reserved
Unity Developer Interview Question:
Can you write a C# method to total all the even numbers in an array of ints?
Submitted by: MuhammadThis is an open-ended coding question that is likely to produce a variety of answers. What you're really looking for is how the developer chooses to solve the problem. Do they settle for the obvious one-liner, return intArray.Where(i => i % 2 == 0).sum() or will they notice the high probability of overflow and instead opt for something more nuanced like the sample answer below?
static long TotalAllEvenInts(int[] intArray) {
return (from i in intArray where i % 2 == 0 select (long)i).Sum();
}
Experienced C# developers will take this as an opportunity to show off their knowledge of C# language constructs that make simple solutions like the one above possible.
Submitted by: Muhammad
static long TotalAllEvenInts(int[] intArray) {
return (from i in intArray where i % 2 == 0 select (long)i).Sum();
}
Experienced C# developers will take this as an opportunity to show off their knowledge of C# language constructs that make simple solutions like the one above possible.
Submitted by: Muhammad
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.