Page 273 - IT-802_class_12
P. 273

Computational thinking
            C.  Competency-based/Application-based question:
               Rani runs a program in Java using some of the variable names as follows. State whether these variable names are valid or
               invalid in Java.
                 i.  print
                 ii.  first_firstname
                 iii. 123smart
                 iv. USER NAME
                 v.  Com$Science
             Ans.  i. Invalid     ii. Valid      iii. Invalid     iv. Invalid     v. Invalid


            Unsolved Exercise



                                                            Section A
                                                     (Objective Type Questions)

            A.  Choose the correct option.
               1.  Which statement is true about Java?
                 i.  Java is a sequence-dependent programming language   ii.  Java is a code dependent programming language
                 iii. Java is a platform-dependent programming language   iv.  Java is a platform-independent programming language
               2.  Which of the following is FALSE about arrays in Java?
                 i.  A java array is always an object
                 ii.  Length of array can be changed after creation of array
                 iii. Arrays in Java are always allocated on heap
                 iv. None of these
               3.  How many primitive data types are there in Java?
                 i.  6                                             ii.  7
                 iii. 8                                            iv.  9
               4.  Which of these cannot be used for a variable name in Java?
                 i.  identifier & keyword                          ii.  numbers
                 iii. alphabets                                    iv.  None of these
               5.  What is the extension of Java code files?
                 i.  .js                                           ii.  .txt
                 iii. .class                                       iv.  .java
               6.  Which of these is selection statement in Java?
                 i.  break                                         ii.  continue
                 iii. for()                                        iv.  if()
               7.  Which of these keywords is used for the block to be examined for exceptions?
                 i.  check                                         ii.  throw
                 iii. catch                                        iv.  try
               8.  Which among the following is not a data type in Java?
                 i.  short                                         ii.  int
                 iii. long double                                  iv.  double
              9.  ............................ are special symbols that execute specific operations in a programming language.
                 i.  Operators                                     ii.  Data types
                 iii. Variables                                    iv.  None of these
              10.  Choose a valid loop name in Java below.
                 i.  for                                           ii.  while
                 iii. do while                                     iv.  All of these

                                                                               Fundamentals of Java Programming  271
   268   269   270   271   272   273   274   275   276   277   278