i have an array of 10 objects whose values are from 1-10
randomly inserted. i have deleted one array object.
tell me what is that value? write the logic of it.
Answers were Sorted based on User's Feedback
Answer / rajani
Suren is right to some extent.if in case of random 10 number also. first take the sum of all numbers by running a loop. then delete a number . again run the loop and find the sum then subtract second from first .
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / suren
its simple for guys 4m Engineering background.
if u have an idea with series of numbers, (n(n+1)/2)
first take the sum of all the objects in array, next
subtrat the sum of arrays after deletion of object. this
will give you the deleted object value.
1,2,3... 10; sum = 10(10+1)/2=55
suppose the value of object deleted is 6;
then sum of the array after deletion will be 49;
55-49=6 ANS:
Is This Answer Correct ? | 12 Yes | 8 No |
What are server controls?
Please explain what is the difference between encrypting a password and applying a hashing?
How viewstate is being formed and how it's stored on client in .net?
WHAT IS .net
How we can achieve Connection pooling in .Net?
Explain the difference between .net 2000 and .net 2005(features)? Which one is better?
What is difference between .net core and .net standard?
Explain me what is the difference between a class and an object, and how do these terms relate to each other?
What is assemblies in .net?
How is development of a Windows service different from a Windows Forms application?
What are Generics? Where do we use them.
What?s the Unix name for a Windows service equivalent?