Question

syntactically correct but semantically incorrect examples in programming?

syntactically correct but semantically incorrect examples in programming?

Homework Answers

Answer #1

Syntactically and semantically. Syntactically means grammatically wrong. In any language if syntax is not valid that comes under syntactically wrong. But if some thing is semantically wrong it means that the syntax is acceptable but meaningless.

For ex:

#include<stdio.h>
int main(){
int x;
printf("%d",x);
}

We define x but there is no any value of x so it can be anything which is called garbage value.

#include<stdio.h>
int main(){
int x;
printf("%d",x)
}

Semicolon is missing in line 4 so this is syntactically wrong.

Another example

#include<stdio.h>
int main(){
int add(int x, int y){
return x-y;
}
printf("%d",add(3,4));
}

This is also semantically wrong but syntactically correct because the add function in the program is for adding purpose but used for finding difference.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Circle “Correct” or “Incorrect” for the following 10 questions. For problems with incorrect answers, provide a...
Circle “Correct” or “Incorrect” for the following 10 questions. For problems with incorrect answers, provide a rationale to support your answer. 1. In administering insulin, the nurse will use the 100 units/mL listed on the drug label to calculate the dose. Correct Incorrect    , Rationale: 2. .U-100 on the insulin label refers to the insulin concentration. Correct Incorrect    Rationale: 3. The physician orders Humalog 6 units subcut now. The nurse has a vial of Novolog insulin. The nurse...
Explain how methods are useful in Programming in General. Provide Examples.
Explain how methods are useful in Programming in General. Provide Examples.
Why are data manipulation, efficiency, and memory useful in programming? Provide specific examples of data manipulation...
Why are data manipulation, efficiency, and memory useful in programming? Provide specific examples of data manipulation using arrays.
“The balance budget multiplier is equal to zero”. Is this statement correct or incorrect? Define the...
“The balance budget multiplier is equal to zero”. Is this statement correct or incorrect? Define the balanced budget multiplier and then explain your answer.
Choose the correct answer and explain each answer why it is correct/incorrect 10/Total surplus in a...
Choose the correct answer and explain each answer why it is correct/incorrect 10/Total surplus in a market will increase when the government imposes a tax on that market.    imposes a binding price floor on that market. removes a binding price ceiling from that market. None of these statements is correct 9/Which of the following will cause an increase in producer surplus?   the imposition of a binding price ceiling in the market    buyers expect the price of the good to be...
Random assignment explain which one is correct and which one is incorrect Can be achieved by...
Random assignment explain which one is correct and which one is incorrect Can be achieved by flipping a coin or using a random number table/generator Requires that every person in the sample has an equal probability of being assigned to any condition. Is used to achieve the goal of initial equivalence a & b & c are correct a & c are correct
  Random assignment explain which one is correct and which one is incorrect Can be achieved by...
  Random assignment explain which one is correct and which one is incorrect Can be achieved by flipping a coin or using a random number table/generator Requires that every person in the sample has an equal probability of being assigned to any condition. Is used to achieve the goal of initial equivalence a & b & c are correct a & c are correct
Draw the structures of the following compounds. If the name provided is incorrect, give the correct...
Draw the structures of the following compounds. If the name provided is incorrect, give the correct name. a. pentoxyethane                      b. 3-chloro-4-methyl-6-heptyne                       c. 2-ene-4-octyne d. 3,4,5-pentanetriol                    e. 1-Methylcyclopentanol                                                      f. 1,3,5-cyclohexatriene
Witch of the following expresions are incorrect? Please correct them a."R" < 6 B. "D" *...
Witch of the following expresions are incorrect? Please correct them a."R" < 6 B. "D" * "5" C. True < "F" D. False >= 7 E. 5.9 \ 4 F. Like a equation: 5= totaltime - 40
a) Write about the correct and incorrect sides Canbay`s Theory on the etiology of Multiple Sclerosis...
a) Write about the correct and incorrect sides Canbay`s Theory on the etiology of Multiple Sclerosis disease, giving supporting with scientific evidences what you have written. b)Add your views on the etiology of Multiple Sclerosis disease.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT