0% found this document useful (0 votes)
38 views10 pages

Java and R Programming Assignment Questions

This document is an assignment for 12th-grade students at Arjun English High School, focusing on Computer Science topics related to Java and R programming. It consists of multiple-choice questions covering various concepts such as data types, methods, arrays, and string handling. The assignment aims to assess students' understanding of programming fundamentals and software applications.

Uploaded by

ashachauhan1179
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)
38 views10 pages

Java and R Programming Assignment Questions

This document is an assignment for 12th-grade students at Arjun English High School, focusing on Computer Science topics related to Java and R programming. It consists of multiple-choice questions covering various concepts such as data types, methods, arrays, and string handling. The assignment aims to assess students' understanding of programming fundamentals and software applications.

Uploaded by

ashachauhan1179
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

Shree Sabarmati Vidyamandir Trust

ARJUN ENGLISH HIGH SCHOOL


Ramnagar, Sabarmati, Ahmedabad – 380005

Std- 12th Assignment Total Marks -


Date: Sub : Computer
 Choose appropriate options from given below:
(1) How many basic (primitive) data types are supported in Java?
(A) 2 (B) 4 (C) 8 (D) 16
(2) What is the default data type of floating point literal?
(A) int (B) long (C) float (D) double
(3) Which character set is used for char data type in Java?
(A) Unicode (B) ASCII (C) EBCIDIC (D) All of these
(4) Which of the following is compiled error free?
(A) for (;;) {int i=7} (B) while (1) {int i=7}
(C) while (True) {int i = 7} (D) All of these
(5) Which of the following is not allowed as first character in valid variable name?
(A) Underscore (_) (B) Digit (C) Letter (D) Dollar ($)
(6) Which of the following defines attributes and methods?
(A) Class (B) Object (C) Instance (D) Variable
(7) Which of the following keyword is used to declare Class variables and class methods?
(A) static (B) private (C) public (D) package
(8) Which of the following operator creates an object and returns its reference?
(A) dot (.) (B) new (C) colon (:) (D) assignment (=)
(9) Which of the following method can be called without creating an instance of a class?
(A) Instance method (B) Class method
(C) Constructor method (D) All of these
(10) Which of the following refers more than one method having same name but different
parameters?
(A) Overloaded methods (B) Overridden methods
(C) Duplicate methods (D) All of these
(11) Which of the following refer to the starting index value in arrays?
(A) 0 (B) 1 (C) Null (D) All of these
(12) What is the size of second dimension in an array sales [5] [12]?
(A) 5 (B) 12 (C) 60 (D) 10
(13) What will expression [Link] return for an array sales [5] [12]?
(A) 5 (B) 12 (C) 60 (D) 120
(14) When an array sales [5] [12] is declared without specifying initial values, what is the initial
value of sale [0] [0] ?
(A) 0 (B) default value (C) compilation error (D) 60
(15) What does ‘length’ refer to for an object of String class?
(A) attribute (B) method (C) class variable (D) class name

