Skip to content

Matric Computer

Matric Computer is half theory, half problem solving. The scoring topics are number conversions, logic gates and writing short programs, and all three follow fixed methods you can practise.

Number systems

SystemBaseDigits
Binary20, 1
Octal80–7
Decimal100–9
Hexadecimal160–9, A–F (A = 10 … F = 15)

Worked example

Convert decimal 13 to binary.

  1. 13 ÷ 2 = 6 remainder 1

Binary to decimal: multiply each bit by its place value (1, 2, 4, 8, 16 … from the right) and add. 1101 = 8 + 4 + 0 + 1 = 13. Binary to hex: group bits in fours from the right; 1101 0110 = D6.

Logic gates and truth tables

A logic gate takes one or more inputs that are either 0 (false) or 1 (true) and gives one output. AND gives 1 only if all inputs are 1. OR gives 1 if any input is 1. NOT flips the input. NAND and NOR are AND and OR followed by NOT.

ABA AND BA OR BA NAND BA NOR B
000011
010110
100110
111100

Algorithms and flowcharts

An algorithm is a finite list of clear steps that solves a problem. A flowchart draws it with standard symbols: oval for start/stop, parallelogram for input/output, rectangle for a process, diamond for a decision.

Algorithm: is a number even or odd?

C programming basics

Every C program starts running from main(). Variables must be declared with a type before use: int for whole numbers, float for decimals, char for a single character. printf() shows output; scanf() reads input; each statement ends with a semicolon.

if (n % 2 == 0) printf("Even"); else printf("Odd");

The flowchart above, in C

LoopUse it when
forYou know how many times to repeat
whileRepeat while a condition is true; may run zero times
do-whileBody must run at least once

Key words

Test yourself

Build your own quiz: pick topics, number of questions and a time limit. It's marked for you, with the working for every answer.

7 questions available

Build a quiz

Questions students ask

Is C programming hard for Matric?

No, if you practise. The exam asks short programs: if-else, loops and simple input/output. Type each textbook program yourself and change it a little to see what happens.

How do I convert decimal to hexadecimal fast?

Divide by 16 repeatedly and read the remainders bottom to top, writing 10–15 as A–F. Or convert to binary first and group the bits in fours.

Want one-to-one help?

A checked Computer tutor, at home in Islamabad or Rawalpindi or online. The first 30 minutes are free.

Find a Computer tutor