0% found this document useful (0 votes)
41 views2 pages

Birla Institute of Technology

The document is a mid-semester test for a computer programming course. It contains 8 questions testing various concepts: (1) 8-bit 2's complement arithmetic, (2) logic gate implementations, (3) components of the von Neumann model, (4) assembly language addressing modes, (5) LC-2 assembly program with errors, (6) differences between interpreters and compilers, (7) flowchart to check for a character, (8) valid C variable declarations.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views2 pages

Birla Institute of Technology

The document is a mid-semester test for a computer programming course. It contains 8 questions testing various concepts: (1) 8-bit 2's complement arithmetic, (2) logic gate implementations, (3) components of the von Neumann model, (4) assembly language addressing modes, (5) LC-2 assembly program with errors, (6) differences between interpreters and compilers, (7) flowchart to check for a character, (8) valid C variable declarations.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Birla Institute of Technology & Science, Pilani Distance Learning Programmes Division First Semester 2003-2004 Mid-Semester Test

(EC-2 Regular) Course No. Course Title : TA ZC142 : COMPUTER PROGRAMMING

Nature of Exam : Closed Book Weightage : 40% Duration : 2 Hours Date of Exam : 20/09/2003 (AN) Note : Attempt all the questions. Start each answer from a fresh page. Q. 1. Perform the following operations using 8-bit 2s complement representation and show the individual steps. If the operation results in an error or exception mention the same and explain why. [2 + 2 = 4] a) 125 15 b) 128 53 Q. 2. Explain how you can implement the following operations using only 2-input NOR gates: [1+2+2+1=6] a) NOT b) AND c) XOR d) EQUALS (Note: EQUALS operation is defined as follows: A EQUALS B is 1 if A=B=0 or if A=B=1 and 0 otherwise. End of Note.) Q.3. (a) What is the role of the Program Counter in the Von-Neumann model of a computer? (b) Identify the following components as part of Control Unit, Processing Unit, Memory Unit or Input/Output Unit of a computer based on the von-Neumann model: i) Keyboard ii) Instruction Register iii) Temporary register iv) Memory Address Register [2 + 4 x 0.5 = 4]

Q. 4. Explain the different addressing modes available in LC-2 Instruction Set using STORE instruction (or its variations). [6] Q. 5. Consider the following LC-2 assembly program fragment: .ORIG x3000 AND R2, R2, #0 ADD R2, R2, #4 LOOP BRz DONE ADD R2, R2, #-1 ADD R3, R3, R3 BRnzp LOOP DONE HALT .END [3+2+1=6]

a) The program is intended for shifting R3 to the left by 4 bits, but has an error in it. Identify the error and explain how to fix it.

b) Show the symbol table corresponding to this program after it has gone through the first phase of the assembler. c) Explain the role of .ORIG pseudo-op in the above program. Q.6. (a) (b) Differentiate between an interpreter and a compiler. Give 1 argument each in favor of and against the following statement: It is better to program in a high-level programming language than in an assembly programming language. [2+2=4] Q. 7. Give a flow-chart for checking whether a given character occurs in a sequence of characters. Assume that your target machine is LC-2, the input character is stored in register R1, the starting address of the input sequence is stored in R2 and you need to store the result (0 or 1) in R3. [6] Q. 8. Which of the following are valid declarations of variables in C? If a declaration is valid, what is the range of values that can be assigned to the variable? If it is not valid, mention a reason. Assume a 32-bit machine. (i) (ii) (iii) (iv) unsigned int x; int y; char int z; typedef char;

[4]

_________

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy