
Fundamental Concepts and Problem Solving
Bachelor of Science in Computer Science (B.Sc. in C.S.) students are expected to solve number of problem solving situations through knowledge on digital systems and computer programming. The program also provides the students with the technical skills and logical reasoning capability required to handle real-life and computational issues. These are some of the key questions which ought to be revised very well before embarking on this academic journey since they would offer the background knowledge that would be needed when one embarks on higher studies in computer science.
ASCII is known as American Standard Code of Information Interchange. It is a standard character encoding scheme that is used to code characters which includes alphabets, digits and special symbols in computers. The characters have got their own numeric code assigned to them, which assists in the storage and communication of data between various computer systems.
The smallest significant entity of a C program that the compiler recognizes when compiling it is referred to as tokens. They are the fundamental units of a program. The various C types of tokens are:
Tokens help the compiler to understand the structure and meaning of a program.
Special operators in C are operators that perform specific tasks other than arithmetic and logical operations. They include:
Continue statement is a loop control statement applied in for, while and do-while loops. The control can jump over all the remaining statements of the current loop iteration with the execution of the continue statement and passes directly to the next loop iteration. It is primarily applied to instances where a specific condition meets and the programmer wishes to forego the remainder of the loop body during that instance without necessarily ending the loop.
In C, string is character array of characters, terminated by a null character of character-code (‘\0’). A text, which can be the name, words, and sentences, is stored in strings. An example is that Computer is the name that takes 9 bytes in the memory (8 letters and 1 null character). String manipulations like strlen, strcpy and strcmp etc. are utilized to operate with strings.
Basic gates are AND, OR, and NOT gates.
Boolean Expression: Y = A · B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Explanation: The output is high when both inputs are high.
Boolean Expression: Y = A + B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Explanation: The output is High when any one of the input is High.
Boolean Expression: Y = A̅
| A | Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
Explanation: It inverts the input signal.
The entire subtractor is required since the half-subtractor could only subtract the least significant bit (LSB) of the binary numbers. Nonetheless, when a borrow is created in the subtraction of the LSBs, it will influence the subtraction in subsequent stages.
This case is dealt with by a full subtractor which uses the borrow of the previous stage so that the subtraction is correct even in the case of a borrow which is available. The full subtractor is appropriate in multi-bit subtraction in digital circuit boards such as Arithmetic Logic Unit (ALU) because it can accurately subtract binary numbers with support of borrowing.
Inputs: A (minuend), B (subtrahend), Bin (borrow in)
Outputs: D (difference), Bout (borrow out)
Logical expression for difference:
Basic Expression for Difference (D):
D = A̅ B̅ Bin + A̅ B Bin̅ + A B̅ Bin̅ + A B Bin
Final simplified expression for Difference:
D = (A ⊕ B) ⊕ Bin
Logical expression for borrow:
Logical Expression for Borrow (Bout):
Bout = A̅ Bin + A̅ B + B Bin
Final expression:
Bout = Bin (A ⊕ B)̅ + A̅ B
| A | B | Bin | D | Bout |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
A JK flip-flop is a kind of sequential logic circuit which is able to store one bit of binary data. It contains two inputs, J(Set) and K(Reset) and two outputs, Q and Q̅. JK flip-flop has two configurations: Synchronous mode: The change of the output is only subject to the signal of the clock. Asynchronous mode: The output can be changed without the clock signal with the help of preset (PR) and clear (CLR) input. The circuit will be made of NAND gates with feedback on the inputs of the NAND gates. Due to this feedback connectivity, the JK flip-flop has removed the invalid state of the SR flip-flop. In the case of J and K equal to one, the flip-flop does not generate an invalid output. Instead, it toggles its state. The preset (PR) and clear (CLR) are to be forced to the output at 1 and 0 respectively regardless of the clock signal.
| Inputs | Outputs | Comments | |||||
|---|---|---|---|---|---|---|---|
| PR | CLR | CLK | J | K | Q(n+1) | Q'(n+1) | |
| 0 | 1 | NA | NA | NA | 1 | 0 | Set (Preset) |
| 1 | 0 | NA | NA | NA | 0 | 1 | Reset (Clear) |
| 1 | 1 | 0 | NA | NA | Q(n) | Q'(n) | Initial Stage |
| 1 | 1 | 1 | 0 | 0 | Q(n) | Q'(n) | Initial Stage |
| 1 | 1 | 1 | 1 | 0 | 1 | 0 | Set |
| 1 | 1 | 1 | 0 | 1 | 0 | 1 | Reset |
| 1 | 1 | 1 | 1 | 1 | Q'(n) | Q(n) | Toggle |
Working of JK Flip-Flop
ROM (Read Only Memory)
ROM (Read Only Memory) is a kind of non-volatile memory that is utilized in a computer system to hold the data and instructions that are permanent. When power supply is switched off, there is no loss of contents of ROM. Its primary use is in the storage of firmware, booting programs and system-level instructions to boot and operate the computer.
ROMs exist in a number of types depending on the way data are programmed and erased:
PROM is a form of ROM which is only programmed once by the user. The information once written into PROM cannot be modified or deleted.
Features:
Application: Applied in electronic devices where the program is not required to be changed in any way.
EPROM is a form of ROM which is eraseable and rewritable. The data contained in the chip may be deleted by exposing the chip to ultraviolet (UV) light over a given period using a quartz window.
Features:
Application: Employed in the systems where software changes are sometimes needed.
EEPROM is a form of ROM and can be erased and reprogrammed without being taken out of the circuit, which is electrically possible.
Features:
Application: Smart cards are used in embedded systems, smart cards and in BIOS chips.
Flash ROM is a superior form of EEPROM whereby the data is deleted and added in blocks as opposed to one byte at a time.
Features:
Application: Placed in pen drives, memory cards, SSDs, and mobile phones.
