980926-1

Write an ASN.1 specification to transfer an image. The image is sometimes in GIF and sometimes in JPEG format, and the choice of format must also be transferred. In addition to the picture, also its name, specified as a text string, shall be transferred.

Possible reply

Solution 1:

Picture ::= SEQUENCE {
         name VisibleString,
         CHOICE {
         gif [0] Gif,
         jpeg [1] Jpeg } }

Gif ::= OCTET STRING

Jpeg ::= OCTET STRING

Solution 2:

Picture ::= SEQUENCE {
        type ENUMERATED {
           gif(0),
           jpeg(1) },
        data OCTET STRING,
        name VisibleString }

Note: BIT STRING is equally good as OCTET STRING. Many students proposed various text strings, like Graphic String, but they are not suitable for binary data like GIF or JPEG images.

List of exam questions