programming languages Online Quiz - 289
Description: programming languages Online Quiz - 289 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
Which of these lists contains at least one word that is not a Java keyword?
class Identifiers { int i1; // 1 int _i2; // 2 int i_3; // 3 int #i4; // 4 int $i5; // 5 int %i6; // 6 int i$7; // 7 } Compile-time errors are generated at which lines?
Which of the following are true statements?
class GFC500 {private String name;} class GFC501 { private String name; private void setName(String name) {this.name = name;} private String getName() {return name;} } class GFC502 { private String name; public void setName(String name) {this.name = name;} public String getName() {return name;} } Which class is not tightly encapsulated?
class GFC506 {private String name;} class GFC507 extends GFC506 { String name; public void setName(String name) {this.name = name;} public String getName() {return name;} } class GFC508 extends GFC506 { private String name; public GFC508(String name) {setName(name);} public void setName(String name) {this.name = name;} public String getName() {return name;} } Which class is not tightly encapsulated?
Which of the following are command-line switches used to disable assertions in non-system classes?
class A { void m1(int i) { int j = i % 3; switch (j) { case 0: System.out.print("0"); break; case 1: System.out.print("1"); break; default: assert j == 2; System.out.print(j); }} public static void main (String[] args) { A a = new A(); for (int i=5; i >= -1; i--) {a.m1(i);} }} Which statements are true?
class C { String m1(int i) { switch (i) { case 0: return "A"; case 1: return "B"; case 2: return "C"; default: assert false; } } public static void main(String[] args) { C c = new C(); for (int i = 0; i < 4; i++) { System.out.print(c.m1(i)); }}} Which statements are true?
class C { int a, b, c; public void setA(int i) {a = i; assert validateC() : c;} public void setB(int i) {b = i; assert validateC() : c;} private boolean validateC() { return c > a + 2 * b; } public int m1(int i) { c = a + b + i; assert validateC() : c; return c; } public C(int i) { c = i; assert validateC() : c; } public static void main(String[] args) { C c = new C(251); c.setA(50); c.setB(100); }} Which statements are true?
What is the ouput of the following code snippet: $mystring = "[2004/04/13] The date of this article."; if($mystring =~ m/(\d)/) { print "The digit is $1"; }
What is the output of the following code snippet: $mystring = "[2009/02/14] The date of this article."; if($mystring =~ m/(\d+)/) { print "$1"; }
a\Sz
int (*p)(char *a)
int *p(void)
.{3,5}pentane
int p(char *a[])