C Programming MCQs

20 practice MCQs on this page Page 2 of 3

Tap an option to check your answer — the correct answer and full explanation appear after you choose.

ProgrammingC Programming PPSC FPSC NTSID: PROG-096

What is the output of this C code? int x = 10; printf("%d", x - 4 * 2);

  1. A2. ✓ Correct answer
  2. B12.
  3. C4.
  4. D10.
ProgrammingC Programming PPSC FPSC NTSID: PROG-101

In C programming, which function is used to read input from the keyboard?

  1. Aprintf
  2. Bscanf ✓ Correct answer
  3. Cmain
  4. Dreturn
ProgrammingC Programming PPSC FPSC NTSID: PROG-106

What does 'sizeof' do in C programming?

  1. AThe value stored in a variable.
  2. BThe number of characters in a string.
  3. CThe size of a variable or type in bytes. ✓ Correct answer
  4. DThe address of a variable.
ProgrammingC Programming PPSC FPSC NTSID: PROG-111

In C, which symbol starts a single-line comment?

  1. A#
  2. B// ✓ Correct answer
  3. C<!-- -->
  4. D/* */
ProgrammingC Programming PPSC FPSC NTSID: PROG-116

What is the output of this C code? int a = 3; a += 4; printf("%d", a);

  1. A4
  2. B3
  3. C12
  4. D7 ✓ Correct answer
ProgrammingC Programming BPSCID: BPP-894

Which type of pointer can store the address of any data type?

  1. Afloat*
  2. Bint*
  3. Cvoid* ✓ Correct answer
  4. DNone of these
ProgrammingC Programming BPSCID: BPP-895

Which operator is used to access the value at a pointer's address?

  1. A[]
  2. B* ✓ Correct answer
  3. C&
  4. DNone of these
ProgrammingC Programming BPSCID: BPP-896

Where is dynamically allocated memory stored?

  1. AArray
  2. BStack
  3. CHeap ✓ Correct answer
  4. DNone of these
ProgrammingC Programming BPSCID: BPP-897

Stack memory stores which of the following when a function is called _____?

  1. AReturn addresses
  2. BLocal variables
  3. CParameters
  4. DAll of them ✓ Correct answer
ProgrammingC Programming BPSCID: BPP-898

Most convenient loop to use when working with 2D arrays?

  1. ADo while
  2. BFor ✓ Correct answer
  3. CWhile
  4. DAll of them
ProgrammingC Programming BPSCID: BPP-899

When the number of iterations are not known in advance which loop is most suitable?

  1. ADo while
  2. BFor
  3. CWhile ✓ Correct answer
  4. DAll of them
ProgrammingC Programming BPSCID: BPP-900

Which branching statement can easily handle complicated nested decisions?

  1. ASwitch ✓ Correct answer
  2. BIf else
  3. CElse if
  4. DAll of them
ProgrammingC Programming BPSCID: BPP-901

Which of the following is not a standard builtin data type in C? Bool, Long, Int, Char

  1. ABool ✓ Correct answer
  2. BLong
  3. CInt
  4. DChar
ProgrammingC Programming BPSCID: BPP-903

Data type int occupies 4 bytes in memory, writing unsigned before int increases its ______?

  1. ARange ✓ Correct answer
  2. BSize
  3. CBoth A and B
  4. DNone of them
ProgrammingC Programming ETEAID: LTP-5790

A program that combines object files and library files to generate a single executable file is called?

  1. AEditor
  2. BCompiler
  3. CLinker ✓ Correct answer
  4. DNone of these
ProgrammingC Programming ETEAID: LTP-5798

In flowchart, a diamond sign indicates a _____?

  1. ADisplay
  2. BNone of these
  3. CProcess
  4. DDecision ✓ Correct answer
ProgrammingC Programming ETEAID: LTP-5817

The halting problem is a decision problem related to program ______?

  1. ACompilation
  2. BTermination ✓ Correct answer
  3. CDebugging
  4. DNone of these
ProgrammingC Programming ETEAID: LTP-5819

In a flowchart, a parallelogram represents _____ operations.

  1. ADecision
  2. BProcess
  3. CInput/Output ✓ Correct answer
  4. DNone of these
ProgrammingC Programming ETEAID: LTP-5823

In Scratch programming, an event is an action that the program ____ to.

  1. ADeletes
  2. BNone of these
  3. CStops
  4. DResponds ✓ Correct answer
ProgrammingC Programming ETEAID: LTP-5857

Which statement is the opposite of the break statement and is also known as the bypass statement?

  1. AExit
  2. BContinue ✓ Correct answer
  3. CReturn
  4. DNone of these

Practice these MCQs interactively