fork download
  1. class Operators1
  2. {
  3. public static void main(String[] args)
  4. {
  5. int i=0;
  6. System.out.println(i++);
  7. System.out.println(i);
  8. System.out.println(++i);
  9. }
  10. }
  11. Select one:
  12. 1
  13. 1
  14. 2
  15. 1
  16. 1
  17. 1
  18. 0
  19. 1
  20. 2
  21. 0
  22. 0
  23. 1
  24. Question 15
  25. Not yet answered
  26. Marked out of 1.00
  27. Flag question
  28. Question text
  29.  
  30. What is String in Java?
  31. Select one:
  32. method
  33. class
  34. variable
  35. object
  36. Question 16
  37. Not yet answered
  38. Marked out of 1.00
  39. Flag question
  40. Question text
  41.  
  42. Which of the following jump statements will skip the remaining code within its body?
  43. Select one:
  44. break
  45. exit
  46. return
  47. continue
  48. Question 17
  49. Not yet answered
  50. Marked out of 1.00
  51. Flag question
  52. Question text
  53.  
  54. What will be the output of the following program?
  55.  
  56. class A
  57. {
  58. public static void main(String[] args)
  59. {
  60. System.out.println("Hello World!");
  61. int i=0;
  62. if (i=0)
  63. {
  64. System.out.println("i="+i);
  65. }
  66. }
  67. }
  68. Select one:
  69. Compilation Error
  70. Hello World!
  71. i=0
  72. Hello World!
  73. None of these
  74. Question 18
  75. Not yet answered
  76. Marked out of 1.00
  77. Flag question
  78. Question text
  79.  
  80. Which is a valid declaration of a string?
  81. Select one:
  82. String s2 = 'null';
  83. String s1 = null;
  84. String s3 = (String) 'abc';
  85. String s4 = (String) '\ufeed';
  86. Question 19
  87. Not yet answered
  88. Marked out of 1.00
  89. Flag question
  90. Question text
  91.  
  92. Consider the following code block
  93.  
  94. int[] a = {5,6,7,8,9};
  95. int[] b = a;
  96. b[2] = 10;
  97.  
  98. What will be the value of a[2]?
  99. Select one:
  100. 8
  101. 10
  102. 7
  103. 6
  104. Question 20
  105. Not yet answered
  106. Marked out of 1.00
  107. Flag question
  108. Question text
  109.  
  110. What will be the output of the following program?
  111.  
  112. class booloperators {
  113. public static void main(String args[])
  114. {
  115. boolean var1 = true;
  116. boolean var2 = false;
  117. System.out.println((var2 & var2));
  118. }}
  119. Select one:
  120. false
  121. true
  122. 1
  123. 0
  124. Question 21
  125. Not yet answered
  126. Marked out of 1.00
  127. Flag question
  128. Question text
  129.  
  130. What will be the output of the following program?
  131.  
  132.  
  133. public class StaticTest
  134. {
  135. public static void main(String[] args)
  136. {
  137. A a1=new A();
  138. A a2=new A();
  139. B b1=new B();
  140. }
  141. }
  142.  
  143. class A
  144. {
  145. {System.out.println("Non-Static block of a instance of Class A");}
  146. public A()
  147. {
  148. System.out.println("Constructing object of type A");
  149. }
  150. }
  151.  
  152. class B
  153. {
  154. {System.out.println("Non-Static block of a instance of Class B");}
  155. public B()
  156. {
  157. System.out.println("Constructing object of type B");
  158. }
  159. }
  160. Select one:
  161. Non-static block of a instance of Class A
  162. Constructing object of type A
  163. Non-static block of a instance of Class A
  164. Constructing object of type A
  165. Non-static block of a instance of Class B
  166. Constructing object of type B
  167. Compilation Error
  168. Non-static block of a instance of Class A
  169. Constructing object of type A
  170. Non-static block of a instance of Class A
  171. Constructing object of type A
  172. Non-static block of a instance of Class B
  173. Constructing object of type A
  174. Question 22
  175. Not yet answered
  176. Marked out of 1.00
  177. Flag question
  178. Question text
  179.  
  180. What will be the output of the following program?
  181.  
  182. class Relational_operator {
  183. public static void main(String args[])
  184. {
  185. int var1 = 5;
  186. int var2 = 6;
  187. System.out.print(var1 > var2);
  188. }
  189. }
  190. Select one:
  191. true
  192. false
  193. 1
  194. 0
  195. Question 23
  196. Not yet answered
  197. Marked out of 1.00
  198. Flag question
  199. Question text
  200.  
  201. Point out the error line in the following program.
  202.  
  203. 1.class welcome {
  204. 2.public static void Main(String arg [])
  205. 3.{
  206. 4. System.out.println(Welcome to the spoken tutorial on Java)
  207. 5. }
  208. 6. }
  209. Select one:
  210. Line number 1
  211. All of these
  212. Line number 2
  213. Line number 4
  214. Question 24
  215. Not yet answered
  216. Marked out of 1.00
  217. Flag question
  218. Question text
  219.  
  220. Point out the error line in the following program.
  221.  
  222. 1. public class MyParameterizedConstructor
  223. 2. {
  224. 3. private String name;
  225. 4.
  226. 5. public MyParameterizedConstructor(String str){
  227. 6. this.name = str;
  228. 7. System.out.println("I am inside parameterized constructor.");
  229. 8. System.out.println("The parameter value is: "+str);
  230. 9. }
  231. 10.
  232. 11. public static void main(String a[]){
  233. 12. MyParameterizedConstructor mpc = new MyParameterizedConstructor("Madhu Raj");
  234. 13. }
  235. 14. }
  236. Select one:
  237. Line number 12
  238. Line number 5
  239. We get the output as :
  240. I am inside parameterized constructor.
  241. The parameter value is: Madhu Raj
  242. Line number 6
  243.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:11: error: class, interface, or enum expected
