Question 1: Write a program to print the following pattern:
a) 1 b) 1
1 2 2 2
1 2 3 3 3 3
1 2 3 4 4 4 4 4
1 2 3 4 5 5 5 5 5 5
Question 2: Declare two arrays A and B, find (i) A intersection B and (ii) A union B.
Question 3: Write a program to crypt its input according to a specified transformation scheme. The transformation scheme will consist of two strings: a string of characters and then a string of replacement characters. The idea is that your program replaces every instance of the ith character in the initial string with the (i+2) character (of English alphabets) in the replacement string. When no substitution is defined for a character, the program just passes it through to the output unchanged. Blank spaces and the other symbols remains the same. The program should inform the user of any errors in the transformation scheme. Your program should display the phrase before and after the substitutions have been made.
Example:
Original String: I know C programming.
String after the transformation: K mpqy E rtqitcookpi.
Question 4: Write an interactive program called "DISTANCE CONVERTER" that accepts the distance in millimetres / feet / miles / yards / kilometres and displays its equivalent in metres.
Question 5: Write an interactive program to generate progress reports for the students of class XII (Science group).
Question 1 (covers Block 1)
(a) Perform the following arithmetic operations using binary signed 2?s complement notation for integers. You may assume that the maximum size of integers is of 12 bits including the sign bit. (Please note that the numbers given here are in decimal notation)
i) Add - 512 and 298
ii) Subtract 512 from - 64
ii) Add 1025 and 1023
Please indicate the overflow if it is occurs.
(b) Convert the hexadecimal number: AB CD EF into binary, octal and decimal equivalent.
(c) Convert the following string into equivalent "UTF 8" code - "Copyright sign is © and you must check it prior to using copyrighted material". Are these codes same as that used in ASCII?
(d) Design a logic circuit that takes a four digit binary input, counts the number of 1s in it, and produces it as the output. For example, if the input is 1101, then output will be 11 (as there are three ones in the input). Draw the truth table and use K-map to design the Boolean expressions for each of the output bits. Draw the resulting circuit diagram using AND - OR - NOT gates.
(e) Design a two bit counter (a sequential circuit) that counts as 0, 2, 0, 2... and so on. You should show the state table, state diagram, the k-map for circuit design, logic diagram of the resultant design using D flip-flop.
(f) Design a floating point representation of 16 bits closer to IEEE 754 format. The number should have a biased exponent of 5 bits. You may assume that the mantissa is in normalised form; the exponent bias of 15; and one bit is used for the sign bit in the mantissa. Represent the number (24.125) 10 using this format .
Question 2 (covers Block 2)
(a) A RAM has a capacity of 32 K × 16.
(i) How many data input and data output lines does this RAM need to have?
(ii) How many address lines will be needed for this RAM?
(b) Consider a RAM of 512 words with a word size of 32 bits. Assume that this memory have a cache memory of 8 Blocks with block size of 64 bits. For the given memory and Cache in the statements as above, draw a diagram to show the address mapping of RAM and Cache, if two way set associative memory to cache mapping scheme is used.
(c) Explain which of the Input/output techniques that will be used for the following operations. Also explain the I/O techniques.
(i) Reading data from a keyboard
(ii) Reading data from a file.
(d) Find the average disk access time that reads or writes a 1024 byte sector. Assume that the disk rotates at 18000 rpm; each track of the disk has 128 sectors and data transfer rate of the disk is 100 MB/second. (Please calculate data transfer time, assume a suitable seek time and calculate the average latency time).
(e) What is the purpose of FAT in Windows? What construct do you use in Linux/Unix instead of FAT? Explain the differences between the two.
(f) Define each of the following term. Explain the main purpose / use / advantage.
(i) ZBR in the context of disks
(ii) SCSI
(iii) Colour Depth
(iv) Graphics Accelerators
(v) Monitor Resolution
(vi) Active matrix display
Question 3 (Covers Block 3)
(a) Assume that a new machine has been developed which has only 16 general purpose registers, but have a big high speed RAM. The machine uses stack for procedure calls. The machine is expected to handle all the object oriented languages. List four addressing modes that must be supported by such a machine. Give justification of the
selection of each of the addressing modes.
(b) Assume a hypothetical machine that has only PC, AC, MAR, IR, DR and Flag registers. (You may assume the roles of these registers same as that are defined in general for a von Neumann machine) The instructions of this machine can take two operands - one the operand of these must be a register operand. It has an instruction: SUB AC, X; // it performs the operation AC ??AC - Content of location X. Write and explain the sequence of micro-operations that are required to fetch and execute the instruction. Make and state suitable assumptions, if any.
(c) Assume that you have a machine as shown in section 3.2.2 of Block 3 having the micro-operations as given in Figure 10 on page 62 of Block 3. Consider that R1 and R2 both are 8 bit registers and contains 11110101 and 10101001 respectively. What will be the values of select inputs, carry-in input and result of operation if the following micro-operations are performed? (For each micro-operation you may assume the initial value of R1 and R2 as defined above)
1) Decrement R1
2) R1 Exclusive OR R2
3) Subtract R1 from R2 with borrow
4) Shift Right R2
(d) Explain the functions performed by the Micro-programmed Control Unit with the help of diagram Control Units? Also explain the role of sequencing logic component of Control Unit.
(e) What are the advantages of instruction pipeline? Explain with the help of a diagram for a 3 stage instruction pipeline having cycles IFD (Instruction Fetch and Decode), OF (Operand Fetch) and ES (Execute and store results). What can be the problems of such an instruction pipeline?
(f) Assume that a RISC machine has 64 registers out of which 16 registers are reserved for the Global variables. Assuming that 8 of the registers are to be used for one function, explain how the remaining registers will be used as overlapped register windows. How will these registers be used for parameter passing for subroutine calls? Explain with the help of diagram.
Question 4
(a) Write a program in 8086 assembly Language (with proper comments) to find if a given sub-string is prefix of a given string. For example, the sub-string "Assembly" is the prefix in the string "Assembly Language Programming." You may assume that the sub-string as well as the string is available in the memory. You may also assume that the end of the strings is the character „$?. Make suitable assumptions, if any.
(b) Write a program in 8086 assembly language to convert a two digit packed BCD number into equivalent ASCII digits. Your program should print the two ASCII digits. You may assume that the BCD number is in the AL register.
(c) Write a simple subroutine that receives one parameter value. The subroutine checks if the passed parameter value is 0 or otherwise. In case, the value is 0 then it prints FALSE, otherwise it prints TRUE. Make suitable assumptions, if any.
Assembly Language Programming Lab
Question 1: (a) Write a program in assembly language to calculate and display the product if first number is greater than second number else calculate and display the subtraction of first number and second number.
(b) Develop and execute an assembly language program to find the Cube of a given number.
(c) Write a program in assembly language for finding the second smallest number in an array of 10 elements.
(d) Write an assembly language program to determine the number of characters/numbers in a string.