Skip to main content

OFFSET in Computer Science

OFFSET in Computer Science

In the post, We will understand what is the meaning of OFFSET in computer science with an example.
In computer science offset comes picture at may place like packing a data structure, encoding the data etc in some standard protocol so that other parties can deserialise it and understand the data. We will understand its important how does it work with example. suppose we have a data structure for a student like
 {  
 name:string[20]  
 roll: int[4]  
 course: string[25]  
 batch: int[4]  
 }  

We want to serialise below student data 
 {  
 name:"Amit Gupta"  
 roll: 1234  
 course:Computer Science"  
 batch: 2018  
 }  
Our protocol follow the rule that we will insert a value and if space will remain empty we will fill it with $ for example length of "Amit Gupta" is 10 but standard size is 20 so will fill 10 $ after "Amit Gupta". So serialisation of above data will be
 Amit Gupta$$$$$$$$$$1234Computer Science$$$$$$$$$2018  
So according to our data structure
  • OFFSET of name will be zero and length will 20
  • OFFSET of roll will be 20 and length will 4
  • OFFSET of course will be 24 and length will 25
  • OFFSET of batch will be 49 and length will 4
So from above you can clearly say that OFFSET of any variable or character is number of character before it.
Now for example we can encode it into base64 before sending it third party. So base64 encoding of above string will be
 IEFtaXQgR3VwdGEkJCQkJCQkJCQkMTIzNENvbXB1dGVyIFNjaWVuY2UkJCQkJCQkJCQyMDE4ICA=  
Other can decode it and now he know how to deserialise because of protocol definition from 0 to 20 character he will consider as name and ignore the $ symbol next 20 to 24 as roll, 24 to 49 as course and 49 to 53 as batch.


Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. 

Comments

  1. This post will prove very useful for computer science students. My sister is also a computer science student. I will definitely share this post with her. In-spite of it, she is doing her preparation from typical student. Whenever she has doubts in any subject she immediately visit the site and get solutions from there.

    ReplyDelete
    Replies
    1. Thanks a lot. We will be posting more great educational blogs in near future.

      Delete
  2. Thank you so much for post. It is really help full. If any one want to know about R-Programming Language.
    R Programming training Center in Delhi/NCR

    ReplyDelete
  3. Thanks for sharing information with us,I would appreciate if you could share more information about software courses
    e accounting training course in delhi

    ReplyDelete
  4. Hi I have tried it before but I made an error. You write correctly that "OFFSET of roll will be 20 and length will 4" I used the length 5 instead of 4. You are awesome. Keep it up. Thanks for writing.

    ReplyDelete
  5. Your blog provided us with valuable information to work with. Thanks a lot for sharing. Outsource support increased expertise, Expand resource and Efficiency. For the Outsource support you can visit on outsourced hosting support

    ReplyDelete
  6. Thanks for sharing the valuable post. To get to know about off page optimization plz vist the below link
    Digital Marketing Training in Chennai

    ReplyDelete
  7. Quite informative blog .One could easily get into Aviation Domain with Degree in Computer Science. Multiple Aviation Courses are available to get into Aviation industry.
    Aviation Training in Chennai
    Airport Ground Operations Training
    Cabin Crew Training In Chennai
    Pilot Training In Chennai
    Flight Dispatcher Training In Chennai

    ReplyDelete
  8. There is lots of post about SAP But Your Post way of Writing and knowledgeable information is So Good and Unique. Keep Writing
    Sap Training Course in Delhi
    Sap Training Course in Noida
    Sap Training Course in Gurgaon

    ReplyDelete
  9. This is an awesome post. Really very informative and creative contents. I really appreciate your post. Thanks for sharing it. To Know More Visit Here: Rajendra Geda

    ReplyDelete
  10. Ascend Aviation Pilot training program. Ascend aviation is the pinnacle of aviation training cum placement assistance institution located in southern part of india. Click on link below, To know more about our programs .
    Aviation Course in Chennai
    Airport Ground Operations Training
    Cabin Crew Training In Chennai
    Pilot Training In Chennai
    Flight Dispatcher Training In Chennai
    Aviation Training in Chennai
    Air hostess training
    Aviation Academy in Chennai

    ReplyDelete
  11. it's really a piece of new information to me, I learn more from this blog, I want to learn more from this blog, keep on it doing, I eagerly waiting for your updates, Thank you!!!

    Best Aviation Academy in Chennai

    Best Air hostess Training in Chennai

    Pilot Training in Chennai

    Airport Ground Handling Training in Chennai

    Airport Flight Dispatcher Trainee in Chennai

    RTR- Aero Training in Chennai

    For more... facebook

    ReplyDelete
  12. I read Your Post about E-accounting and I must say it is really one of the finest Post. It’s really unique and knowledgeable information
    E-accounting training in Delhi
    E-accounting training in Noida
    E-accounting training in Gurgaon

    ReplyDelete
  13. This app explains the importance of why you need to update any application over time. You can opt for quality mobile app maintenance online for a wide range of information.

    ReplyDelete
  14. it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.



    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery





    ReplyDelete

Post a Comment

Popular posts from this blog

SSC Practice Problem Solution

SSC Practice Problem Solution In this post, we will discuss solution of  SSC Practice Problem . Question 1  The efficiency of (A + B) = 100/24 = (25/6)% The efficiency of (A + B + C) = 100/8 = (25/2)% The efficiency of C = 25/2 – 25/6 = (50/6)% Hence, C can alone finish this job in = 100/(50/6) = 12 days Answer: 12 days option (1) Question 2  Original price = Rs. 6000; Price after discount = 6000 – 1200 = Rs. 4800; Price after raising service contract = 4800 + 480 = Rs. 5280 Answer: Rs. 5280 option (2) Question 3  Suppose the received money by A, B, and C is respectively 5x, 6x, and 9x. 5x = 450; => x = 90; Hence, the total money = 20x = 20*90 = Rs. 1800; Answer: Rs. 1800 option (2) Question 4 Suppose the Cost price of the bag= Rs. x; Hence, x + 0.15x = 230; => x = Rs. 200; Selling price after selling on 20% = 200 + 20% of 200 = Rs. 240 Answer: Rs. 240 option (3) Question 5  The required percentage ...

Average

Average In this post, We will learn about average.  Average of any collection of data is the sum of data divide by number of data. Average = (Sum of observations /  Number of observations) Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.  problems The arithmetic mean of x, y and z is 80, and that of x, y, z, u and v is 75, where u=(x+y)/2 and v=(y+z)/2. If x ≥ z, then the minimum possible value of x is (CAT 2018) As specified in the question mean of x and y and z is 80 x+y+z=3*80 mean of x, y, z,u,v is 75 x+y+z+u+v=75*5 2u=x+y 2v=y+z x+y+z+((x+y+y+z)/2)=75*5 y+3(x+y+z)=75*10 y=750-720 y=30 since x+y+z=240 y=30 so x+z=210 since x>=z so minimum value of x=210/2 = 105 Problem2: In first 5 inings sehwag has scored at average of 40. In sixth ining He had scored 52 what is His average after 6th ining. one simple approach is getting total score divided by no of inin...

Complex Number

Complex Number While solving the equation of the form  a x 2 + b x + c = 0 , the roots of the equations can take three forms which are as follows: Two Distinct Real Roots Similar Root No Real roots (Complex Roots) The introduction of complex numbers in the 16th century made it possible to solve the equation  x 2 + 1 = 0 . The roots of the equation are of the form  x = ± − 1 ‾ ‾ ‾ √  and no real roots exist. Thus, with the introduction of complex numbers, we have Imaginary roots. We denote  − 1 ‾ ‾ ‾ √  with the symbol i, where i denotes Iota (Imaginary number). An equation of the form z= a+ib, where a and b are real numbers, is defined to be a complex number. The real part is denoted by Re z = a and the imaginary part is denoted by Im z = b. Algebraic Operation on Complex numbers: Addition of two complex numbers Subtraction of two complex number Multiplication of two complex number Division of two complex number Power of Iota (i) ...

Logarithm

Logarithm When a x   = N , then we say that x = logarithm of N to the base a and write it as x = log a N . In simple words, it represents the power to which a number must be raised. Let me expand on that by giving a simpler example. If we are asked, what would be the result if ‘a’ is multiplied with itself ‘b’ times; then your answer would be x = a*a*a*…. b (times). This can also be written as a^b. This is also known as ‘a raised to the power of b’ If we are asked, which number multiplied with itself ‘b’ times, will result in a; then you are asked for the value of x such that x*x*x*… b(times) = a => x^b = a => x = a^(1/b) This is also known as ‘bth root of a’ If swe are asked, how many times should you multiply ‘a’ with itself to get ‘b’, that is where the concept of logarithm comes into the picture. You are asked for the value of ‘x’ such that a*a*a…. x (times) = b => x = Log  a  b This is also known as ‘ Log b to the base a’ ...