Select one:
^
Main.java:34: error: '{' expected
variable
        ^
Main.java:68: error: ';' expected
Select one:
          ^
Main.java:69: error: ';' expected
Compilation Error
                 ^
Main.java:70: error: ';' expected
Hello World!
           ^
Main.java:71: error: <identifier> expected
    i=0
     ^
Main.java:71: error: ';' expected
    i=0
       ^
Main.java:72: error: ';' expected
Hello World!
           ^
Main.java:73: error: ';' expected
None of these
       ^
Main.java:74: error: ';' expected
Question 18
        ^
Main.java:75: error: ';' expected
Not yet answered
       ^
Main.java:76: error: ';' expected
Marked out of 1.00
      ^
Main.java:76: error: ';' expected
Marked out of 1.00
             ^
Main.java:77: error: ';' expected
Flag question
             ^
Main.java:78: error: ';' expected
Question text
             ^
Main.java:80: error: ';' expected
Which is a valid declaration of a string?
        ^
Main.java:80: error: ';' expected
Which is a valid declaration of a string?
                ^
Main.java:80: error: ';' expected
Which is a valid declaration of a string?
                               ^
Main.java:80: error: ';' expected
Which is a valid declaration of a string?
                                        ^
Main.java:81: error: ';' expected
Select one:
          ^
Main.java:82: error: unclosed character literal
String s2 = 'null';
            ^
Main.java:82: error: unclosed character literal
String s2 = 'null';
                 ^
Main.java:84: error: unclosed character literal
String s3 = (String) 'abc';
                     ^
Main.java:84: error: unclosed character literal
String s3 = (String) 'abc';
                         ^
Main.java:86: error: <identifier> expected
Question 19
        ^
Main.java:87: error: ';' expected
Not yet answered
       ^
Main.java:88: error: ';' expected
Marked out of 1.00
      ^
Main.java:88: error: ';' expected
Marked out of 1.00
             ^
Main.java:89: error: ';' expected
Flag question
             ^
Main.java:90: error: ';' expected
Question text
             ^
Main.java:92: error: ';' expected
Consider the following code block
            ^
Main.java:92: error: ';' expected
Consider the following code block
                           ^
Main.java:92: error: <identifier> expected
Consider the following code block
                                 ^
Main.java:96: error: ']' expected
b[2] = 10;
  ^
Main.java:98: error: ';' expected
What will be the value of a[2]?
         ^
Main.java:98: error: ';' expected
What will be the value of a[2]?
                ^
Main.java:98: error: ';' expected
What will be the value of a[2]?
                         ^
Main.java:98: error: ']' expected
What will be the value of a[2]?
                            ^
Main.java:99: error: ';' expected
Select one:
          ^
Main.java:104: error: <identifier> expected
Question 20
        ^
Main.java:105: error: ';' expected
Not yet answered
       ^
Main.java:106: error: ';' expected
Marked out of 1.00
      ^
Main.java:106: error: ';' expected
Marked out of 1.00
             ^
Main.java:107: error: ';' expected
Flag question
             ^
