参考答案和解析
正确答案:A
更多“An operator is asked to rewind a”相关问题
  • 第1题:

    ( 33 )将运算符 “ + ” 重载为非成员函数,下列原型声明中,错误的是

    A ) MyClock operator + (MyClock,long);

    B ) MyClock operator + (MyClock,MyClock);

    C ) MyClock operator + (long,long);

    D ) MyClock operator + (long,MyClock);


    正确答案:C

  • 第2题:

    如果表达式-x/y中的“--”和“/”是作为友元函数重载的运算符,采用运算符函数用格式,该表达式还可表示为( )。

    A.operator/(x.operator--(),y);

    B.operator/(operator--(x),y);

    C.x.operator--().operator/(y);

    D.y.operator/(operator--(x));


    正确答案:B
    解析: 本题考核运算符的重载。假定已经作为某个类的成员函数重载了二元运算符+,且c1、c2都是该类的对象,则c1。operator+(c2)与c1+c2含义相同。如果+作为该类的非成员函数重载,则operator+(c1,c2)与c1+c2含义相同。同理,运算符“/”作为友元函数重载,则(--x)/y与表达式operator/((--x),y)相同。前缀运算符“--”作为友元函数重载,则--x与operator--(x)相同,所以组合起来是operator/(operator-(x),y);,即B选项。

  • 第3题:

    如果在表达式++x/y中,++是作为友元函数重载的,/是作为成员函数重载的,则该表达式还可为

    A.(operator++(x) ) .operator/(y)

    B.(operator++(0) ) .operator/(y)

    C.operator/((operator++(x,0) ) ,y)

    D.operator/((operator++(0) ) ,y)


    正确答案:A
    解析:C++中用成员函数重载++x为:x. operator++( ) ,用友元函数重载++x为:operator ++(x) ,用成员函数重载x/y为:x. operator/(y) ,用友元函数重载x/y为:operator/(x, y) 。

  • 第4题:

    如果表达式y*x++中,“*”是作为成员函数重载的运算符,“++”是作为友元函数重载的运算符,采用运算符函数调用格式,该表达式还可表示为

    A.x.operator++(0).operator*(y);

    B.operator*(x.operator++(0),y);

    C.y.operator*(operator++(x,0))

    D.operator*(operator++(x,0),y)


    正确答案:C
    解析:本题考核运算符的重载。假定已经作为某个类的成员函数重载了二元运算符+,且c1,c2都是该类的对象,则c1.operator+(c2)与c1+c2含义相同。如果+作为该类的非成员函数重载,则operator+(c1,c2)与c1+c2含义相同。同理,运算符*作为成员函数重载,则y*(x++)与 y.operator*(x++)含义相同,后缀++作为友元函数重载,那么x++与operator++(x,0)含义相同,所以选项 C是正确的。

  • 第5题:

    An operator is asked to rewind and eject a tape from a system. Which command will accomplish this without touching the tape drive?()

    A. tctl reset

    B. tctl rewind

    C. tctl return

    D. tctl rewoffl


    参考答案:A

  • 第6题:

    An operator has been asked if a system was rebooted. Which of the following commands should be used to determine if a reboot has occurred?()

    A. The name?command.The ?name?command.

    B. The ptime?command.The ?ptime?command.

    C. The hutdown ast?command.The ?hutdown ?ast?command.

    D. The ?etc/rc.shutdown?command.


    参考答案:B

  • 第7题:

    Which configuration command builds a read-write SNMP community named operator?()

    • A、Snmp-server community operator.
    • B、Snmp-server operator community.
    • C、Snmp-server community operator rw.
    • D、Snmp-server operator community rw

    正确答案:C

  • 第8题:

    An operator is asked to shutdown the telnet service for security reasons. What are the appropriate commands to achieve this?()

    • A、comment out telnetd in /etc/services refresh -s inetd
    • B、comment out telnetd in /etc/inetd.conf refresh -s inetd
    • C、comment out telnetd in /etc/rc.tcpip refresh -s telnetd
    • D、comment out telnetd in /etc/inetd.conf refresh -s telnetd

    正确答案:B

  • 第9题:

    An operator has been asked if a system was rebooted. Which of the following commands should be used to determine if a reboot has occurred?()

    • A、The name?command.The ?name?command.
    • B、The ptime?command.The ?ptime?command.
    • C、The hutdown ast?command.The ?hutdown ?ast?command.
    • D、The ?etc/rc.shutdown?command.

    正确答案:B

  • 第10题:

    单选题
    Which configuration command builds a read-write SNMP community named operator?()
    A

    Snmp-server community operator.

    B

    Snmp-server operator community.

    C

    Snmp-server community operator rw.

    D

    Snmp-server operator community rw


    正确答案: B
    解析: 暂无解析

  • 第11题:

    填空题
    C标准库函数rewind的作用是()

    正确答案: 使读写指针指向文件的开头
    解析: 暂无解析

  • 第12题:

    单选题
    An operator has been asked if a system was rebooted. Which of the following commands should be used to determine if a reboot has occurred?()
    A

    The name?command.The ?name?command.

    B

    The ptime?command.The ?ptime?command.

    C

    The hutdown ast?command.The ?hutdown ?ast?command.

    D

    The ?etc/rc.shutdown?command.


    正确答案: D
    解析: 暂无解析

  • 第13题:

    如果表达式--x/y中的“--”和“/”是作为友元函数重载的运算符,采用运算符函薮调用格式,该表达式还可表示为( )。

    A.operator/(x.operato--(), y);

    B.operator/(operator--(x), y);

    C.x.operator--().operator/(y);

    D.y.operator/(operator--(x));


    正确答案:B
    解析:运算符重载实际上时函数的重载。重载运算符的一般格式:函数类型operator运算符名称(参数表)。重载运算符之后:函数operator+重载运算符“+”。“-”重载为“operator--;”,“/”重载为“operator/”。另外重载不能改变运算的优先级,-x/y计算--x后,除以y,所以表达式改写为:operator/(operator--(x),y);。

  • 第14题:

    将x+y*z中的“+”用成员函数重载,“*”是友元函数重载应写为( )。 A.operator+(operator*(y,z))SX

    将x+y*z中的“+”用成员函数重载,“*”是友元函数重载应写为( )。

    A.operator+(operator*(y,z))

    B.x.operator+(operator*(y,z))

    C.x.operator+(X*(y,z))

    D.x+(operator*(y,z))


    正确答案:B
    B。【解析】在定义了重载运算符后的函数后,函数operator+重载了运算符“+”。如果在类以外的其他地方定义了一个函数,在类体中用friend对该函数进行声明,此函数就称为本类的友元函数。“*”用友元函数重载就是运算符函数不作为成员函数,而把它放在类外,“*”被改写为“operator*”。“+”为成员函数重载,X.operator+。所以“x+y*z”被改写为“x.operator+(operator*(y,z))”。

  • 第15题:

    如果表达式++x/y中,+ +是作为友元函数重载的,/是作为成员函数重载的,则该表达式还可为( )。

    A.(operator + +(x)).operator/(y)

    B.(operator + +(0)).operatr/(y)

    C.operator/((operator + + (x,0)),y)

    D.operator/((operator + + (0)),y)


    正确答案:A

  • 第16题:

    如果表达式++x/y中,++是作为友元函数重载的,/是作为成员函数重载的,则该表达式还可为( )。

    A.(operator++(x)).operator/(y)

    B.(operator++(0)).operatr/(y)

    C.operator/((operator++(x,0)),y)

    D.operator/((operator++(0)),y)


    正确答案:A

  • 第17题:

    An operator wants to move all files inside the directory /home/operator to the current directory. Which of the following commands will complete the task?()

    A. mv /home/operator .

    B. mv /home/operator/* .

    C. mv /home/operator ../..

    D. mv /home/operator/all ../home/operator


    参考答案:B

  • 第18题:

    C标准库函数rewind的作用是()


    正确答案:使读写指针指向文件的开头

  • 第19题:

    如果表达式++j*k中的“++”和“*”都是重载的友元运算符,则采用运算符函数调用格式,该表达式还可以表示为()

    • A、operator*(j.operator++(),k)
    • B、operator*(operator++(j),k)
    • C、operator++(j).operator*(k)
    • D、operator*(operator++(j),)

    正确答案:B

  • 第20题:

    An operator wants to move all files inside the directory /home/operator to the current directory. Which of the following commands will complete the task?()

    • A、mv /home/operator .
    • B、mv /home/operator/* .
    • C、mv /home/operator ../..
    • D、mv /home/operator/all ../home/operator

    正确答案:B

  • 第21题:

    Which of the following will occur if an operator types the command vi file.out?()

    • A、If the file exists it will be opened for editing. If the file does not exist an error message will be displayed.
    • B、If the file exists it will be opened for editing. If the file does not exist a new file with the name file.out will be created and opened for editing.
    • C、If the file exists an error message will be displayed. If the file does not exist a new file with the name file.out will be created and opened for editing.
    • D、If the file exists the operator will be asked whether to open the file or overwrite the file. If the file does not exist a new file with the name file.out will be created and opened for editing.

    正确答案:B

  • 第22题:

    单选题
    如果表达式--x/y中的“--”和“/”是作为友元函数重载的运算符,采用运算符函数调用格式,该表达式还可表示为(  )。
    A

    operator/(x.operator-(),y);

    B

    operator/(operator--(x),y);

    C

    x.operator--().operator/(y);

    D

    y.operator/(operator--(x))


    正确答案: C
    解析:
    重载运算符的一般格式:函数类型operator运算符名称(参数表)。重载运算符不能改变运算符的优先级,因此--x/y先计算--x,再除以y,所以表达式改写为:“operator/(operator--(x),y);”。

  • 第23题:

    单选题
    An operator is asked to rewind and eject a tape from a system. Which command will accomplish this without touching the tape drive?()
    A

    tctl reset

    B

    tctl rewind

    C

    tctl return

    D

    tctl rewoffl


    正确答案: C
    解析: 暂无解析

  • 第24题:

    单选题
    将x+y*z中的“+”用成员函数重载,“*”用友元函数重载应写为(  )。
    A

    operator+(operator*(y,z))

    B

    x.operator+(operator*(y,z))

    C

    x.operator+(x*(y,z))

    D

    x+(operator*(y,z))


    正确答案: B
    解析:
    函数operator+重载了运算符“+”。“*”用友元函数重载就是运算符函数不作为成员函数,而把它放在类外,“*”被改写为“operator*”。“+”为成员函数重载,x.operator+。所以x+y*z被改写为“x.operator+(operator*(y,z))”。