Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

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.

 

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M9132179

Have any Question?


Related Questions in C/C++

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As