English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Given the following information about a computer program, find the mistake. There is an un declared variable or there is a syntax error in the first five lines. If there is a syntax error in the first five lines, then there is a missing semi-colon or variable mame is misspelled. There is no missing semi-colon. There is no mispelled variable name.What is the mistake in the program?

2007-07-25 05:40:23 · 4 answers · asked by tony10 1 in Science & Mathematics Mathematics

4 answers

There are 3 options
A) Undeclared variables
B) Syntax error AND missing ;
C) Syntax error AND misspelled name

It's not B and C, so it has to be A.

2007-07-25 06:31:45 · answer #1 · answered by Dr D 7 · 0 0

Let
U be the statement that "there is an undeclared variable."
S be the statement that "there is a syntax error."

SM: "there is a missing semi-colon"
VN: "variable name is misspelled"

Given,
1. If (S ) then (SM) or (VN )
Take negative of the above.
if (not S) then (not SM) and (not VN)

2. (not SM) and (not VN)
==> not S (that is there is no syntax error)

3. Since we have two choices: either U or S.
But (2) proves that (not S)
so the conclusion must be (U)
or "there is an undeclared vairable."

2007-07-25 12:57:16 · answer #2 · answered by buoisang 4 · 0 0

You have two choices - syntax error or undeclared variable. You are told the two conditions for a syntax error and are told neither one is present. Hence, has to be an undeclared variable.

2007-07-25 12:44:13 · answer #3 · answered by nyphdinmd 7 · 1 0

u or s
s --> m or v
not m
not v
therefore not s
therefore u

2007-07-25 12:44:21 · answer #4 · answered by John V 6 · 0 1

fedest.com, questions and answers