0% found this document useful (0 votes)
73 views

Computer Application Semester 2 Sample Paper 1

The document is a sample paper for a Computer Application course, containing multiple-choice questions and programming tasks related to Java concepts such as boxing, string manipulation, and array handling. It includes questions about string methods, array declarations, and class definitions for specific tasks. The paper tests knowledge on Java programming fundamentals and requires students to write code for various scenarios.

Uploaded by

Rituraj Pradhan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Computer Application Semester 2 Sample Paper 1

The document is a sample paper for a Computer Application course, containing multiple-choice questions and programming tasks related to Java concepts such as boxing, string manipulation, and array handling. It includes questions about string methods, array declarations, and class definitions for specific tasks. The paper tests knowledge on Java programming fundamentals and requires students to write code for various scenarios.

Uploaded by

Rituraj Pradhan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Computer Application

Semester II – Sample Paper I


Choose the correct answers to the questions from the given options. (Do not copy the question, Write the
correct answer only.)
(i) In the example given below what mechanism is taking place?
Double avg=45.55;
Double ovg=Double(avg);
(a) Boxing (b) Unboxing (c) Coercion (d) Type casting

(ii)The statement below represents what type of feature?


Character ch = 'a';
a) Autoboxing b)Unboxing c)OpenBoxing d)Implicit Conversion

(iii) Find the output of the statement given below?


System.out.print("COVID”.charAt(0) + "DELTA".charAt("BETA".length()-1));
a) CA b) 196 c) 132 d) CT

(iv) Give the output of the following string methods:


"MALAYALAM".lastIndexOf('A')+ "TAMIL".indexOf('a');
(a) -1 (b) 5 (c) 6 (d) 7

(v) Which one of the following is not a Wrapper class method?


(a) valueOf() (b) parseFloat() (c) toString() (d) nextInt()

(vi) Variable that is associated with the objects of a class is called _______________.
(a) Instance variable (b) class variable (c) Local variable (d) Argument variable

(vii) Variable that is associated with the class is called _______________.


(a) Instance variable (b) static variable (c) Local variable (d) classic variable

(viii) Which of the following is the correct array declaration statement:


(a) int a[10]; (b) Integer a[]=new int[10]; (c) int [10]arr; (d) int a[]=new int[10];

(ix) Give the output of the following string methods:


"MALAYALAM".substring(0 , 5)+ "ASIA".substring(0);
(a) MALAYAASIA (b) MALAYA (c) MALAYASIA (d) MALAY

(x) Visible in the classes and subclasses in the same package and subclasses in other packages.
(a) private (b) public (c) protected (d) default

Question 2
Define a class to accept two strings, convert them into uppercase, check and display whether two strings
are equal in length or not, if the two strings are not equal in length, print the larger and the smaller string
with proper messages or print the message both the strings are of equal length.

Question 3
Define a class to declare a String array of size N and accept N full names of persons into the array.
Accept a surname from the user and display all the names whose surname matches with the entered
surname if any match is found, otherwise display the message “NO NAMES WITH THE <SURNAME>
FOUND”.

Question 4
Define a class to declare a character array of size N, accept the characters into the array and perform the
following:
• Count the number of digits in the array and print.
• Replace the uppercase consonants with the lowercase, vowels with the uppercase and print the array.

Question 5
Define a class to declare an array of size 20 of integer data type, accept the elements into the array and
print the first number in the array which is not repeated later.

You might also like