Main.java:108: error: ';' expected
Question text
             ^
Main.java:110: error: ';' expected
What will be the output of the following program?
         ^
Main.java:110: error: ';' expected
What will be the output of the following program?
                ^
Main.java:110: error: ';' expected
What will be the output of the following program?
                          ^
Main.java:110: error: ';' expected
What will be the output of the following program?
                                        ^
Main.java:110: error: <identifier> expected
What will be the output of the following program?
                                                ^
Main.java:119: error: ';' expected
Select one:
          ^
Main.java:124: error: <identifier> expected
Question 21
        ^
Main.java:125: error: ';' expected
Not yet answered
       ^
Main.java:126: error: ';' expected
Marked out of 1.00
      ^
Main.java:126: error: ';' expected
Marked out of 1.00
             ^
Main.java:127: error: ';' expected
Flag question
             ^
Main.java:128: error: ';' expected
Question text
             ^
Main.java:130: error: ';' expected
What will be the output of the following program?
         ^
Main.java:130: error: ';' expected
What will be the output of the following program?
                ^
Main.java:130: error: ';' expected
What will be the output of the following program?
                          ^
Main.java:130: error: ';' expected
What will be the output of the following program?
                                        ^
Main.java:130: error: <identifier> expected
What will be the output of the following program?
                                                ^
Main.java:160: error: ';' expected
Select one:
          ^
Main.java:161: error: <identifier> expected
Non-static block of a instance of Class A
   ^
Main.java:161: error: ';' expected
Non-static block of a instance of Class A
                   ^
Main.java:161: error: ';' expected
Non-static block of a instance of Class A
                              ^
Main.java:161: error: ';' expected
Non-static block of a instance of Class A
                                       ^
Main.java:162: error: ';' expected
    Constructing object of type A
                ^
Main.java:162: error: ';' expected
    Constructing object of type A
                          ^
Main.java:162: error: ';' expected
    Constructing object of type A
                                 ^
Main.java:163: error: <identifier> expected
    Non-static block of a instance of Class A
       ^
Main.java:163: error: ';' expected
    Non-static block of a instance of Class A
                       ^
Main.java:163: error: ';' expected
    Non-static block of a instance of Class A
                                  ^
Main.java:163: error: ';' expected
    Non-static block of a instance of Class A
                                           ^
Main.java:164: error: ';' expected
    Constructing object of type A
                ^
Main.java:164: error: ';' expected
    Constructing object of type A
                          ^
Main.java:164: error: ';' expected
    Constructing object of type A
                                 ^
Main.java:165: error: <identifier> expected
    Non-static block of a instance of Class B
       ^
Main.java:165: error: ';' expected
    Non-static block of a instance of Class B
                       ^
Main.java:165: error: ';' expected
    Non-static block of a instance of Class B
                                  ^
Main.java:165: error: ';' expected
    Non-static block of a instance of Class B
                                           ^
Main.java:166: error: ';' expected
    Constructing object of type B
                ^
Main.java:166: error: ';' expected
    Constructing object of type B
                          ^
Main.java:166: error: ';' expected
    Constructing object of type B
                                 ^
Main.java:167: error: ';' expected
Compilation Error
                 ^
Main.java:168: error: <identifier> expected
Non-static block of a instance of Class A
   ^
Main.java:168: error: ';' expected
Non-static block of a instance of Class A
                   ^
Main.java:168: error: ';' expected
Non-static block of a instance of Class A
                              ^
Main.java:168: error: ';' expected
Non-static block of a instance of Class A
                                       ^
Main.java:169: error: ';' expected
    Constructing object of type A
                ^
Main.java:169: error: ';' expected
    Constructing object of type A
                          ^
Main.java:169: error: ';' expected
    Constructing object of type A
                                 ^
Main.java:170: error: <identifier> expected
    Non-static block of a instance of Class A
       ^
Main.java:170: error: ';' expected
    Non-static block of a instance of Class A
                       ^
Main.java:170: error: ';' expected
    Non-static block of a instance of Class A
                                  ^
Main.java:170: error: ';' expected
    Non-static block of a instance of Class A
                                           ^
Main.java:171: error: ';' expected
    Constructing object of type A
                ^
Main.java:171: error: ';' expected
    Constructing object of type A
                          ^
Main.java:171: error: ';' expected
    Constructing object of type A
                                 ^
Main.java:172: error: <identifier> expected
    Non-static block of a instance of Class B
       ^
100 errors
stdout
Standard output is empty