Explore topic-wise MCQs in Lisp.

This section includes 13 Mcqs, each offering curated multiple-choice questions to sharpen your Lisp knowledge and support exam preparation. Choose a topic below to get started.

1.

What will be the output of the program?public class Test{public static void main(String [] args){String s1 = args[1];String s2 = args[2];String s3 = args[3];String s4 = args[4];System.out.print(" args[2] = " + s2);}}and the command-line invocation is C:Java> java Test 1 2 3 4

A. rgs[2] = 2
B. rgs[2] = 3
C. rgs[2] = null
D. n exception is thrown at runtime.
Answer» E.
2.

What would be the result of attempting to compile and run the following code?public class HelloWorld{public static void main(String[] args){double[] x = new double[]{1, 2, 3};System.out.println("Value is " + x[1]);}}

A. he program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by {1, 2, 3}.
B. he program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by new double[3]{1, 2, 3};
C. he program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by new double[]{1.0, 2.0, 3.0};
D. he program compiles and runs fine and the output
Answer» E.
3.

What will be the output?public class Test{public static void main(String[] args){int[] a = new int[4];a[1] = 1;a = new int[2];System.out.println("a[1] is " + a[1]);}}

A. he program has a compile error because new int[2
B. he program has a runtime error because a[1
C. [1] is 0
D. [1] is 1
Answer» D. [1] is 1
4.

Determine output:public class Test{public static void main(String[] args){int[] x = {1, 2, 3, 4};int[] y = x;x = new int[2];for(int i = 0; i < x.length; i++)System.out.print(y[i] + " ");}}

A. 2 3 4
B. 0 0 0
C. 2
D. 0
E. one of these
Answer» D. 0
5.

What is output of the following code:public class Test{public static void main(String[] args){int[] x = {120, 200, 016 };for(int i = 0; i < x.length; i++)System.out.print(x[i] + " ");}}

A. 20 200 16
B. 20 200 14
C. 20 200 016
D. 16 is a compile error. It should be written as 16.
Answer» C. 20 200 016
6.

What will be the output?public class Test{public static void main(String[] args){int[] x = new int[3];System.out.println("x[0] is " + x[0]);}}

A. he program has a compile error because the size of the array wasn't specified when declaring the array.
B. he program has a runtime error because the array elements are not initialized.
C. he program runs fine and displays x[0] is 0.
D. he program has a runtime error because the array element x[0] is not defined.
Answer» D. he program has a runtime error because the array element x[0] is not defined.
7.

E?$

A. E E
B. E E E
C. E E E E
Answer» B. E E E
8.

Done

A. 4
B. (0 0 0 0)
C. None of the mentioned
Answer» C. None of the mentioned
9.

Which keyword embeds the initial element in an array?

A. Initial
B. Initial-content
C. Initial-element
D. None of the mentioned
Answer» C. Initial-element
10.

Which is present in the writer procedure for arrays?

A. Setf
B. Aref
C. Fref
D. Both Setf & Aref
Answer» E.
11.

Which keyword is used to construct an array?

A. Array
B. Make-array
C. Bins
D. Make
Answer» C. Bins
12.

Which symbol holds the first element and also an index?

A. Nail
B. Tail
C. Initial
D. All of the mentioned
Answer» B. Tail
13.

What is a data type in which expressions are stored in places identified by integer indexes?

A. Structure
B. List
C. Array
D. None of the mentioned
Answer» D. None of the mentioned