Google Answers Logo
View Question
 
Q: Java and C++ programming ( No Answer,   2 Comments )
Question  
Subject: Java and C++ programming
Category: Computers
Asked by: podukandi-ga
List Price: $20.00
Posted: 24 May 2005 11:21 PDT
Expires: 25 May 2005 06:28 PDT
Question ID: 525087
In three paragraphs or so, discuss why one cannot build a predictive
parsing table for a grammar that does not terminate using the
recursive descent parsing method.

Explain the difference in text as well as code fragments between
inheritance of interface and inheritance of implementation. Show the
mechanisms for each in Java and C++ where they exist. What
mechanism(s) in C++ and Java may be  used when you want to have a
class that uses both inheritance of interface and inheritance of
implementation.?

Is it always possible to compute the FIRST and FOLLOW sets with one
pass through a grammar, possibly rearranging productions? If so
explain why. If not produce a grammar that illustrates why it can?t be
done.

Consider the HashMap class in Java (similar to HashTable we spoke
about in class) with methods :
Object
get(Object key) 

Object
put(Object key, Object value) 


a)	Give a rationale for the  signatures of get and put

b)	Suppose I want to put something that is not an Object into a
HashMap instance, how would that be done? Briefly explain and
illustrate with an original code fragment.

Consider the HashMap question above. Consider the following code fragment

public interface Rabbit{
	void eat ( );
	void hop( )}

class  Bunny {
	public Bunny() { }  // does nothing for now
	public void eat ( ) {
	   // does whatever
	}
	public void hop ( ) {
	 // does whatever else
	}
	
	public Boolean isCute () {
	   returns true;
	} 
}


class  KillerRabbit {
	public KillerRabit() { }
	public void eat ( ) {
	   // does whatever
	}
	public void hop ( ) {
	 // does whatever else
	}
	
	public Boolean isCute () {
	   returns false;
	} 
}

HashMap rabbits= new HashMap();   // make the 

Bunny pinky  = new Bunny ();
Bunny killer = new KillerRabbit ();

// put them in the hash table
rabbits.put(?pinky?, pink);
rabbits.put(?killa?, killer);

// What?s wrong  with the line below ? if anything?  - part a
Bunny b = rabbits.get(?pinky?); 

// What?s wrong  with these lines ? if anything? - part b
Rabbit kr = (Rabbit)rabbits.get(?killa?);
kr.isCute();
a) 

b)

List five or more differences between arrays in Java and arrays in C++
 with a brief explanation and very short fragment to illustrate. Hint:
 for one of the five differences:

This code fragment is completely legal in Java
	Object o = new int[10];

a)
b)
c)
d)
e)

a) What is the BNF for an even length sentence containing only a?s and
b?s, that oscillates between a and b (e.g first a then b then a then b
??, or  first b , then a , then b then a  ?)

Examples:	abab   	ba	babababa
Answer  
There is no answer at this time.

Comments  
Subject: Re: Java and C++ programming
From: yiferic-ga on 24 May 2005 14:24 PDT
 
Way too difficult to be a $2 question
Subject: Re: Java and C++ programming
From: podukandi-ga on 24 May 2005 16:04 PDT
 
Willing to pay $15

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy