Code Challenge 2

Posted on 25. Feb, 2010 by admin in Basics


Up for another code challenge? Since the first code challenge we have covered string functions and conditions. Let’s see how much you know. Again, no cheating!

Questions

Q: Write a line of code combining two string variables, $var and $var2, into $var3.

Show Answer ▼

Q: What is an escape character?

Show Answer ▼

Q: List the 6 most important escape characters we discussed.

Show Answer ▼

Q: Write a line of code that prints the length of this string literal, “How many cookies can I eat?”

Show Answer ▼

Q: What does an else statement do?”

Show Answer ▼

Q: What are 3 differences between if and switch statements?”

Show Answer ▼

Programming Projects

Project One: Write a program that reverses a string if it is more than 10 characters long.

Show Answer ▼

Project Two: Write a program that checks if a string is a palindrome.

Show Answer ▼