Programming

Programming Questions? Ask a Programmer for Answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

Programming

SECTION A 1. Describe how to implement a compiler language

Customer Question
SECTION A 1. Describe how to...
SECTION A
1. Describe how to implement a compiler for a language in the same language (“bootstrap- ping”).
2. Invent a syntax for an APL-like matrix-based language that uses ordinary characters.
3. Write a list of interesting operations on strings and compare your list with the predefined operations of SNOBOL and Icon.
4. Write a list of interesting operations on sets and compare your list with the predefined operations of SETL.
5. Simulate a (universal) Turing machine in several programming languages.
SECTION B
1. Translate (part of) the BNF syntax of C or Ada into syntax diagrams.
2. Write a program in Pascal or C that compiles and executes, but computes the wrong answer because of a comment that was
not closed.
3. Even if Ada used the style of comments used in C and Pascal, bugs caused by not closing comments would be less frequent.
Why?
4. In most languages, keywords like begin and while are reserved and may not be used as identifiers. Other languages like
FORTRAN and PL/I do not have reserved keywords. What are the advantages and disadvantages of reserved words?
SECTION C
1. Study your compiler’s documentation and list the optimizations that it performs. Write programs and check the resulting object
code for the optimizations.
2. What information does the debugger need from the compiler and linker?
3. Run a profiler and study how it works.
4. How can you write your own simple testing tool? What influence does automated testing have on program design?
5. AdaS is an interpreter for a subset of Ada written in Pascal. It works by compiling the source into P-Code and then executing
the P-Code. Study the AdaS program and write a description of the P-Code machine.
SECTION D
1. Read your compiler documentation and list the precisions used for the different integer types.
2. Write 200 + 55 = 255 and 100 −150 = −50 in two’s complement notaƟon.
3. Let a take on all values in the ranges 50…,56 and −56..−50,and let b be either 7 or−7. What are the possible quoƟents q and
remainders r when a is divided by b? Use both definitions of remainder (denoted rem and mod in Ada), and display the results
in graphical form. Hint: if rem is used, r will have the sign of a; if mod is used, r will have the sign of b.
4. What happens if you execute the following C program on a computer which stores short int values in 8 bits and int values
in 16 bits?
Cshort int i; int j = 280; for (i = 0; i ¡ j; i++) printf(”Hello world”);
5. If a non-standard representation of an enumeration type is used, how would you implement the Ada attribute T’Succ(V)?
6. What will the following program print? Why?
Cint i = 2; int j = 5; if (i & j) printf(”Hello world”); if (i && j) printf(”Goodbye world”);
7. What is the value of i after executing the following statements?
Cint i = 0; int a[2] = {10,11}; i = a[i++];
8. C and C++ do not have an exponentiation operator; why?
9. Show how modular types in Ada 95 and unsigned integer types in C can be used to represent sets. How portable is your
solution? Compare with the set type in Pascal.
10. Given an arithmetic expression such as:
(a + b) * (c + d)
Java specifies that it be evaluated from left to right, while C++ and Ada allow the compiler to evaluate the sub-expression in
any order. Why is Java stricter in its specification?
11. Compare the final construct in Java with constants in C++ and Ada.
SECTION E
1. Does your compiler pack record fields or align them on word boundaries?
2. Does your computer have a block-copy instruction, and does your compiler use it for array and record assignments?
3. Pascal contains the construct with which opens the scope of a record so that the field names can be used directly:
Pascaltype Rec = record Field1: Integer; Field2: Integer; end; R: Rec;
with R do Field1 := Field2;(* OK, direct visibility *)
What are the advantages and disadvantages of the construct? Study the Ada renames con- struct and show how some of
the same functionality can be obtained. Compare the two constructs.
4. Explain the error message that you get if you try to assign one array to another in C:
Cint a1[10], a2[10]; a1 = a2;
5. Write sort procedures in Ada and C, and compare them. Make sure that you use attributes in the Ada procedure so that the
procedure will work on arrays with arbitrary indices.
6. Which optimizations does your compiler do on array indexing operations?
7. Icon has associative arrays called tables, where a string can be used as an array index:
count[”begin”] = 8; Implement associative arrays in Ada or C.
8. Are the following two types the same?
Adatype Array Type 1 is array(1..100) of Float; type Array Type 2 is array(1..100) of Float;
Ada and C++ use name equivalence: every type declaration declares a new type, so two types are declared. Under structural
equivalence (used in Algol 68), type declarations that look alike define the same type. What are the advantages and
disadvantages of the two approaches?
9. An array object of anonymous type (without a named type) can be defined in Ada. In the following example, is the assignment
legal? Why?
AdaA1, A2: array(1..10) of Integer; A1 := A2;
10. Compare the string processing capabilities of Ada 95, C++ and Java.
SECTION F
1. Does your compiler implement all case-/switch-statements the same way, or does it try to choose an optimal implementation
for each statement?
2. Simulate a Pascal repeat-statement in Ada and C.
3. The original definition of FORTRAN specified that a loop is executed at least one time even if the value of low is greater than
the value of high! What could motivate this design?
4. The sequential search in C:
Cwhile (s.data != key) i++;
might be written as follows:
Cwhile (s[i++].data != key) ; /* Null statement */
What is the difference between the two computations?
5. Suppose that Ada did allow an index variable to exist after the scope of the loop. Show how optimization of a loop would be
affected.
6. Compare the code generated for a search implemented using a break- or exit-statement with the code generated for a sentinel
search.
7. Write a sentinel search using do-while rather than while. Is it more efficient?
8. Why did we put the sentinel at the beginning of the array rather than at the end?
9. (Scholten) The game of Go is played with stones of two colors, black and white. Suppose that you have a can with an unknown
mixture of stones and that you execute the following algorithm:
Adawhile Stones Left in Can loop Remove Two Stones(S1, S2); if Color(S1) = Color(S2) then Add
Black Stone; else Add White Stone; end if; end loop;
Show that the loop terminates by identifying a value which is always decreasing but always non-negative. Can you say
anything about the color of the last stone to be removed? (Hint: write a loop invariant on the number of white stones.)
Submitted: 2 years ago.Category: Programming
Show More
Show Less
Ask Your Own Programming Question
Customer reply replied 2 years ago
Please see the questions on the attachments for clarity, thanks!
Customer reply replied 2 years ago
Here are the questions in their original format, just in case you needed to do any cross-checking. Thanks
Customer reply replied 2 years ago
I've reduced the number of questions. Hope this will do for my current offer! Thanks!
Answered in 4 days by:
8/31/2015
Programmer: educatortech, Specialist replied 2 years ago
educatortech
educatortech, Specialist
Category: Programming
Satisfied Customers: 5,240
Experience: M.A., M.S. Education / Educational Administration
Verified

Hello, my name is Greg.

I see this might be time sensitive.

Do you still need this answered?

Ask Your Own Programming Question
Customer reply replied 2 years ago
sir, I still do need these answered, please! I'm runnung out of time, and I'm supposed to submit those answers first thing tomorrow morning! Thanks a million!
Customer reply replied 2 years ago
sir, I still do need these answered, please! I'm running out of time, and I'm supposed to submit those answers first thing tomorrow morning! Thanks a million!
Programmer: educatortech, Specialist replied 2 years ago

After going through my resources, I do not have what is necessary to complete at this time.

I am opting out and opening up to the other professionals and messaging a couple who might be able to help.

Someone should be with you shortly.

Ask Your Own Programming Question
Ask educatortech Your Own Question
educatortech
educatortech
educatortech, Specialist
Category: Programming
Satisfied Customers: 5,240
5,240 Satisfied Customers
Experience: M.A., M.S. Education / Educational Administration

educatortech is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,131 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

800 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
This is a follow-on to a previous session on the ProgressBar
This is a follow-on to a previous session on the ProgressBar in Visual Basic 2008. I've been working with a short test code to learn how to make it work reliably so I can incorporate it into a larger … read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
I need some help with my excel query, I have an excel
I have an excel workbook with several sheets. One sheet (ClientTbl) is set up as the parent table and all other sheets (each on separate tab) are set up as the child tables, i.e AddressTbl, EmployTbl, etc... The reason for this is that due to the nature of our contact with clients, it is likely that their address will change from one contact to the next or they will change employer from one contact to the next. Within the child tables, the date and time the information is entered is automatically record. I need to create a query to create one CURRENT record for each client and would like to take advantage of the pre-record date/time filed to ONLY report the record from each table that is the most recent. How would I go about doing this? I have put sample tables below ClientTblID LastName FirstName 1 Doe JohnAddressTblID Address Date 1 15 N. Somewhere Ave 11/1/2017 1*****11/27/2017EmployTblID Employer Date 1 Brown Company 10/20/2017 1 Orange Group 11/21/2017Desired Query Results:ID LastName FirstName Address Date Employer Date 1 Doe John*****11/27/2017 Orange Group 11/21/2017Any help you can provide would be appreciated! Thank you!!! … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
I need to learn Pascal. I have no programming experience,
I need to learn Pascal. I have no programming experience, but I have become involved in a business where the primary program is written in Pascal. There seems to be no compelling reason to re-write th… read more
Russell H.
Russell H.
computer technology consultant
Vocational, Technical or Trade Scho
780 satisfied customers
I am working on the content slider and I am having problems.
Hi, I am working on the content slider and I am having problems. I love how it works for the most part, I just need to adjust the following:1) After the last slide, I would like it to return back to t… read more
George Sibiya
George Sibiya
PhD
216 satisfied customers
I don't know much about php, but I am trying to fix a bug in
Hello, I don't know much about php, but I am trying to fix a bug in my website, www.woodfactory.ch. There are different product categories and each one has a page. The title of the page should be equa… read more
Michael Minewyelet
Michael Minewyelet
Information System Assistant
Bachelor's Degree
11 satisfied customers
On microsoft visual studio C++ The only change to the
On microsoft visual studio C++ The only change to the Employee class is that there is a new attribute: +benefit : Benefit Notice that there is a "+" for this attribute, meaning that it is public. Make… read more
George Sibiya
George Sibiya
PhD
216 satisfied customers
I have run into problems with excel 2016. I have written a
I have run into problems with excel 2016.I have written a macro that gets data from data source which works fine, then I create maybe 150 files to report on that data (per customer). The macro works f… read more
George Sibiya
George Sibiya
PhD
216 satisfied customers
How can I remove macros with their shortcut keys and start
How can I remove macros with their shortcut keys and start over? … read more
R LAFAYETTE
R LAFAYETTE
Intel Technology Provider 2017 GOLD
37 satisfied customers
I'm not sure. I've got a problem with a VBA code I'm trying
I'm not sure. I've got a problem with a VBA code I'm trying to generate. Do you have any experience in that? … read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
I have a few small java programs that I could use your help
Hi George, I have a few small java programs that I could use your help on. I have attached a zip file with a PDF of instructions, and all needed files.… read more
George Sibiya
George Sibiya
PhD
216 satisfied customers
There seems to be a bug in excel and "round" is not working.
Hello. there seems to be a bug in excel and "round" is not working. it does not round correctly … read more
Kris R
Kris R
IT Manager
Computing
2,596 satisfied customers
PHP Yii and twig help. Need to install Yii PHP framework and
PHP Yii and twig help. Need to install Yii PHP framework and include twig and 2 extensions.… read more
George Sibiya
George Sibiya
PhD
216 satisfied customers
I need help with Excel. I have 2 macros that I wrote and are
I need help with Excel. I have 2 macros that I wrote and are in my personal folder that I need to make available to other computers through a server. I also have excel spreadsheets that get a "bug" er… read more
The-PC-Guy
The-PC-Guy
Software Engineer
Bachelor's Degree
800 satisfied customers
I have little experience in Excel. I have a spread sheet
I have little experience in Excel. I have a spread sheet where I have to manually count the number of times a person is entered to work during the week. … read more
Michael Hannigan
Michael Hannigan
Bachelor\u0027s Program
239 satisfied customers
Expired articles are not coming down when they expire. They
Expired articles are not coming down when they expire. They are not visible in my Admin, but others can still see them with the old links. … read more
George Sibiya
George Sibiya
PhD
216 satisfied customers
To Sibiya: I get error "Access Violation writing location
To George Sibiya: I get error "Access Violation writing location 0x00900000 when I compile a .c file.… read more
George Sibiya
George Sibiya
PhD
216 satisfied customers
I need the program in this description coded in C. I don't
Hi I need the program in this description coded in C. I don't not need the detailed description as I can do that myself but I will need the program written in C.… read more
Bruce Wilner
Bruce Wilner
Master of Engineering
27 satisfied customers
I have created a VB C# database program. I am unable to
I have created a VB C# ***** program. I am unable to input data into the data fields I created. I also need to add a log-in and password ***** at the beginning database program using a generic login a… read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,131 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x