What if any, is the syntax error in the following piece of code 01 B PIC A(7) 02 C PIC 9(4) IF(B NUMERIC) ADD 10 TO C a.the condition in the if statement is wrong b.noting is wrong c.because C is initialised.ADD 10 TO C is wrong d.both B and C shoud have same size.

This question is related to TCS Interview

Showing Answers 1 - 3 of 3 Answers

Kiran

  • Apr 5th, 2006
 

Ans:- a(the condition in the if statement is wrong)

For the Variable declared as alphabetic the valid test conditions are

 A IS [NOT]ALPHABETIC

 A IS [NOT]ALPHABETIC-LOWER

 A IS [NOT]ALPHABETIC-UPPER

    Where [NOT] is optional...

sharmilabit

  • Jun 15th, 2006
 

ANS IS b. nothing is wrong....because it won't give any compilation or run time error. its just that the condition won't be satisfied and 10 will not be added to C and since C has not been assigned any value, nothing would be displayed. test it if u have doubt.

  Was this answer useful?  Yes

chandradutt

  • Nov 20th, 2009
 

You are correct that it wont give any compilation or run time error but SYNTAX is definetly wrong. so the correct answer should be 'A.the condition in the if statement is wrong'

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions