0% found this document useful (0 votes)
2 views2 pages

Computer.docx

The document is an examination paper for a Computer Science subject for standard XII, detailing various programming tasks and theoretical questions related to arrays and Java programming. It includes questions on merging arrays, searching elements, transposing matrices, and memory address calculations for matrices. The paper is structured into sections with specific marks allocated for each question.

Uploaded by

National Academy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Computer.docx

The document is an examination paper for a Computer Science subject for standard XII, detailing various programming tasks and theoretical questions related to arrays and Java programming. It includes questions on merging arrays, searching elements, transposing matrices, and memory address calculations for matrices. The paper is structured into sections with specific marks allocated for each question.

Uploaded by

National Academy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

i) What is the expression/statement at ?1?

NATIONAL ACADEMY SCHOOL


ii) What is the expression/statement at ?2? (Affiliated to CISCE, New Delhi)
iii) What is the expression/statement at ?3? PATTINAMKATHAN, RAMANATHAPURAM.
iv) What is the expression/statement at ?4? SEPTEMBER MONTHLY EXAMINATION 2023
v) What is the expression/statement at ?5? COMPUTER SCIENCE
std: XII Marks : 50
Question 4 Name: Time: 1 hr 30 min
Write a java program to merge two arrays. [5] SECTION – A (10 Marks)
(or) (Attempt all the questions)
Question 5 Question 1
Write a java program to enter elements of two dimensional array without using 1. Define Array. [1]
the scanner class and print the array in matrix format. [5]
2. Write the syntax to declare and initialize the one dimensional array. [1]
Question 6 3. void test (int arr [])
Write a java program to search for an element in a one dimensional array {
using binary search. [10] int c=0, s=0;
Class name : Binsearch for (int i=0; i<arr.length;i++)
Data member/instance variable: {
arr[] : to store integer elements for (int j=1; j<=arr[i];j++)
n : to store the length of the array {
if ( arr [i] % j= = 0)
Member functions/methods: c++;
Void fillarray() : to enter elements of an array using scanner class }
(enter the elements in ascending order). if ( c= =2)
Void bin_search() : searches for the value and print the position of the s++;
searched value. c=0;
}
Question 7 System.out.println(s);
Write a java program to transpose the matrix. [10] }
Class name : twomatrix i) What will be the output of the method test( ) when the value of
Data member/instance variable: arr[]={2,9,13,18,21,29} ?
arr[][] : to store integer elements
n : to store the length of the array a) 3 b) 4
c) 0 d) 1 [1]
Member functions/methods:
Void fillarray() : to enter elements of an array using scanner class 4. Write the syntax to declare and initialize the two dimentional array .
and print the original array in a matrix form. [1]
Void transpose() : just print the transpose the original matrix(which 5. The conditional statement to check for the diagonal elements in a two [1]
means rows into columns and columns into rows) dimensional array of ‘M’ number of rows and ‘M’ number of columns
having row index represented by ‘r’ and the column index represented by ‘c’
will be: SECTION – C (30 Marks)
(Answer all the questions)
a) (r ==c && r+c ==M) b) (r ==c || r+c ==M-1)
Question 3
c) (r == c && r+c == M-1) d) (r ==c || r==M-1|| c==M-1)
The following is a function of some class which sorts an array a[] in ascending
6.A two dimentional array marks [10][5] can store maximum of
order using bubble sort. [5]
______elements. [1]
public class bub
A) 10 B)5 C)15 D)50 {
7. How many bytes will be required by an array declared as follows double void bubblesort(int[] a,int n )
array[7][6] ? [1] {
8.The method which transverse the array sequentially to locate by given time int t;
is called? (hint:which search is it?) [1] for(int i=0;?1?;i++)
9. Write the syntax to find the length of an array. [1] {
for(int j=0;?3?;j++)
10. How many types of array are there? What are those? [1]
{
if (a[j]>?4?)
SECTION – B (10 Marks) {
(Attempt all the questions) t =a[j];
Question 2 a[j]=?5?;
a[j+1]=t;
1. A matrix B[10][20] is stored in the memory with each elements requiring 2 }
bytes of storage. If the base address at B[2][1] is 2140,find the address of }
B[5][4] when the matrix is stored in column major wise. [2] }
2. A matrix A[m][n] is stored with each element requiring 4 bytes of storage. for(int i=0;i<n-1;i++)
If the base address at A[1][1] is 1500 and the address at A[4][5] is 1608, {
determine the number of rows of the matrix when the matrix is stored in System.out.println(a[i]);
}
column major wise. . [2]
}
3. Each element of an array arr[5][20] requires ‘W’ bytes of storage.If the public static void main(String arg[])
address of arr[6][8] is 4440 and the base address at arr[1][1] is 4000,find the {
width ‘W’ of each cell in the array arr[][] when the array is stored as column int arr[]={34,12,1,67,2,55,32};
major wise. [2] bub sc=new bub ( );
4. An array ar[-4,…6,-2….12] stores elements in row major wise,with the int n=?2?;
sc.bubblesort (arr,n);
address ar[2][3] as 4142.If each elements requires 2 bytes of storage , find
}
the base address. }
[2]
5. In an array of real numbers arr[25][25],arr[1][1] is stored in location 1000.
Find the address of arr[12][12] when the array is stored row major wise.
Assume each real number requires 4 bytes. [2]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy