Cryptography Basics MCQs for the NSCT

By the NSCT Exam Editorial Team · Updated 2026-11-24 · Facts checked against official sources on 2026-11-24

Cryptography basics covers how data is kept secret and tamper-evident: symmetric ciphers such as AES, public-key algorithms such as RSA and Diffie-Hellman, hash functions and digital signatures, plus the classical ciphers used to teach them. It is topic 3 of the 16 in the Cyber Security area, which carries 5% of the NSCT according to HEC's Areas of Competencies. Candidates averaged 47.2% accuracy in this area in 2026, per the HEC NSCT report and APP.

Everything here follows Stallings, Cryptography and Network Security. Expect small calculations: shift a few letters, find an RSA key or count keys.

Symmetric vs asymmetric

Symmetric (conventional) encryption uses one shared secret key for both directions. Asymmetric (public-key) encryption uses a key pair: a public key anyone may know and a private key only the owner holds.

Symmetric Asymmetric
Keys One shared secret Public + private pair
Examples DES (56-bit key, 64-bit block), 3DES, AES (128-bit block; 128/192/256-bit key) RSA, Diffie-Hellman, ECC
Speed Fast, used for bulk data Much slower
Keys for n users n(n − 1)/2 n key pairs
Main problem Distributing keys Trusting that a public key is genuine

For 50 users, symmetric needs 50 × 49 / 2 = 1,225 keys, against 50 key pairs. Real systems such as TLS are hybrid: public-key methods set up a session key, and AES encrypts the data.

Classical ciphers show the basics. A Caesar shift of 5 turns NSCT into SXHY, and only 25 useful keys exist. A general monoalphabetic substitution has 26! ≈ 4 × 10^26 keys but falls to frequency analysis. Vigenère uses a repeating keyword, so the same letter can encrypt differently.

Key space and brute force: a k-bit key has 2^k keys, and on average half must be tried. At 10^9 keys per second, DES's 2^55 average takes about 1.1 years; at 10^13 per second it takes about an hour. AES-128 stays out of reach.

RSA in five steps (toy numbers): p = 5, q = 13, so n = 65 and φ(n) = 4 × 12 = 48. Choose e = 5, coprime with 48. Then d = 5^−1 mod 48 = 29, because 5 × 29 = 145 = 3 × 48 + 1. Encrypt m = 2: C = 2^5 mod 65 = 32. Decrypt: 32^29 mod 65 = 2.

Diffie-Hellman (p = 11, g = 2): Alice picks 3 and sends 2^3 mod 11 = 8; Bob picks 4 and sends 2^4 mod 11 = 5. Both reach 4 (5^3 mod 11 = 8^4 mod 11 = 4). Unauthenticated DH is open to man-in-the-middle attacks.

Exam angle: for confidentiality, encrypt with the receiver's public key; for a signature, use the sender's private key.

Hashing

A cryptographic hash maps any input to a fixed-length digest. It needs three properties:

Hash Output bits Hex characters Status
MD5 128 32 Collisions practical, do not use
SHA-1 160 40 Collisions shown (2017), deprecated
SHA-256 256 64 Secure
SHA-512 512 128 Secure

Hashing is not encryption: there is no key and no decryption. For passwords, add a unique salt and use a slow function such as bcrypt or Argon2. A MAC such as HMAC adds a shared key, giving integrity and authentication but not non-repudiation.

Exam angle: digest length never depends on input length.

Digital signatures

To sign, the sender hashes the message and transforms the hash with their private key. The receiver recomputes the hash and checks the signature with the sender's public key. A signature gives origin authentication, integrity and non-repudiation, but not confidentiality.

To both sign and hide a message, sign with your private key, then encrypt with the receiver's public key. X.509 certificates, signed by a certificate authority (CA) with the CA's private key, tie a public key to an identity, which solves the "is this really Bob's key?" problem.

Exam angle: a broken hash breaks signatures too, because the signature covers only the hash.

Common traps

Worked examples

1. Understanding. Which key verifies a digital signature made by Sara? Answer: Sara's public key. Only her private key could have created the signature, and anyone can check it with her public key.

2. Application. Toy RSA: p = 5, q = 11, e = 3. Find d and encrypt m = 9. Answer: n = 55 and φ(n) = 40. d = 27, because 3 × 27 = 81 ≡ 1 (mod 40). C = 9^3 mod 55 = 729 mod 55 = 14.

3. Analysis. A site stores unsalted SHA-256 password hashes, and two users show the same hash. What does that reveal, and what is the fix? Answer: they almost certainly share a password, and the hashes are open to precomputed tables. Add a unique salt per user and switch to bcrypt or Argon2.

Practise

The quiz below has 100 questions on cryptography basics, filterable by tier and difficulty. For a longer comparison, see symmetric vs asymmetric encryption.

Practise: 100 questions

