给出如下代码:
class Book
attr_accessor :author
attr_reader :title
attr_writer :comments
def initialize(author, title)
@author = author
@title = title
@comments = []
end
end
book = Book.new("Chuck Palahniuk", "Fight Club")
下列哪段代码是合法的?
A: "#{book.title} was written by #{book.author}."
B: book.comments
C: book.comments.each { |comment| puts comment }
D: book.title = "Cooking Club"
class Book
attr_accessor :author
attr_reader :title
attr_writer :comments
def initialize(author, title)
@author = author
@title = title
@comments = []
end
end
book = Book.new("Chuck Palahniuk", "Fight Club")
下列哪段代码是合法的?
A: "#{book.title} was written by #{book.author}."
B: book.comments
C: book.comments.each { |comment| puts comment }
D: book.title = "Cooking Club"
举一反三
- 创建存储过程如下:<br/>Create<br/>procedure bookproc<br/>@id<br/>int, @title char(20) output<br/>As<br/>Select<br/>@title=title from book where id=@id<br/>执行该存储过程的方法正确的是()。 A: exec bookproc 1, @title output <br/>print<br/>@title B: exec bookproc @id=1, @title output <br/>print<br/>@title C: declare @title char(20)<br/>exec<br/>bookproc 1, @title output <br/>print<br/>@title D: declare @title char(20)<br/>exec<br/>bookproc @id=1, @title output <br/>print<br/>@title
- 在下面的代码中,b就是一个Book类的一个引用。[br][/br]Book b = new Book();
- 【单选题】下列有关类声明的代码片段,哪一项是正确的? A: package libray;import java.sql.* <br> private String ISBN; <br> class Book { } B: package libray; <br> class Book{ } <br> import java.sql.*; C: package libray; <br> import java.sql.*; <br> class Book { } D: import java.sql.*; <br> package libray; <br> class Book( )
- 在下面的代码中,b就是一个Book类的一个引用。 [br][/br] Book b = new Book();(1.0)
- 若要删除book表中的所有数据,以下语句正确的是() A: DROP<br/>FROM book B: DROP<br/>TABLE book C: DELETE<br/>FROM book D: DELETE<br/>TABLE book