1. Engineering
  2. Computer Science
  3. 1what is wrong with the following conditional statement puts welcome...

Question: 1what is wrong with the following conditional statement puts welcome...

Question details

1,What is wrong with the following conditional statement?

puts “Welcome to CIS199!” if x==1
Missing an “end” keyword in the “if” statement.
None of the choices.
The conditional expression x==1 is not surrounded by the parenthesis ( ).
The “if" keyword should have been replaced with the “unless" keyword.
The conditional expression x==1 should have been written as x=1

2.Ruby interpreter parses code before running it, and makes certain decisions such as allocation of local variables and their assignment to values.

True
False

3.It is OK to use assignment in a conditional test. Assuming x = 0 already, the following two conditional expressions produce the same outcome:

if x = 0
    puts “CIS199”;
end 
if x == 0
    puts “CIS199”;
end 
True
False

4.In a “case" statement, there can be multiple “when” expressions but only one “when" expression will be evaluated.

True
False

5.When comparing two strings, string1 and string2, with ==, the following statement compares both strings character by character:

string1 == string2
True
False

6.It is syntactically correct to have a “case” statement without a test expression such as the following

case
when x == y
    puts “CIS199"
end
True
False
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution