This document provides a summary of a workshop on objective type questions related to the Informatics Practices syllabus. It includes 25 multiple choice questions covering topics like string methods, Math functions, and object-oriented programming concepts. The questions range from basic knowledge to more advanced reasoning and are meant to help students prepare for objective exams.
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
85 views
CH 5 MCQ
This document provides a summary of a workshop on objective type questions related to the Informatics Practices syllabus. It includes 25 multiple choice questions covering topics like string methods, Math functions, and object-oriented programming concepts. The questions range from basic knowledge to more advanced reasoning and are meant to help students prepare for objective exams.
based / Conceptual Understanding/ Reasoning Based/Skill Based) 1. To round off a number to its nearest integer we can use c) Math.round() Knowledge based a) Math.pow() b) Math.abc() c) Math.round() d) Math.roundOff() 2. The output of following code b) 1 Knowledge based jTextField1.setText(Math.pow(2,0)); a) 2 b) 1 c) 0 d) -1 3 A student wants to calculate 2 raise to power 35.Identify c) Math.pow(2,35) Knowledge based the correct function. a) Math.pow(35,2) b) Math.power(2,35) c) Math.pow(2,35) d) Math.pow(35,35) 4 Find the output: c) RadheyShyam Skill based String s1=”Radhey”,s2=”Shyam”,s3; s3=s1+s2; jTextField1.setText(s3); a) radheyshyam b) Radheyshyam c) RadheyShyam d) ShyamRadhey 5 Math in JAVA is a c) Native class Knowledge based a) Object b) Method c) Native class d) None of these 6 What will be the output of the following code: b) COMPUTER Skill based String a=”computer”; a=a.toUpperCase(); a) computer b) COMPUTER c) Computer d) cOMPUTER 7 What is the index of character ‘a’ in the given in string b) 4 Skill based “permanent” in JAVA? a) 3 b) 4 c) 5 d) 6 8 Which String function is used to remove the spaces c) trim Skill based from any String in JAVA? a) Ltrim b) Rtrim c) trim d) none of the above 9 What will be the output of the following command? a) a)informatics Skill based String x=”informatics”; 11 int a=x.length(); jTextField1.setText(“”+x+a); a) informatics11 b) 11informatics c) 22 d) informatics 10 Which math function requires 2 arguments in JAVA? a) Math.pow() Knowledge based a) Math.pow() b) Math.power() c) Math.raise() d) Math.round() 11 Which 2 datatypes can be accepted by round function? c) float ,double Understanding a) int,float b) float,long c) float,double d) int,long 12 Which string function returns an int type value? c) length Knowledge based a) substring b) len c) length d) trim 13 A class is a collection of ……………. d) all of the Knowledge based a) data above b) method c) data and method d) all of the above 14 Which method returns the closest long to the double Knowledge based argument? b) a) Math.pow(double a,double b) Math.round(double b) Math.round(double a) a) c) Math.round(float a) d) All of the above 15 The first position of string in JAVA is labelled as: a) 0 Skill based a) 0 b) 1 c) Either 0 and 1 d) -1 16 Which function returns the object as a string: Knowledge based a) round() c)trim b) length() c) trim() d) none of the above 17 Which class contains methods for basic numerical c) Math Understanding operations like rounding off the number: a) Number b) String c) Math d) Integer 18 What is java.lang? d) package Knowledge Based a) class b) object c) variable d) package 19 Which one is correct in context of round function in a) it executes on Knowledge based JAVA? both float and a) it executes on both float and double datatype. double datatype b) It execeutes on only double datatype c) It executes on only float datatype d) None of these 20 An…….is an instance of a class that is capable of b) object Knowledge based holding actual data in memory locations. a) class b) object c) inheritance d) encapsulation 21 To use the round function in JAVA which package is b) java.lang Knowledge Based automatically imported. a) java.sql b) java.lang c) java.awt d) java.net 22 A user wants to store the result of substring function c) String Knowledge based inside an object. What will be the datatype of that object? a) int b) char c) String d) float 23 A blueprint of an object is called knowledge based a) object b) class b) class c) double d) char 24 Amit wish to display all the characters in capital letter of b)toUpperCase skill based a string.Which of the following function he should use? a) toUpper b) toUpperCase c) upper d) ucase 25 Ashok executes the following statements: c) t skill based String str1=”international”; String strr2=str1.substring(2,3); What is the value of str2? a) ter b) nte c) t d) n 1. If str1=”Welcome Home”, then what will “Hello (a) World”.substr(2,5) give output ? (a) llo (b) low (c) lo (d) ell 2. If Math.pow(2,-0), what will be the output of the above (a) method ? (a) 1.0 (b) 0 (c) -1.0 (d) 0.0 3. Which of the following methods accepts an argument (c) for its execution ? (a) toLowerCase() (b) length() (c) pow() (d) toString() 4. Which of the following statement is false (b) (a) Math class contains built-in methods (b) It is necessary to import java.lang package for Math class (c) Return type of length( ) method is integer (d) Pow(d1,d2) method returns the value of d1 raised to d2 5. Which of the following is not a valid method of the (a) Math class (a) concat(String a) (b) round(double a) (c) pow(double a, double b) (d) round(float a) 6. What will be the value of R after execution of the given (a) code ? double R=Math.round(5.5*1000)/200; (a) 27.5 (b) 27.0 (c) 25 (d) None of the above 7. What is the output of z (a) double z=Math.pow(2,0, 3.0); (a) 8.0 (b) 2.0 (c) 4.0 (d) 9.0 8. What will be the output of “#Object%Oriented (a) %Programming@”.length(); [ % represents space ] (a) 29 (b) 28 (c) 30 (d) 31 9. Which of the following is a valid method of String class (b) in Java ? (a) size() (b) length() (c) range() (d) extent() 10. What will be the value of x after the following code is (a) executed ? String str=”BOARD”; int x=str.length(); (a) 5 (b) 6 (c) 7 (d) None of these 11. Which of the following statement is true ? (b) (a) length() returns the output in String data type (b) length() returns the output in integer data type (c) length()returns the output in float data type (d) length() returns the output in char data type 12. Which of the following require an argument ? (d) (a) toUpperCase() (b) toLoweCase() (c) length() (d) concat() 13. What will be the value of str2 after the execution of (b) following code ? String str1=”Informatics”; String str2=str1.substring(0,2); (a) or (b) In (c) Cs (d) Fo 14. What will be the content of str3 after the execution of (b) following code ? String str1=”HAPPY”; String str2=”DIWALI”; String str3=str1.concat(str2); (a) DIWALIHAPPY (b) HAPPYDIWALI (c) HAPPY (d) DIWALI 15. toString() returns the ______________ as a string. (c) (a) Null (b) Error (c) Object (d) void 16. What will be the value of f after executing the following (b) code : String F1=”D#I#G#I#T#A#L”; int f=F1.length(); (a) 7 (b) 13 (c) 13.0 (d) 6 17. What will be the value of ans after executing the (d) following code : String str=”@@@information@@@”; String ans=str.trim(); (a) Information (b) @@@@@@ (c) @@@information (d) @@@information@@@ 18. What will be the correct output of the following code : (b) Name=”Good Morning”; if (Name.length()>10) { Name.concat(“Everyone”); } else { Name.conat(“Guest”); } What will be the correct output ? (a) Everyone (b) Good Morning Everyone (c) Good Morning Guest (d) Guest 19. “Examination”.concat(“reforms”),concat(“inIndia”) will (b) give the output as : (a) Error (b) ExaminationreformsinIndia (c) ExaminationinIndia (d) Examinationreforms 20. Identify the native class of Java ? (d) (a) Math (b) String (c) JOptionPane (d) All of the above