Chat with us, powered by LiveChat programming language concept | Writedemy

programming language concept

programming language concept

You can follow this link, these questions follow this book (chapter 6)

http://smbidoki.ir/courses/66_Concepts%20of%20Programming%20Languages%2010th-Sebesta.PDF

==========================

1.

Character strings in C and C++ are implemented as arrays ofchar. These arrays can be initialized to string constants, as in

charname [] = “freddie”;

The array name will have eight elements, because all strings are terminated with a null character (zero), which is implicitly supplied by the system for string constants.

Arrays of strings in C and C++ can also be initialized with string literals. In this case, the array is one of pointers to characters. For example,

char*names [] = {“Bob”, “Jake”, “Darcie”};

This example illustrates the nature of character literals in C and C++. In the previous example of a string literal being used to initialize thechararray name, the literal is taken to be achararray. But in the latter example (names), the literals are taken to be pointers to characters, so the array is an array of pointers to characters. For example,names[0]is a pointer to the letter ‘B’in the literal character array that contains the characters ‘B’, ‘o’, ‘b’, and the null character.

In Java, similar syntax is used to define and initialize an array of references to String objects. For example,

String[] names = [“Bob”, “Jake”, “Darcie”];

From above it shows one way to create an array of strings in C or C++:

Char *name[] = {“Bob”, “Jake”, “Darcie”};

There is another way to get a similar effect, however:

Char *name[] [7] = {“Bob”, “Jake”, “Darcie”};

Compare these two techniques with respect to ease of use and efficiency.

2.

a. Which class (es) in Java API represented associative array?

b. Which class(es) in the C++ standard library represent associative arrays?

3.

Translate the following Ada record type into Java. Your translation should be as close to the original as possible.

type Employee_Name_Type is
record
First: String(1..20);
Middle: String(l..10);
Last: String(1..20);
end record;

4.

Suppose that L1 is the list ((A B) C D) and L2 is the list ((E) F). give the value of each of the following LISP expression:

1. (CONS (CAR L1) (LIST (CDR L2)))

2. (CONS (CAR (CDR L2)) (CAR L1))

3. (CDR ( CONS (CAR (CONS ‘G L1)) ‘ (H))

4. (LIST (LIST (CAR L1) L2) ‘G)

5.

a. Are the unions in Modula-2 considered to be “free unions”? Explain your answer.

b.

typeShapeis(Circle, Triangle, Rectangle);

typeColorsis(Red, Green, Blue);

typeFigure (Form : Shape)is

record

Filled : Boolean;

Color : Colors;

caseFormis

whenCircle =>

Diameter : Float;

whenTriangle =>

Left_Side : Integer;

Right_Side : Integer;

Angle : Float;

whenRectangle =>

Side_1 : Integer;

Side_2 : Integer;

end case;

end record;

Translate the Ada variant record (above) to Modula-2.

6.

a. what is the purpose of therestrictkeyword in C99?

b. Give an example showing howrestrictis used.

7.

a. Give the minimum size of the following C++ structure, assuming thatcharandboolvalues occupy onebyte,intandfloatvalues occupy four bytes,doublevalues occupy eight bytes, and pointers occupy four bytes.

struct s {

char a;

int b;

bool *c;

char d[5];

union {

int *e[3];

float f;

double g;

};

};

b. Assuming that the structure has its minimum size, what is the offset of each member from the beginning of the structure? ( The offset of a will be 0, for example.) Include the offsets ofe,f, andgin your answer.

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order