COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider a plaintext string that consists of uppercase letters. A certain encryption algorithm replaces each letter in the string with a cipher text letter to create a cipher text string as follows. The algorithm selects the letter that is to be replaced. Using the uppercase English alphabet, the algorithm moves a fixed number of positions from the selected letter, in increasing alphabetical order. If the algorithm reaches the end of the English alphabet, it wraps around and continues from the beginning of the alphabet.Consider the following line of code, which implements the replacement of the selected plaintext uppercase letter ltr, where offset is the fixed number of positions.ltr ← ( ( ( ltr-‘A’ ) + offset ) % 26 ) + ‘A’
A
“PXV”
B
“RZX”
C
“TBZ”
D
“VDB”
Explanation: 

Detailed explanation-1: -Substitution ciphers encrypt the plaintext by swapping each letter or symbol in the plaintext by a different symbol as directed by the key. Perhaps the simplest substitution cipher is the Caesar cipher, named after the man who used it.

Detailed explanation-2: -The action of a Caesar cipher is to replace each plaintext letter with a different one a fixed number of places down the alphabet. The cipher illustrated here uses a left shift of three, so that (for example) each occurrence of E in the plaintext becomes B in the ciphertext.

Detailed explanation-3: -Cryptographic ciphers are used to convert ciphertext to plaintext and back. With symmetric key algorithms, the same key is used for the encryption and decryption of data. Asymmetric key algorithms use public keys and private keys to encrypt and decrypt data.

Detailed explanation-4: -The substitution technique involves replacing letters with other letters and symbols. In simple terms, the plaintext characters are substituted, and additional substitute letters, numerals, and symbols are implemented in their place. The Caesar cipher employs the substitution technique.

There is 1 question to complete.