text: Computer Science Archive: Questions from February 29, 2008
  - Anonymous askedi need urhelp in writing mips code of carry look ahead... Show morehi......hope u will bf9??i need urhelp in writing mips code of carry look ahead adder. plz helpbye• Show less0 answers
  - Anonymous asked0 answers
  - Anonymous askeda. What is the changein the stack after int instructions is e... Show more
  Answer the followingQuestions briefly.
  a. What is the changein the stack after int instructions is executed?
  b. Why procedures areused and what must be the last executable instruction ina
  procedure?
  c. Why cli and stiinstructions are used during hooking an interrupt?
  d. What ismultitasking?
  e. What are minimumnumbers of pins required for serial communication? Alsowritetheirnames?
  f.Write validinstruction(s) to perform each function specified below.
  a. Provideinstruction(s) to read a value from port number 0x312.
  b. Provideinstruction(s) to move the value at the top of stack in ipregister.
  c. Provideinstruction(s) to move value of flag register in ax.
  d. Provideinstruction(s) to divide value of ax by 8.
  e. Provideinstruction(s) to write value of al at the port 0x12.• Show less0 answers
  - Anonymous askedbinary of any... Show more
  Write a function"ConvertBinaryToDecimal" that takes the address of a stringcontaining
  binary of any decimalnumber via the stack. The function should print its equivalentdecimal
  number. For example,if the string is "11011" then after the execution of this function,the
  program should print27 and if the string is "1001" then after the execution of thisfunction, the
  program should print9 on the screen.
  (Well commented andwell indented program will be given extra mark)• Show less1 answer
  - Anonymous askedWhy weneed to disable the interrupts while calling interrupt... Show more
  Give theshort answer of the following:
  Why weneed to disable the interrupts while calling interrupt INT80hj.
  Why weneed to disable interrupts before we attempt to change the stack(i.e. ssandsp).• Show less1 answer
  - Anonymous askedAlright, so I am trying to create a program that will take a [m][n]Matrix and multiply it by a [n][p... Show moreAlright, so I am trying to create a program that will take a [m][n]Matrix and multiply it by a [n][p] Matrix, filling each matrix withincreasing values.
  I am having a problem with my function, prototype, and call. I keepgetting the "...not declared in this scope" error and know it hasto do with the syntax I used for my function.
  Below is my code. Can anyone please help me?
  #include <iostream>
  #include <iomanip>
  #include <cmath>
  using namespace std;
  //int multiply(int[][acol],int[][bcol]);
  // void menu();
  int main ()
  {
  int arow(0),acol(0), brow(0),bcol(0);
  int matrix_a[arow][acol];
  int matrix_b[brow][bcol];
  int i(0), j(0);
  int value(0);
  cout << "Please Enter the row dimension for Matrix A"<< endl;
  cin >> arow;
  cout << "Please enter the column dimension for Matrix A"<< endl;
  cin >> acol;
  cout << "Your matrix is: " << arow << " by "<< acol << endl;
  for(i = 0; i < arow; i++)
  for(j = 0; j < acol; j++)
  {
  ++value;
  matrix_a[i][j] = value;
  cout << "The values for Matrix A are: " <<matrix_a[i][j] << endl;
  }
  cout << "Please enter the row dimension for Matrix B.\n"<< "Note: it must equal the column dimension of A" <<endl;
  cin >> brow;
  if ( brow != acol)
  {
  cout << "Matrix multiplication requires inner dimensions ofthe matrices to be equal" << endl;
  cout << "Program exiting" << endl;
  return (0);
  }
  cout << "Please enter the column dimension for Matrix B"<< endl;
  cin >> bcol;
  cout << "Your matrix is: " << brow << " by "<< bcol << endl;
  for(i = 0; i < brow; i++)
  for(j = 0; j < bcol; j++)
  {
  ++temp;
  matrix_b[i][j] = temp;
  cout << "The values for Matrix B are: " <<matrix_b[i][j] << endl;
  }
  // multiply(matrix_a,matrix_b);
  return 0;
  }
  /*
  int multiply(int a[][], int b[][])
  {
  int i, j, k, result = 0;
  double sum, total = 0.0;
  for (i = 0; i < arow; i++)
  for (j = 0; j < bcol; j++)
  {
  sum = 0;
  for (k = 0; k < brow; k++)
  total = 0;
  total = a[i][k]*b[k][j];
  sum = sum + total;
  }
  result[i][j] = sum;
  return result;
  }
  */
  Thank you for your time! • Show less3 answers
  - Anonymous askedDiscuss briefl... Show more
  For each of the following cases, identify which DesignPattern should be used and why?
  Discuss briefly.
  a) There are two objects,“A” and “B”. Both of them are interactingwith each other in such a way that the state of the object“B” depends on the state of the object “A”and it is the responsibility of “B” to synchronize itsstate whenever “A” changes.
  b) A client wants to buildSimulation Software, which is used to show customer the preview ofinterior decoration of rooms. The software presents rooms as objectand it can interact with other objects. These objects, likeTelevision, Sofa etc, can change their state. The client hasdetermined that there can be limited number ofoperations that can be performed on the objects, e.g. a TVcan be placed at either of the walls of the rooms etc. Theinteraction between the objects should be low. • Show less0 answers
  - Anonymous asked(Note: Use the UML... Show more
  Draw the corresponding object model diagram for thefollowing system description.
  (Note: Use the UML Object Model Notation)
  “An online banking system allows customers to managetheir account. Each account has a balance. Customers can deposit toor withdraw from their account. Each deposit or withdrawal iscalled a transaction. Atransaction always has a value and a date. At anytime a customer can see a statement, which is a listing ofeach transaction.” • Show less2 answers
  - Anonymous asked1 answer
  - Anonymous askeddefine the term 1.point to point link,periodicsignal,attenution,wavelength,absoulte bandwith and ban... Show more
  define the term 1.point to point link,periodicsignal,attenution,wavelength,absoulte bandwith and bandwith withexamples?• Show less1 answer
  - Anonymous asked1 answer
  - Anonymous askedYou have just started a new software company. All your employees are recent college graduates;... More »1 answer
  - Anonymous asked1 answer
  - Anonymous askedYou have been testing a code artifact for 11 days and found 2 faults. What does this tell you ... More »0 answers
  - Anonymous askedYou are a member of the SQA group at Ye Olde Fashioned Software. You suggest to your manager t... More »1 answer
  - Anonymous askedWhy is there a need to distinguish between a fault, a failure, and an error? Surely the use of... More »1 answer
  - Anonymous askedSuppose there... Show moreConsider the above figure, in which there is acloud of networkshaving variousnetworks.Suppose there are 7 routersin between HostA and HostB. Identify
  a. Howcome hostA knows theaddresses of allthe routers betweenA toB?
  b. What willbe the value ofthe TTL field whenthe source host A sendsthe datagram7thtimetowards thedestinationB, and the thirdrouter in the path receives thatdatagram?
  c. How manytimes does the source Aneeds to send the datagram so that it finally reaches atdestination host B?
  d. What willbe the value ofthe TTL field whenthe source host A sendsthe datagram4thtimetowards thedestinationB, and thesecond router in thepath receives thatdatagram?e. What willbe the value ofthe TTL field when thesource host A sends thedatagram first timetowards the destinationB, and the firstrouter in the path receives thatdatagram?• Show less1 answer
  - Anonymous askedI have depth function that returns the depth of a givennode. But my function does not work properly.... Show moreI have depth function that returns the depth of a givennode. But my function does not work properly. When the user buildsa tree of size N=5 with the values 10, 3, 12, 5, 20. The value 20has depth 2 and 3 has depth 1, but my code show 20 has depth 1instead of 2 and 3 has depth 2 instead of 1.Can anyone fixthis? My code is below:
  template<typenameT>
  int Tree<T> :: depth(TreeNode<T>* rootNode){
  if (rootNode==NULL){
  return 0;
  }
  else {
  int left_depth =depth(rootNode->left);
  int right_depth = depth(rootNode->right);
  if (right_depth >= left_depth)
  return (right_depth+1);
  return (left_depth+1);
  }
  }
  template<typenameT>
  int Tree<T> :: depth(T value)
  {
  TreeNode<T>* rootNode = find(value);
  return depth(rootNode);
  }
  template<typename T>
  int Tree<T> :: depth()
  {
  return depth(rootNode);
  }1 answer
  - Anonymous askedWrite a program to implement a Binary Tree in C. The program should accept a set of numbers. The num... More »0write a program which calculates the time of day (USEastern Standard... Show morei need some help on this task.write a program which calculates the time of day (USEastern Standard Time) from the time in each of the 5 citiesvisited.output should look something like thislinux1[104] % a.outWhere are you ?• Show less
  1 - London
  2 - Stockholm
  3 - Tampere
  4 - Helsinki
  5 - St. Petersburg
  Your location ?
  Please enter an integer between 1 and 5 : 1
  What time is it ?
  hour ?
  Please enter an integer between 0 and 23 : 22
  minutes ?
  Please enter an integer between 0 and 59 : 15
  22:15 London time is 5:15 PM Eastern
  Actually i did manage to currency converion problem using theswitch statements. Tried to do the same for this one butBut i'm kinda stuck with this. can someone please give mean idea how to do this or try to do this.?1 answer
  - Anonymous askeda) printf(... Show moreAssume: i = 1, j = 2, k = 3, and m = 2. What does eachof the following statements print?a) printf( "%d", i == 1 );b) printf( "%d", j == 3 );c) printf( "%d", i >= 1 && j < 4 );d) printf( "%d", m < = 99 && k < m );e) printf( "%d", j >= i | | k == m );f) printf( "%d", k + m < j | | 3 - j >= k );g) printf( "%d", !m );h) printf( "%d", !( j - m ) );i) printf( "%d", !( k > m ) );j) printf( "%d", !( j > k ) );• Show less2 answers
  - Anonymous askedcreates... Show moreIf anyone can help i needto Create an html document that includes a JavaScriptprogram that creates a new constructor functionnamed Automobile in the document head. Include at least fiveproperties in the object definition, such as make, model, color,engine, seats, and so forth. Then assign the values of your car toeach of the Automobile properties. Print the properties to thescreen.Whoever can help thatwould be much appreciated sincerelykeith0 answers
  - Anonymous askedWrite a program that prints a table of the binary, octal and hexadecimal equivalents of the decimal ... More »1 answer
  - Anonymous askedInstructions are 2 the top and what i've done already regarding the program is down below... Show morex.øi5rong>Instructions are 2 the top and what i've done already regarding the program is down below the instructions.A file contains information about people who have filed with a dating service. The information includes the name, age, sex, weight and income of the person. (The sex is a single character with a value of either ‘f’ or ‘m’. The height and income will be floating point numbers. The age will be an integer.)
  Declare a class of “date” objects which declares variables for this data in a private section.In the public section of the class declare member functions which:Input data from a file stream given as a parameter by reference and store the data in the variables of the object to which the function is applied.
  Print on the screen the data in the object to which the function is applied.
  Return true if the character in a parameter matches the character in the sex variable of the object to which the function is applied.
  Return true if the age specified in a parameter is within 3 years of the age in the object to which the function is applied AND the weight specified in a parameter is within 10 pounds of the weight in the object to which the function is applied.
  Return the amount by which the income specified in a parameter is different from the income in the object to which the function is applied. (NOTE: the value returned should always be positive regardless of whether the income in the object is greater or less than the parameter.)
  In a main function:
  1) Declare an array of 100 date objects and, using the input member function, input data from the file to the objects in the array.
  2) Ask the user for a desired sex, age, weight and income in a potential date.
  3) Print the data on all date objects which matches the requested sex, age and weight.
  4) Print the data on the date object which matches as in step ‘3’ and has the minimum difference between the requested and actual income.5) Repeat steps 2 through 4 until the user responds with ‘x’ for the sex desired.What I've done so far:
  #include "stdafx.h"
  using namespace std;
  #include<iostream>
  #include<fstream>
  /*Declare a class of "date" objects which declares variables for
  this data in a private section.*/
  class date {
  private: //the data inside of an object can't be used by any
  //function except a member function
  char name[4],sex;
  float weight, income;
  int age;
  public: void getdate (ifstream &xx);
  void printdata ( );
  bool sex (char x);
  bool age (int x);
  bool weight (date x);
  void income (date x);
  //returns true if x matches the character in the sex
  //variable of the object to which the function is applied.
  //returns true if x is within 3 years of the age in the
  //object to which the function is applied.
  //returns true if x is within 10 pounds of the weight in
  //the object to which the function is applied.
  };
  int main ( ) {
  char response;
  date dateobjects[100];
  ifstream data;
  int count=0;
  data.open("c:\\temp\\datedata.txt");
  while (!data.eof ( ) ) {
  //dateobjects[count]=getdate(data);
  //dateobjects[count++.getdate(data);
  }
  for (int c=0;c<count;c++)
  dateobjects[c].printdata( );
  cout<<"\nEnter any character to terminate.";
  cin>>response;
  return 0;
  }
  void date::getdate(ifstream &xx) {
  xx>>name>>age>>weight>>income>>sex;
  }
  void date::printdata( ) {
  cout<<"/nName: "<<name<<"Age: "<<age
  <<"Sex: "<<sex<<"Weight: "<<weight
  <<"Income: "<<income;
  }
  bool date::sex(char x) {
  sex=sex+x;
  }
  bool date::age(int x) {
  age=age+x;
  }
  bool date::weight(date x) {
  weight=weight+x
  }
  void date::income(date x) {
  income=income+x
  }1 answer
  - chibba askedcreate a DivAndMod application that prompts the user for twointegers and then displays th... Show moreDirection:create a DivAndMod application that prompts the user for twointegers and then displays the result of integer and modulusdivision in either order. The application output should looksimilar to:Enter an integer: 14Enter a second integer: 414 / 4 = 314 % 4 = 24 / 14 = 04 % 14 = 4----------------------------------------------------------------------------So far i have:• Show lessimport java.util.*;public class Integer{
  public static void main(String[] args)
  {
  Scanner input = newScanner(System.in);
  System.out.print("Enter an integer: ");
  System.out.print("Enter a second integer: ");
  int first = Integer.parseInt(text);
  int second = Integer.parseInt(text);
  int first = first / second;
  int second = first % second;
  System.out.print("Enter an integer:" + first);
  System.out.print("Enter a second integer: " + second);
  }
  }---------------------------------------------------------------------Please help me rewrite the code so that it will work. Also tryto explain why did you add those codes.3 answers
  - Anonymous askedinfo... Show moreheey guys..I'm trying to show the following output here:
  Enter an XML tag on a single line:<info type="employee" status = 'active'/>
  Tag type: empty
  Element name: info
  Attributes:
  type = "employee"
  status = "active"
  here is my code:
  #include <iostream>#include <string>using namespace std;int main(){string s;cout<<"Enter an XML tag on a single line:"<< endl;cin>>s;cout<<"Tag type:"<<endl;if (s.find("/") )cout<<"start"<<endl;elsecout<<"empty"<<endl;cout<<"Element name:"<<endl;int Fpos;Fpos=s.find(" ",1);name=s.substr(1, Fpos);cout<< name<<endl;string name;string a;for(int pos=1; pos<s.length(); pos++){string p;int temp = s.find("=", p[pos]+1);att = s.substr(p[pos]+1, p[pos+1]-p[pos]-1);}cout<<"attributes:" << endl;if(s.find("=") )cout<<a<<endl;elsecout<< "nada" <<endl;return 0;}
  but it's not working :(
  thanks!0 answers
  - Anonymous askedTranslate... Show morePlease help me to translate c++ to MAL . Write thefunction exactly as discribed in this .Translate isPrime() into MAL , arg0 through arg2 shoule be $a0 through $a2 . the result return in $v0.
  #include<iostream>
  using std::cout;
  using std::endl;
  int isPrime(int, int [],int);
  int KnuthP(int, int);
  int main( void ) {
  int prime[500];
  prime[0] = 2;
  int primesCandidate = 3;
  int primesFound = 1;
  while( primesFound < 500 ) {
  if( isPrime( primesCandidate, prime, primesFound )) {
  prime[ primesFound ] = primesCandidate;
  primesFound++;
  }
  primesCandidate += 2;
  }
  for( int i = 0; i < 500; i++ ) {
  cout << prime[ i ] << endl;
  }
  }
  int isPrime(int arg0, int arg1[], int arg2) {
  /**
  * Knuth's P algorithm, which makes use of the fact that if a
  * number n is not prime, there exists d, an even divisor, such
  * that 1 < d < sqrt( n )
  */
  int quotient = arg0;
  int remainder = 0;
  int temp;
  for (int k = 1; k < arg2; k++) {
  temp = KnuthP(arg0, arg1[k]);
  if (temp == 0)
  return 0;
  else if (temp ==1)
  return 1;
  }
  return 1;
  }
  int KnuthP(int arg0, int arg1)
  {
  int remainder, quotient;
  remainder = arg0 % arg1;
  if (remainder == 0) {
  return 0;
  }
  quotient = arg0 / arg1;
  if (quotient <= arg1)
  return 1;
  }0 answers
  - Anonymous askedLet the user enter some text, for example: today isfr... Show morewrite the program to show output as following:Let the user enter some text, for example: today isfriday. and enter keyword like "i"then search for the word in the text.Put parenthesis around every found keyword and outputthe final word.key word : ifinal output: today (i)s fr(i)day.• Show less0 answers