Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Multiple Choice]Valid data type

  1. Oct 4, 2014 #1
    hey guys im learning greenfoot programming in college. I found out one multiple choice question that make me quite confused.

    Which of the following is a valid data type?
    A. integer
    B. floating
    C. boolean
    D. number

    Why is the answer option C?
    I think that integer, floating and boolean are all valid data type....

    Would someone like to explain it please? Thank you!
     
  2. jcsd
  3. Oct 4, 2014 #2

    Filip Larsen

    User Avatar
    Gold Member

    I guess that the question is related to a specific programming language and you are supposed to answer which of the four is a valid data type in that language. For instance, for Java, answer C would be correct as the three others are not valid native data types in Java.
     
  4. Oct 4, 2014 #3

    jtbell

    User Avatar

    Staff: Mentor

    Your question puzzled me at first because I had never heard of a programming language named "Greenfoot." A bit of searching revealed that Greenfoot is actually a programming environment (set of tools and user interface) for the Java language. Don't confuse the language with the tools that you use to write programs in it. There are many ways (sets of tools) that you can write Java programs.

    Anyway, Java does have a floating data type, but it's called "float", not "floating". Actually it has two of them: "float" and "double". They can store data with different precision (number of digits). Similarly, Java doesn't have a type called "integer". There are four integer types, which I'll let you look up for yourself.
     
  5. Oct 4, 2014 #4

    Filip Larsen

    User Avatar
    Gold Member

    Aha! When I read that post I thought "greenfoot" was some kind of slang for beginner .. which I guess it is in some way. At least, Greenfoot do look like a nice environment for beginners to learn programming. Making actors move and interact on screen seems so much more interesting and relevant than the usual type of assignments beginners get when learning Java.
     
  6. Oct 4, 2014 #5

    jtbell

    User Avatar

    Staff: Mentor

    It does remind me of "greenhorn", now that you've jogged my memory. :D
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: [Multiple Choice]Valid data type
Loading...