Interactive quiz loading. The first 10 questions are shown below.

  1. In symmetric encryption, how many keys are used to encrypt and decrypt a message between two parties?

    1. A public key to encrypt and a private key to decrypt
    2. Two secret keys, one for each direction, that must never be shared
    3. No key; the algorithm itself is the secret
    4. One shared secret key for both operations
    Show answer

    Answer: D. One shared secret key for both operations

    Symmetric (conventional) encryption uses the same secret key for encryption and decryption, so both parties must share it securely. Public and private key pairs belong to asymmetric encryption.

  2. Alice wants to send Bob a confidential message using RSA. Which key does she encrypt with?

    1. Bob's public key
    2. Alice's private key
    3. Alice's public key
    4. Bob's private key
    Show answer

    Answer: A. Bob's public key

    For confidentiality, encrypt with the recipient's public key; only the recipient's private key can decrypt. Encrypting with Alice's private key would create a signature that anyone could check, not secrecy.

  3. Which key does a sender use to create a digital signature?

    1. The sender's own private key
    2. The sender's public key
    3. The receiver's public key
    4. A shared secret key
    Show answer

    Answer: A. The sender's own private key

    A signature is created with the signer's private key and verified by anyone with the signer's public key. Only the holder of the private key could have produced it, which gives authentication and non-repudiation.

  4. What is the output size of SHA-256?

    1. 128 bits
    2. 160 bits
    3. 512 bits
    4. 256 bits
    Show answer

    Answer: D. 256 bits

    SHA-256 always produces a 256-bit (32-byte) digest, written as 64 hexadecimal characters, whatever the input length. MD5 gives 128 bits and SHA-1 gives 160 bits.

  5. Which property makes a cryptographic hash function one-way?

    1. Collision resistance: no two inputs ever share a hash
    2. Avalanche effect: outputs look random
    3. Pre-image resistance: given a hash h, it is infeasible to find any input x with H(x) = h
    4. Variable output length matching the input
    Show answer

    Answer: C. Pre-image resistance: given a hash h, it is infeasible to find any input x with H(x) = h

    Pre-image resistance is the one-way property. Collision resistance is a different property (hard to find any two inputs with the same hash); collisions always exist because the output is fixed-length. Hash outputs are fixed-length, not variable.

  6. Which of these is a symmetric block cipher?

    1. RSA
    2. Diffie-Hellman
    3. AES
    4. ECDSA
    Show answer

    Answer: C. AES

    AES (Rijndael) is a symmetric block cipher with a 128-bit block and 128, 192 or 256-bit keys. RSA is a public-key algorithm, Diffie-Hellman is a key-exchange protocol and ECDSA is a signature scheme.

  7. What is the block size of AES?

    1. 64 bits
    2. 56 bits
    3. 128 bits
    4. 256 bits
    Show answer

    Answer: C. 128 bits

    AES always uses a 128-bit block. Its key may be 128, 192 or 256 bits, with 10, 12 or 14 rounds. DES has a 64-bit block and a 56-bit effective key.

  8. What does the Diffie-Hellman protocol let two parties do?

    1. Agree on a shared secret key over an insecure channel
    2. Sign documents so they cannot be denied
    3. Encrypt bulk data faster than AES
    4. Hash passwords for storage
    Show answer

    Answer: A. Agree on a shared secret key over an insecure channel

    Diffie-Hellman is a key-exchange method. Each side sends a public value and combines it with its own secret to reach the same shared key, which then feeds a symmetric cipher. On its own it provides neither signatures nor bulk encryption.

  9. Who digitally signs an X.509 certificate?

    1. The certificate owner, with their public key
    2. The web browser, with a session key
    3. The certificate authority (CA), with its private key
    4. The DNS server, with a hash
    Show answer

    Answer: C. The certificate authority (CA), with its private key

    A certificate binds a subject's identity to its public key, and the CA signs it with the CA's private key. Anyone who trusts the CA's public key can verify the certificate.

  10. How many possible keys does a Caesar cipher on the 26-letter English alphabet have that actually change the text?

    1. 26
    2. 52
    3. 26!
    4. 25
    Show answer

    Answer: D. 25

    The Caesar cipher shifts each letter by k positions. Shifts 1 to 25 change the text; a shift of 0 (or 26) leaves it unchanged. So a brute-force attacker needs at most 25 tries.

FAQs

Is hashing the same as encryption?

No. Encryption is reversible with the right key and protects data you need to read again. Hashing has no key, cannot be reversed and always gives a fixed-length output. It is used to check integrity, to build signatures and MACs, and, with salt and a slow algorithm, to store passwords.

Why is RSA not used to encrypt whole files?

RSA is far slower than AES, and one RSA-2048 operation can carry less than 256 bytes. Systems therefore use hybrid encryption: RSA or Diffie-Hellman protects a random session key, and AES encrypts the actual file or traffic.

Do I need to memorise RSA calculations for the NSCT?

Learn the steps rather than numbers: n = pq, φ(n) = (p − 1)(q − 1), choose e coprime with φ(n), find d as e's inverse mod φ(n), then C = m^e mod n and m = C^d mod n. Practise with primes under 20 so every step is quick by hand.

Next step

Continue to Network Security MCQs, the next topic in the official order, where TLS, VPNs and IPsec put these primitives to work. Revisit the Cyber Security MCQs hub or test yourself in an NSCT mock test.