0% found this document useful (0 votes)
35 views3 pages

12 An2 C11 Comqp

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

12 An2 C11 Comqp

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

Subject: Computer Science Name:

Marks: 70 Term Assessment No. 2 Grade: Class 11


Time: 3 Hours Date : 6.12.24
PART I – 20 MARKS
Answer all questions
Question 1 [10]
(i) The number of bytes occupied by float data type is ________ bytes.
(a) 4 (b) 8 (c) 2 (d) 6
(ii) Given below are two statements marked Assertion and Reason. Read the two statements carefully and
choose the correct option.
Assertion (A): In a for loop, the initialization step is executed only once before the loop begins.
Reason (R): The for loop consists of three parts: initialization, condition, and iteration, where the iteration
step is executed after every loop iteration.
(a) Both (A) and (R) are true and (R) is the correct explanation for (A)
(b) Both (A) and (R) are true but (R) is not the correct explanation for (A)
(c) (A) is true and (R) is false.
(d) (A) is false and (R) is true.
(iii) If a= -1, then the output of a++ will be
(a) 1 (b) 0 (c) -1 (d) 4
(iv) Which of the following is not a logical operator?
(a) || (b) == (c) && (d) !
(v) Given below are two statements marked Assertion and Reason. Read the two statements carefully and
choose the correct option.
Assertion (A): Java Statement is given as: if((a>b) && (b>c) || (b>a)!(b>c)
Reason (R): When a statement contains all the three logical operations then NOT operation will
be operated first.
(a) Both (A) and (R) are true and (R) is the correct explanation for (A)
(b) Both (A) and (R) are true but (R) is not the correct explanation for (A)
(c) (A) is true and (R) is false.
(d) (A) is false and (R) is true.
(vi) Which of the following random() functions will return either 0 or 1?
(a) Math.random() (b) (int) Math.random());
(c) (int) Math.random()*2; (d) Math.random()*2;
(vii) Which of the following is irrelevant to switch case statement?
(a)case (b) continue (c) default (d) break
(viii) Which of the following construct execute statements selectively?
(a) for (b) while (c) do-while (d) if-else
(ix) In Java, a word is stored in the form of a:
(a) Numeric array (b) Characters array (c)Double dimensional array (d) None
(x) Which of the following is not a reserved word?
(a)private (b) import (c)switch (d) function name
Question 2
(i) Write down the syntax with reference to Java programming: [2]
(a) to accept an integral value from the user through the console
(b) to accept a fractional number from the user through the console
(ii) If a = 48; find a = a++ + ++a; [1]
(iii) Give the output of the following: [1]
char ch = ’computer’.charAt(3);
System.out.println(ch);
(iv) Differentiate the following: Ordinary variable and Array variable [2]
(v)Explain the purpose of the following mathematical functions along with the syntax: [4]
(a) sqrt() (b) pow() (c) min() (d) max()

PART II– 50 MARKS


Answer six questions in this part, choosing two questions from Section A, two from Section B and two
from Section C.
SECTION – A (Answer any two questions)
Question 3
(i) Give reasons why the following assignments are false? [5]
(a) int n = 15.4; (b) float f = 12; (c)char x = “A”; (d) String s = ‘Mouse’; (e) String x = true;
(ii) (a) Why non-primitive data types are called derived data types? [2]
(b) Why are they also called Reference Data Type? [2]
(c) Give examples of non-primitive data types. [1]

Question 4
(i) Give the output, if the following statements are executed
(a) int c = (3<4)? 3*4:3+4; [1]
(b) int a = 14, b=4; [1]
boolean x = (a>b)? true: false;
(c) int x = 90; [1]
char c = (x<=90)? ‘Z’: ‘10’;
(d) int a = 18; int b= 12;
boolean t = (a>20 && b<15)? true: false; [1]
(e) c = (val + 550 < 1700)? 200? 400; [1]
If val = 1000
(ii) (a) What are the three main types of operators? Name them. [1]
(b) What do you understand by Unary Operator? Explain with a suitable example. [2]
(c) Difference between Arithmetical Expression and Arithmetic Statement with a suitable example. [2]

Question 5
(i) Write a program in Java to find the amount and compound interest by using function argument. [5]
(ii) Distinguish between: Syntax error and Logical error [3]
(iii) What is a package in Java? Give an example. [2]

SECTION – B (Answer any two questions)


Question 6
Write a program on Java to generate 10 terms of the Fibonacci series in a Single Dimensional Array: [10]
Sample Input: 1,1,2,3,5,8,13,21,......
Find the difference between the consecutive numbers and store them in another Single Dimensional Array.
Display the elements of second array which will also possess another Fibonacci series.
Sample Output: 0,1,1,2,3,5,8,......

Question 7
Write a program in Java to store 20 numbers in a Single Dimensional Array and print the greatest and [10]
smallest number in the given set of numbers.

Question 8
Write a program in java to store 20 numbers in a Single Dimensional Array. Search whether a given number
is present or not by using binary search technique. If it is present then display the number along with a message
whether it is an even/odd/positive or negative number. [10]

SECTION – C(Answer any two questions)


Question 9
Write a program in Java to input 10 different words and display the longest word and the length of the word.[5]
Sample Input: Computer
School Sample Output: The longest word …………….
Chennai The length of the word ………….
Education ……………
Question 10
Write a program in Java to input a word and check whether it is a palindrome or not. A word is said to be a [5]
Palindrome, if a new word formed by reversing the letters of the original word is the same as the original word.
E.g. ARORA, MADAM …….

Question 11
Write a program in Java to input two numbers. Display the H.C.F and L.C.M of both the numbers. [5]

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