Which of the following is true about the puts function?
Question
Which of the following is true about the puts function?
Solution
The puts function is a common function in C and Ruby programming languages. Here are some truths about it:
-
It writes a string to the output (usually your terminal), followed by a newline character. This is true in both C and Ruby.
-
In C,
putsis included in thestdio.hlibrary. You would use it like this:puts("Hello, world!"); -
In Ruby,
putsis a method of the Kernel module, which is included by class Object, so you can use it anywhere. You would use it like this:puts "Hello, world!" -
The
putsfunction returns a value. In C, it returns a nonnegative integer on success and EOF on error. In Ruby, it returnsnil. -
putsautomatically converts non-string values to strings in Ruby. For example,puts 123will output the string "123" followed by a newline. -
putscan take multiple arguments in Ruby. For example,puts "Hello,", "world!"will output two lines, each followed by a newline. -
In C,
putsonly takes one argument, which must be a string. If you want to output multiple lines, you need to include the newline character\nin the string.
Similar Questions
What is the return type of the puts function in C?
A ________ option is an option to purchase a specified number of shares on or before some future date at a specified price, whereas a _______ option is an option to sell a specified number of shares on or before some future date at a specified price. ______ are bought if the share is expected to rise.Question 1Select one:a.put; call; Putsb.call; put; Putsc.call; put; Callsd.put; call; Calls
Which of the following statements is CORRECT?a.Put options give investors the right to buy a stock at a certain strike price before a specified date.b.Call options give investors the right to sell a stock at a certain strike price before a specified date.c.Options typically sell for less than their exercise value.d.An option holder is not entitled to receive dividends unless he or she exercises their option before the stock goes ex dividend.
When the stock price increases with all else remaining the same, which of the following is true? A. Puts increase in value while calls decrease in value. B. Both calls and puts decrease in value. C. Calls increase in value while puts decrease in value. D. Both calls and puts increase in value.
If the spot price is higher than the strike price for a put option, it is said to be:
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.