(16) Which of the following refers to a file that has an entire directory structure inside it?
(A) Apache (B) Archie (C) Archi (D) Archive
(17) What is the full form of tar?
(A) Tape Archiver (B) Tech Archiver (C) Test Archiver (D) Tight Archiver
(18) For which types of archives is the password protection option available?
(A) zip (B) tar (C) [Link] (D) Both zip and [Link]
(19) Which of the following is a feature-rich media player?
(A) VAC (B) VEC (C) VLC (D) VNC
(20) What is the full form of VLC?
(A) Video LAN Client (B) Video Line Coder
(C) Video Length Coder (D) Video List Creator
(21) Which method is invoked automatically with creation of an object?
(A) Instance method (B) Constructor
(C) Class method (D) All of these
(22) Which of the following is the keyword used to refer a superclass constructor in subclass
constructor?
(A) extends (B) super
(C) name of the superclass (D) new
(23) Which of the following is used to invoke an instance method in Java?
(A) The name of the object, colon (:) and the name of the method
(B) The name of the object, dot (.) and the name of the method
(C) The name of the class, colon (:) and the name of the method
(D) The name of the class, dot (.) and the name of the method
(24) Which of the following is accessible by instance methods?
(A) Only instance variables (B) Only class variables
(C) Both (A) and (B) (D) None of these
(25) When methods in the superclass and subclass have same name and signature, what are they
called ?
(A) Overloaded methods (B) Overridden methods
(C) Inherited methods (D) All of these
(26) Which method of Java class is used if we want to allow other methods to modify the data
value?
(A) Set or Setter (B) Get or Getter
(C) Both (A) and (B) (D) None of these
(27) If ‘str’ is the object of String class and its content is “Thank GOD”, then what is the value of
[Link]()?
(A) 9 (B) 10 (C) 8 (D) 11
(28) What type of value is returned when we use get method of Calendar class with constant
DAY_OF_WEEK as an argument?
(A) int (B) char (C) string (D) boolean
(29) What is useful when same operations are to be performed on various elements of the similar
type in Java?
(A) Array (B) String (C) if.....then (D) while
(30) In Java which method is used to fill the whole or partial array with specified value?
(A) fill (B) sort (C) set (D) insert
(31) To make a string object which of the following constructers is used to create a string object
using 1-D ary argument starting at ary [start] with len number of characters ?
(A) String (char ar[], int start, int len) (B) String (int start, int length)
(C) String (int length, int start) (D) String (char ary[], int len)
(32) Which of the methods of string class returns an array of characters as bytes from invoking
string in Java?
(A) int length() (B) byte [ ] get bytes [ ]
(C) int bytes [ ] (D) get bytes [ ]
(33) What type of value is returned when we use get method of calendar class with constant
DAY_OF_WEEK as an argument in Java?
(A) int (B) char (C) string (D) boolean
(34) Which technology gives out location with accuracy?
(A) GRS (B) GPRS (C) GRPS (D) GPS
(35) Which program is used to enter Unicode character into any application?
(A) Character Display (B) Character Insert
(C) Character Map (D) Character Select
(36) Which command is used to quit from R?
(A) quit() (B) q() (C) exit() (D) close()
(37) Which function is used to create a bar graph in R ?
(A) bar() (B) plot() (C) bargraph() (D) barplot()
(38) Which of the following are different variants of Rational Plan?
(A) Single, Multi, Viewer (B) Singular, Multiple
(C) View, Preview (D) Server, Client
(39) Which of the following software gives permission to make different projects, analyzes all
projects data and creates a project portfolio view ?
(A) Rational Plan (B) Bar plot (C) Chart (D) Graph
(40) Which command is used to quit from R?
(A) quit() (B) q() (C) exit() (D) close()
(41) By which sign is the begging and the end of enclosed text of Data Compression done?
(A) ^ ..... $ (B) $ ..... ^ (C) “ ..... ” (D) \ ..... \
(42) Which of the following command of R opens the online help in browser ?
(A) [Link]() (B) [Link]() (C) [Link]() (D) [Link]()
(43) Which of the following function displays a list of all variable defined in R ?
(A) list() (B) lst() (C) ls() (D) alllist()
(44) Which of the following is one such software that allows us to make calls over the internet using
our computer ?
(A) Skype (B) Rational Plan (C) Skipe (D) R Software
(45) Which program is used to enter Unicode character into any application?
(A) Character Map (B) Character App
(C) Unicode Map (D) Unicode App
(46) Which of the following function in R software helps to find median ?
(A) list (median) (B) med (list) (C) mean(list) (D) median(list)
(47) Which function is used to create a bar graph in R software?
(A) bar() (B) plot() (C) plotbar() (D) barplot()
(48) Which of the following technique is used for reducing the storage requirements of computer
files and directory structures ?
(A) Cryptography (B) Data hiding (C) Data sizing (D) Data compression
(49) Java uses which of the following file compression format?
(A) gz (B) uz (C) jar (D) tar
(50) Which of the following refers to a file that has an entire directory structure inside it ?
(A) archive (B) archie (C) archi (D) apache
(51) In VLC, which menu option is used to convert multimedia files from one format to another?
(A) Edit Convert (B) Media Convert/Save
(C) File Convert format (D) Media Insert format
(52) Which of the following is a work environment of ‘R’ software?
(A) Command line (B) Graphical
(C) Both (A) and (B) (D) None of these
(53) In ‘R’ software, strings are enclosed in which sign?
(A) * ..... * (B) $ ..... $ (C) /* ..... */ (D) ‘.....’ or “.....”
(54) In ‘R’ software which of the following syntax is used to get help on a particular function?
(A) guide (function name) (B) edit (function name)
(C) help (function name) (D) ls (function name)
(55) In Java, which string class method returns a string after appending str with the invoking string?
(A) String combine (str) (B) String concate (string str)
(C) String add (str) (D) String join (str)
(56) Java library also provides date class in which of the following package?
(A) [Link] (B) [Link] (C) [Link] (D) [Link]
(57) In Java, which method of date class constructs date object using current system time?
(A) getTime() (B) getDate() (C) Date() (D) DateTime()
(58) In Java, which method of date class sets new date and time of an object using elapsed time?
(A) short getTime() (B) void SetTime (long elapsed time)
(C) void SetDate (Date, Time) (D) setDate()
(59) In Java, which constant of calendar class displays day of calendar month?
(A) DATE (B) DAY (date) (C) month (D) MONTH (date)
(60) In Java, what are the values used for AM_PM constant of calendar class?
(A) 1 for AM, 12 for PM (B) 1 for AM, 0 for PM
(C) 1 for AM, 2 for PM (D) 0 for AM, 1 for PM
(61) In Java, which constant of calendar class displays Hours in 12-hour notation?
(A) H_M_S (B) HOUR (C) HOUR_MINUTE (D) HOUR_OF_DAT
(62) In Java, by how many ways we can create an array object?
(A) Infinite (B) 1 (C) 2 (D) 3
(63) In Java, by using which sign 1-D array is initialized to separate values of data elements in braces
{}?
(A) . (Full stop) (B) ; (Colon) (C) ; (Semi colon) (D) , (Comma)
(64) In Java, if ‘str’ is the object of string class and its content is ‘Thank God”, then what is the value
of [Link]() ?
(A) 9 (B) 10 (C) 8 (D) 11
(65) In Java, how can be array elements accessed using index for each dimension in?
(A) [ ] (B) ( ) (C) { } (D) < >
(66) In Java by using which of the following methods of comparing string returns ‘>0’ integer if
invoking string is greater than ?
(A) boolean equals (string str) (B) boolean compare to (string str)
(C) int compare to (string str) (D) int compare to ignore (string str)
(67) In Java array what is the process of making an object used to manage list of items?
(A) Declare an array object (B) Create an array object
(C) Both (A) and (B) (D) Define Object Method
(68) Java supports two types of strings that are handled by two classes. Which are they?
(A) String, Buffer String (B) String, String Buffer
(C) String, String Literals (D) String, Buffer
(69) Which constructor can be used without arguments to create a string object with no character?
(A) String ( ) (B) String { } (C) String < > (D) String [ ]
(70) Which of the following tasks are provided by string class?
(A) Appending string. (B) Extracting part of string.
(C) Splitting string into sub string (D) All of these
(71) Which of the following method returns number of characters in invoking string?
(A) int count() (B) int lencount() (C) int length() (D) int len ()
(72) Which of the following method is used to return a string converted to lower case?
(A) Stri ng to Lower Case () (B) String To Lower ()
(C) String () (D) String Lower ()
(73) In Java class, from the followings, which key word is used to call the constructor of super class
in the constructor of sub class ?
(A) Extends (B) Super
(C) Name of the super class (D) New
(74) In Java which method is invoked automatically with creation of an object ?
(A) Instance method (B) Constructor
(C) Class method (D) All of these
(75) How does the Constructor differ from general method in Java ?
(A) It must have the same name as class. (B) It does not have return type.
(C) It can’t be invoked explicitly in the program. (D) All of these
(76) How many levels of visibility are used to protect a method or variable from such reference in
Java?
(A) 1 (B) 2 (C) 3 (D) 4
(77) From which of the following operators can we access instance variables and instance methods?
(A) , (Comma) (B) . (Full stop) (C) : (Colon) (D) ; (Semi colon)
(78) In Java class, in which step a new keyword is used to create the object by allocating memory ?
(A) Declaration (B) Instantiation (C) Initialization (D) All of these
(79) In Java, by which component is the class generally made up of ?
(A) Attributes (B) Behaviour (C) Both (A) and (B) (D) Variable
(80) How do you identify the variable which is define with in a class, out-side any method with the
static key word in Java ?
(A) Local variables (B) Instance variables
(C) Class variables (D) None of these
(81) In Java, which of the following defines attributes and methods?
(A) Class (B) Object (C) Instance (D) Variable
(82) Which of the following is not a basic data type in Java?
(A) char (B) long (C) byte (D) String
(83) What is the default value of boolean type data?
(A) null (B) true (C) false (D) 0
(84) What will be the result of arithmetic expression 7/2?
(A) 3 (B) 3.5 (C) 1 (D) 0
(85) What will be the result of arithmetic expression –7%2 ?
(A) –3 (B) –1 (C) 1 (D) –3.5
(86) What will be the result of arithmetic expression –7.5%2 ?
(A) –3 (B) –1.5 (C) 1.5 (D) Error
(87) What sign is used for creating API documentation form the code?
(A) // (B) /* ..... */ (C) /** ..... */ (D) \\
(88) In Java, which of the following looping is exist controlled?
(A) for (B) while
(C) do.....while (D) if.....then.....else
(89) In Java, which of the following is not allowed as first character in valid variable name?
(A) _ (Underscore) (B) Digit (C) Letter (D) $ (Dollar)
(90) What is known as when program written in Java are compiled in to machine language for a
computer?
(A) Java Visible Machine (B) Java Virtual Machine
(C) Java View Modifier (D) Java Visible Modifier
(91) What is known as post decrement in Java when operator is used after variable name?
(A) ++ (B) – – (C) == (D) =<
(92) Java class is generally made up of which components?
(A) behaviour, variable (B) attributes, behaviour
(C) name, attributes (D) name, variable
(93) A variable declared using class type can store what to an object?
(A) relation (B) root (C) rate (D) reference
(94) In Object-oriented programming languages, creating an object is also called as what?
(A) Object instantiation (B) Oriented installation
(C) Installation (D) Project installation
(95) Whenever two classes have a ‘is-a’ relationship, what is used?
(A) Instant (B) Relations (C) Inheritance (D) Invalue
(96) Which class inherits all instance variables and methods from super class and it may have its
own added variables and methods ?
(A) Out class (B) Super class (C) In class (D) Sub class
(97) Which keyword is used to call the constructor of super class in the constructor of sub class?
(A) super (B) void (C) sub (D) class
(98) Which of the following method is used to return a string after appending ‘str’ with the invoking
string ?
(A) String Append() (B) String concat (string str)
(C) String con Append () (D) String Append (string)
(99) Which class encapsulate both date and time and represent the value using milli-seconds
precision ?
(A) Preci class (B) Sec class (C) Date class (D) Time class
(100) Which of the following method is used to construct date object using current system time ?
(A) System() (B) SystemDate() (C) date() (D) Date()
(101) 1-D array is initialized using comma separated values of data elements using which brackets?
(A) ( ) (B) < > (C) [ ] (D) { }
(102) Sort () and Fill () methods be used in Java by ..... class.
(A) [Link] (B) [Link]
(C) [Link] (D) [Link]
(103) Java supports two types of strings that are handled by which of the following class or classes?
(A) String class (B) String Buffer class
(C) Both (A) and (B) (D) String Constroctor class
(104) In Java, who creates a string object with its initial value using ary argument?
(A) String (ary [objet] [ ]) (B) String (char ary [ ])
(C) String (ary [ ], int len) (D) String (ary ( ))
(105) In Java, characters are stored using how many bytes?
(A) 16 bytes (B) 8 bytes (C) 4 bytes (D) 2 bytes
(106) Which are the methods provided by String class in Java?
(A) To compare strings (B) Find length of strings
(C) Combining strings (D) All of these
(107) In Java which string class method returns true if invoking string is same as str?
(A) int equals (string boolean) (B) boolean (Ignore case str)
(C) boolean equals (string str) (D) boolean (string)
(108) In Java, which of the following allows us to build new class with added capabilities by extending
existing class?
(A) Aggregation (B) Polymorphism
(C) Composition (D) Inheritance
(109) Inheritance model consist of which type of relationship between two classes in Java?
(A) is – a (B) has – a (C) have – a (D) was – a
(110) In Java, a sub class inherits all instance variables and methods from which class?
(A) Derived class (B) Instance class (C) Super class (D) Child class
(111) Composition and Aggregation establish which type of relationship between classes in Java?
(A) has - a (B) is – a (C) was – a (D) as – a
(112) In Java, ‘Visibility Modifiers’ – ‘Protected’ members are available as which members in the
inherited subclass?
(A) Object (B) Public (C) Instance (D) Private
(113) In Java, while using inheritance – “Child class” can be referred to as which of the following?
(A) Sub class (B) Derived class (C) Extended class (D) All of these
(114) Which of the following is the keyword used to refer a super class constructor in sub class
constructor?
(A) Name of subclass (B) New
(C) Super (D) Extends
(115) In Java, which variable are defined with in a class, outside any method with static keyword?
(A) Global variable (B) Class variable
(C) Instance variable (D) Local variable
(116) String literals in Java is a sequence of characters which can be enclosed in which of the
following ?
(A) $ ..... $ (B) “ ” (C) ` ` (D) ‘ ’
(117) In Java, documentation comments begins and ends with which of the following?
(A) /** ..... */ (B) /* ..... */ (C) /* ..... / (D) //
(118) Arithmetic operators in Java, can be applied on which numeric data?
(A) short (B) float (C) byte (D) All of these
(119) In Java,which of the following is known as unary operators for increment and decrement
operators?
(A) >== and <= (B) + and – (C) == and != (D) + + and - -
(120) Which of the following is considered as comparison operator in Java?
(A) = (B) / (C) % (D) !=
(121) In Java, logical operators are also called which of the following operators if they operate on
Boolean operands ?
(A) Assignment operator (B) Boolean operator (C) Increment operator (D) Relational operator
(122) In Java, conditional uses which two symbols in expression to delimit three operands?
(A) ? and * (B) . and : (C) ? and : (D) : and ;
(123) In Java, a block statement is a group of statements enclosed between which pair of braces?
(A) [/ ..... /] (B) { } (C) ( ) (D) [ ]
(124) A sub class can be derived from which class?
(A) over class (B) super class (C) main class (D) own class
(125) Instance variables and instance methods are accessed via objects. They can be referred by
using which operator?
(A) // (B) dot (.) (C) $ (D) #
(126) Which type of variables are defined within a class but outside any method?
(A) Class variable (B) Empty variable
(C) Local variable (D) Instance variable
(127) In Java, we can have different methods that have the same name but a different signature is
also called as what ?
(A) Method overloading (B) Variable overloading
(C) Class overloading (D) Signature overloading
(128) To provide an user defined no-argument constructors, which of the following command is used
?
(A) school (float I, float j); (B) school (int i);
(C) school ( ) { }; (D) school { } ( );
(129) Who established a “has – a” relationship between class?
(A) Composition and Aggregation (B) Method and Object
(C) Relation and Method (D) Inheritance and Aggregation
(130) Java have a ..... that looks for unused objects and reclaims the memory that those objects are
using.
(A) reclaim collector (B) unused collector
(C) memory collector (D) garbage collector
(131) The word polymorphism means what?
(A) Many forms (B) Virtual forms (C) One form (D) User forms
(132) Which type of arrays are used to store tabular data in the form of rows and columns?
(A) 1-D (B) 2-D (C) 3-D (D) All of these
(133) If user wants to store 15 integer values through arrays, then which of the following is used?
(A) int m3 = new int [5] [3] (B) int m2 = new [5] [3]
(C) int m1 = new [15] [15] (D) int m4 = m4 int [2] [3]
(134) If ‘str’ is the object of string class and its content is “INDIAN FLAG”; then what is the value of
[Link]()?
(A) 11 (B) 8 (C) 10 (D) 9
(135) Which constant is used to display year of calendar?
(A) CAL (B) YEAR CAL (C) YEAR (D) MONTH
(136) Which constant is used to display Hour in 12-hour notation?
(A) 12 HOUR (B) HOUR 12 (C) Hour_of_day (D) HOUR
(137) Which constant is used to display Day number in the year?
(A) DAY_OF_YEAR (B) YEAR_DAY (C) YEAR (D) DAY_YEAR
(138) Vector is used to represent ..... dimensional data structure.
(A) 1 (B) 2 (C) 3 (D) 4
(139) What is useful to represent vector, matrix and other multi-dimensional data?
(A) String (B) Arrays (C) Char (D) Integer
(140) if int mark[ ]={70, 90, 20} is defined, then what will be value of marks[2] ?
(A) 20 (B) Error (C) 70 (D) 90
(141) The array variable starts its index value with what?
(A) Null (B) 2 (C) 1 (D) 0
(142) What is a variable representing a collection of homogeneous types of elements known in Java?
(A) String (B) Array (C) Input (D) Element
(143) Which of the following refers to the starting index value in arrays in Java?
(A) 3 (B) 2 (C) 1 (D) 0
(144) Which type of method is used to sort entire or part of array in Java?
(A) sort() (B) fill() (C) show() (D) search()
(145) On Linux system, which of the following is the most common archive format ?
(A) PAR (B) JAR (C) JER (D) TAR
(146) Which of the following is a free software environment for statistical computing?
(A) T Software (B) S Software (C) R Software (D) N Software
(147) Which of the following is used as a comment marker in R software ?
(A) % (B) $ (C) @ (D) #
(148) If ‘str’ is the object of string class and its content is “Hello” then what is the value of
[Link]()?
(A) 5 (B) 6 (C) 7 (D) Error
(149) In Java, which of the following method can be used with [Link] class?
(A) sort ( ) (B) fill( ) (C) alert( ) (D) Both (A) and (B)
(150) In Java, to search an element in an array, Arrays class provides which method?
(A) Binary search() (B) String search()
(C) Element search() (D) Line Indsearch()
(151) In Java, 2-D array can be declared in which of the following correct way?
(A) int marks () () = new int [5] [3] (B) int marks {} {} = new int [5] [3]
(C) int marks [] [] = new int [5] [3] (D) int marks <> <> = new int [5] [3]
(152) Control structure branches are used to choose among two or more possible courses of action,
is called as what?
(A) More structure (B) Loop structure
(C) Addition structure (D) Selective structure
(153) Switch statement can be stopped using which statement?
(A) break (B) run (C) loop (D) error
(154) do..... while loop is which type of loop?
(A) Loop controlled (B) Break controlled (C) Exit controlled (D) Entry controlled
(155) To use a labeled loop, which symbol is added before the loop?
(A) * (B) $ (C) : (D) #
(156) In Java, the text written in /* ..... */ is considered as what?
(A) Method (B)Comment (C) Function (D) Variable
(157) User can create Java source file by using .....application.
(A) SciTE editor (B) ASCII text editor (C) Both (A) and (B) (D) None of these
(158) The definition of the method (function) in Java consists of function header and the sequence of
statement enclosed in which bracket?
(A) { } (B) < > (C) ( ) (D) [ ]
(159) Java supports how many primitive data types?
(A) 3 (B) 8 (C) 4 (D) 7
(160) Which of the following data type is used for real numbers?
(A) short (B) char (C) long (D) double

You might also like