网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
4、在JSP中,test.jsp文件如下,试图运行时,将发生()。 <html> <% String str = null;%> str is <%= str%> </html>
A.运行后,浏览器上显示:str is
B.编译Servlet源码时发生错误
C.执行编译后的Servlet时发生错误
D.运行后,浏览器上显示:str is null
参考答案和解析
翻译期错误
更多 “4、在JSP中,test.jsp文件如下,试图运行时,将发生()。 <html> <% String str = null;%> str is <%= str%> </html>A.运行后,浏览器上显示:str isB.编译Servlet源码时发生错误C.执行编译后的Servlet时发生错误D.运行后,浏览器上显示:str is null” 相关考题
考题
已知String str=new String ("Luck");,则下列关于str的操作中不合法的是( )。A.String s=str. toUpperCase()B.int i=Str. length;C.char s=str. charAt(2);D.String s="Good" +str;
考题
设有语句:char str1[]="string",str2[8],*str3,*str4="string";,则下列对库函数strcpy调用不正确的是A.strcpy(str1,"Hello1");B.strcpy(str2,"Hello2");C.strcpy(str3,"Hello3");D.strcpy(str4,"Hell04");
考题
设有以下语句: char str1[]="string",str2[8],*str3,*str4=="string; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4")
考题
设有以下语句: char str1 []="string"mstr2 [8],*str3,*str4=="string"; 则 ______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str 4,"HELLO4");
考题
publicstaticvoidmain(String[]args){Stringstr=null?;if(str==null){System.out.println(”null”);}else(str.length()==0){System.out.println(”zero”);}else{System.out.println(”some”);}}Whatistheresult?()
A.nullB.zeroC.someD.Compilationfails.E.Anexceptionisthrownatruntime.
考题
下面代码的运行结果是( )。 public class ConcatTest { public static void main (String[ ] args) { String str1 = "abc"; String str2 = "ABC"; String str3 = str1. coneat(str2); System. out. println(str3); } }A.abcB.ABCC.abcABCD.ABCabc
考题
设有以下语句: char strl[]="string",str2[8],*str3,*str4="string"; 则_______不是对库函数的正确调用。A.strcpy(strl,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4");
考题
下列( )语句是声明一个含有10个String对象的数组。A.char str [];B.char str [] [];C.String str[]=new String[10];D.String str[10];
考题
下面是一个Applet程序,其功能是捕捉用户所按下的键,并将捕捉到的键时间,传给程序,程序再将所按下的字符显示在Applet中。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。注意:不改动程序的结构,不得增行或删行。程序运行结果如下:import java.awt.*;import java.applet.*;/*<applet code="ex15_3.class,, width=800 height=400 ></applet>*/public class ex15_3 extends JApplet{private String str1;private String str2;private String str3;public void init(){str1 = "Character:";str2 = "Number: ";str3 = "Key State:";}public void paint(Graphics g){g.drawString(str1, 20, 30);g.drawString(str2, 20, 50);g.drawString(str3, 20, 70);}public boolean keyUp(Event e, int n){str1 = "Character:" + String.valueOf(n);str2 = "Number:" + n;str3 = "Key State:Key Up";repaint();return true;}public boolean keyDown(Event e, int n){str1 = "Character:" + String.valueOf(n);str2 = "Number:" + n;str3 = "Key State:Key Down";repaint();return true;}}ex15_3.html<HTML><HEAD><TITLE>ex15_3</TITLE></HEAD><BODY><applet code="ex15 3.class" width=800 height=400 ></applet></BODY></HTML>
考题
执行下面的程序,单击窗体后在窗体上显示的结果是 ______。Private Sub form_ Click() Dim Str1 As String, Str2 As String Dim Str3 As String, I As Integer Str1 = "e" for I = t To 2 Str2 = Ucase (Str1) Str1 = Str2 Str1 Str3 = Str3 Str1 str1 = Chr (Asc(Str1) + I) Next I Print Str3End SubA.EeFFB.eEfFC.EEFFD.eeFF
考题
阅读以下说明,Java代码将应填入(n)处的字句写在对应栏内。【说明】链表和栈对象的共同特征是:在数据上执行的操作与在每个对象中实体存储的基本类型无关。例如,一个栈存储实体后,只要保证最后存储的项最先用,最先存储的项最后用,则栈的操作可以从链表的操作中派生得到。程序6-1实现了链表的操作,程序6-2实现了栈操作。import java.io.*;class Node //定义结点{ private String m_content;private Node m_next;Node(String str){ m_content=str;m_next=null; }Node(String str,Node next){ m_content=str;m_next=next; }String getData() //获取结点数据域{ return m_content;}void setNext(Node next] //设置下一个结点值{ m_next=next; }Node getNext() //返回下一个结点{ return m_next; )}【程序6-1】class List{ Node Head;List(){ Head=null; }void insert(String str) //将数据str的结点插入在整个链表前面{ if(Head==null)Head=new Node(str);else(1)}void append(String str) //将数据str的结点插入在整个链表尾部{ Node tempnode=Head;it(tempnode==null)Heed=new Node(str);else{ white(tempnode.getNext()!=null)(2)(3) }}String get() //移出链表第一个结点,并返回该结点的数据域{ Srting temp=new String();if(Head==null){ System.out.println("Errow! from empty list!")System.exit(0); }else{ temp=Head.getData();(4) }return temp;}}【程序6-2】class Stack extends List{ void push(String str) //进栈{ (5) }String pop() //出栈{ return get();}}
考题
下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}
考题
设有语句:char str1[]="string",str2[8],*str3,*str4="string";,则下列对库函数strcpy调用不正确的是( )。A.strcpy(str1,"Hellol");B.strcpy(str2,"Hello2");C.strcpy(str3,"Hello3");D.strcpy(str4,"Henllo4");
考题
设有以下语句: char str1[]="string",str2[8],*str3,*str4="str4="string"; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2."HELLO2");C.strcpy(str3."HELLO3");D.strcpy(str4."HELLO4");
考题
public static void main(String[] args) { String str = “null‟; if (str == null) { System.out.println(”null”); } else (str.length() == 0) { System.out.println(”zero”); } else { System.out.println(”some”); } } What is the result?()A、 nullB、 zeroC、 someD、 Compilation fails.E、 An exception is thrown at runtime.
考题
假如有字符串str1和字符串str2,下列选项不能利用于比较这两个字符串是否相等的是()。A、string.Compare(str1,str2)B、str1= =str2C、string.Equals(str1,str2)D、string.CompareTo(str1,str2)
考题
顺序执行下列程序语句后,则b的值是() String str = "Hello"; String b = str.substring(0,2);A、HelloB、helloC、HeD、null
考题
Given the following code fragment: 1) String str = null; 2) if ((str != null) (str.length() 10)) { 3) System.out.println("more than 10"); 4) } 5) else if ((str != null) (str.length() 5)) { 6) System.out.println("less than 5"); 7) } 8) else { System.out.println("end"); } Which line will cause error?() A、 line 1B、 line 2C、 line 5D、 line 8
考题
java中 String str = "hello world"下列语句错误的是()。A、str+=’ a’B、int strlen = str.lengthC、str=100D、str=str+100
考题
Which expressions are correct to declare an array of 10 String objects? () A、 char str[];B、 char str[][];C、 String str[];D、 String str[10];
考题
public static void main(String[]args){ String str="null"; if(str==null){ System.out.println("null"); }else(str.length()==0){ System.out.println("zero"); }else{ System.out.println("some"); } } What is the result?()A、nullB、zeroC、someD、Compilationfails.E、Anexceptionisthrownatruntime.
考题
单选题Which expressions are correct to declare an array of 10 String objects? ()A
char str[];B
char str[][];C
String str[];D
String str[10];
考题
单选题Given the following code fragment: 1) String str = null; 2) if ((str != null) (str.length() 10)) { 3) System.out.println("more than 10"); 4) } 5) else if ((str != null) (str.length() 5)) { 6) System.out.println("less than 5"); 7) } 8) else { System.out.println("end"); } Which line will cause error?()A
line 1B
line 2C
line 5D
line 8
考题
单选题public static void main(String[] args) { String str = “null‟; if (str == null) { System.out.println(”null”); } else (str.length() == 0) { System.out.println(”zero”); } else { System.out.println(”some”); } } What is the result?()A
nullB
zeroC
someD
Compilation fails.E
An exception is thrown at runtime.
考题
单选题public static void main(String[]args){ String str="null"; if(str==null){ System.out.println("null"); }else(str.length()==0){ System.out.println("zero"); }else{ System.out.println("some"); } } What is the result?()A
nullB
zeroC
someD
Compilationfails.E
Anexceptionisthrownatruntime.
考题
单选题若有定义语句:char str1[] = "string", str2[8], *str3, str4[10] = "string";库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是( )。A
strcpy(str3, "HELLO!");B
strcpy(str2, "HELLO!");C
strcpy(str1, "HELLO!");D
strcpy(str4, "HELLO!");
热门标签
最新试卷