chapter-Programming Fundamentals

Important MCQ-Based Questions on Informatics Practices (IP) class 11 chapter-Programming Fundamentals

This page consists of Important MCQ-Based Questions on Informatics Practices (IP) class 11 chapter-Programming Fundamentals all the questions are uploaded for practice with detailed explanations of every question. To check the solution, click on the answer. 

Find below Important MCQ-Based Questions on Informatics Practices (IP) class 11 chapter-Programming Fundamentals

Important Questions for Informatics Practices (IP) class 11 chapter-Programming Fundamentals set-1

Informatics Practices - MCQ on Programming Fundamentals

Class XI

Q.1 The other name for floating literals is

a) real literals.

b) constant literals.

c) boolean literals.

d) string literals.

Answer:

(a)

Explanation: Real literals are numbers having fractional parts.

Q.2 Among the following, the invalid real literal is

a) 3.8

b) -15.89

c) 18,98.67

d) -7.8

Answer:

(c)

Explanation: Commas are not allowed in real constants.

Q.3 Among the following, the valid real literal is

a) -0.00987

b) 1745.98.8

c) 7.

d) 67

Answer:

(a)

Explanation: The other options are invalid because of following reasons:

· 1745.98.8 has two decimal points.

· In “7.”, there is no digit after decimal point.

· In 67, there is no decimal point.

Q.4 Among the following, the valid real literal is

a) 172.E4

b) 1.3E

c) -0.138E-2

d) .23E-2

Answer:

(c)

Explanation: The other options are invalid because of following reasons:

· 172.E4- At least a digit must follow the decimal point.

· 1.3E – No digit specified for exponent.

· .23E-2 – No preceding digits before decimal point.

Q.5 The characters that cannot be typed directly from the keyboard are called

a) graphic characters.

b) non-graphic characters.

c) string characters.

d) missing characters.

Answer:

(b)

Explanation: These non-graphic characters can be represented by using escape sequences.

Q.5 Backspace, tab, carriage return, etc. are examples of

a) graphic characters.

b) string characters.

c) missing characters.

d) non-graphic characters.

Answer:

(d)

Explanation: The characters that cannot be typed directly from the keyboard are called

non-graphic characters. These can be represented by using escape sequences.

Q.7 The size of “xyz” is

a) 3 bytes.

b) 4 bytes.

c) 6 bytes.

d) 9 bytes.

Answer:

(c)

Explanation: Each character takes two bytes.

Q.8 The size of “\aditi” is

a) 6 bytes.

b) 10 bytes.

c) 11 bytes.

d) 12 bytes.

Answer:

(b)

Explanation: \a is treated as one character. So total is 5 characters, and each character takes 2 bytes.

Q.9 The total number of punctuators available is

a) 5.

b) 7.

c) 8.

d) 9.

Answer:

(d)

Explanation; There are 9 separators (or punctuators) available. These are:

( ) { } [ ] ; , .

Q.10 The number of primitive data types in Java are

a) five.

b) six.

c) seven.

d) eight.

Answer:

(d)

Explanation: Java provides 8 primitive data types, which are: byte, short, int, long, float, double, char, boolean.

Q.11 Classes, arrays, and interface are examples of

a) primitive data types.

b) reference data types.

c) fundamental data types.

d) boolean data types.

Answer:

(b)

Explanation: The variables storing memory addresses are known as reference variables and their data type is known as reference data type.

Q.12 The number of categories of primitive data types supported by Java are

a) two.

b) three.

c) four.

d) five.

Answer:

(c)

Explanation: The four categories of primitive data types are: Numeric Integral primitive types, Fractional primitive types, Character primitive types, Boolean primitive types.

Q.13 The number of numeric data types available in Java are

a) two.

b) three.

c) four.

d) five.

Answer:

(c)

Explanation: There are four numeric integral types in Java: byte, short, int, and long.

Q.14 The size of one byte of data type is equal to

a) 8 bits.

b) 16 bits.

c) 32 bits.

d) 64 bits.

Answer:

(a)

Explanation: The range of one byte length integer is from -128 to +127.

Q.15 All data types supported in Java are

a) unsigned data types.

b) signed data types.

c) positive numbers only.

d) negative numbers only.

Answer:

(b)

Explanation: Java supports signed data types only, which means they can store negative as well as positive numbers.

Q.15 The size of one short data type is equal to

a) 8 bits.

b) 16 bits.

c) 32 bits.

d) 64 bits.

Answer:

(b)

Explanation: The range of one short integer is from -32,768 to +32,767.

Q.17 The size of one long data type is equal to

a) 8 bits.

b) 16 bits.

c) 32 bits.

d) 64 bits.

Answer:

(d)

Explanation: One long integer is equal to 8 bytes.

Q.18 The size of one float data type is equal to

a) 8 bits.

b) 16 bits.

c) 32 bits.

d) 64 bits.

Answer:

(c)

Explanation: A float data type is single-precision floating point. It is equal to 4 bytes = 32 bits.

Q.19 The size of one double data type is equal to

a) 8 bits.

b) 16 bits.

c) 32 bits.

d) 64 bits.

Answer:

(d)

Explanation: A float data type is a double-precision floating point. It is needed for large numbers, or high precision, such as for astronomy or subatomic physics.

Q.20 The size of one char data type is equal to

a) 8 bits.

b) 16 bits.

c) 32 bits.

d) 64 bits.

Answer:

(b)

Explanation: The character data type is used to store characters. A character in Java can represent all ASCII as well as Unicode characters.

Q.21 Unicode characters can be represented in

a) 8 bits.

b) 16 bits.

c) 32 bits.

d) 64 bits.

Answer:

(b)

Explanation: Java programs display characters from the Unicode character set.

Q.22 A data element whose value is an address of a memory location is a/an

a) object.

b) class.

c) reference.

d) string.

Answer:

(c)

Explanation: A reference is called a pointer or a memory address in other languages.

Q.23 A named memory location, which holds a data value of a particular data type is a

a) variable.

b) reference.

c) string.

d) object.

Answer:

(b)

Explanation: Variables represent named storage locations, whose values can be manipulated.

Q.24 Among the following, the correct declaration of a variable salary, wage of type float is

a) salary, wage float;

b) float, salary, wage,

c) float salary; wage;

d) float salary, wage;

Answer:

(d)

Explanation: A simple definition consists of a type specifier followed by a variable name, and terminated by semicolon. In case of more than one variable, they are separated by commas.

Q.25 A variable whose lifetime extends across the entire run of the program is a

a) automatic variable.

b) static variable.

c) local variable.

d) extern variable.

Answer:

(b)

Explanation: A static variable is a variable that has been allocated statically.

Q.25 A method that returns the text currently stored in a text based GUI component is

a) getText().

b) parse() method.

c) setText().

d) returnText().

Answer:

(a)

Explanation: The Swing components that support getText() method include: TextField, TextArea, Button, Label, etc.

Q.27 The getText() method returns a value of

a) integer type.

b) character type.

c) string type.

d) boolean type.

Answer:

(c)

Explanation: It returns the text currently stored in a text based GUI component.

Q.28 parse() methods are used to obtain

a) text i.e., string type of data from a GUI component.

b) boolean type of data from a GUI component.

c) numeric type data from a GUI component.

d) character type of data from a GUI component.

Answer:

(c) Explanation: parse() methods are used to convert textual data into a numeric type. For example: when we want to read age of a person through text field.

Q.29 An identifiable entity with some characteristics and behaviour is known as

a) class.

b) object.

c) group.

d) module.

Answer:

(b)

Explanation: Object is the root of class hierarchy. It is a discrete entity with some characteristics and behaviour.

Q.30 The process of creating an object is called

a) object creation.

b) object formation.

c) instantiation.

d) instant object.

Answer:

(c)

Explanation: An object is an instance of a class. It is the root of class hierarchy and the process of creating it is called instantiation.

Important Questions for Informatics Practices (IP) class 11 chapter-Programming Fundamentals set-2

Q.31 A list of instructions where each statement tells the computer to do something, is called

a) data.

b) information.

c) program.

d) method.

Answer:

(c)

Explanation: A program is a set of instructions, which tell the computer the task, it has to perform.

Q.32 The programming methodologies which do not model the real world very well are

a) object based and object oriented programming.

b) structural and object oriented programming.

c) procedural and modular programming.

d) procedural and object oriented programming.

Answer:

(c)

Explanation: The drawbacks of procedural and modular programming are removed by object oriented programming technique. So, only object oriented can model the real world well.

Q.33 While programming using OOP approach, the characteristics of an object are represented by its

a) behaviour.

b) attributes.

c) data.

d) functions.

Answer:

(c)

Explanation: The characteristics of an object are represented by its data. For example- if orange is an object, then its colour and shape are data.

Q.34 While programming using OOP approach, the behaviour of an object is represented by its

a) characteristics.

b) functions.

c) data.

d) actions.

Answer:

(b)

Explanation: An object represents an entity that can store data and has its interface through functions. For example-if orange is an object, then it’s behaviour is that it is juicy and it tastes sweet sour.

Q.35 The general form of a conditional operator is

a) expr1? expr2 ? expr3.

b) expr1: expr2 ? expr3.

c) expr1? expr2 ; expr3.

d) expr1? expr2 : expr3.

Answer:

(d)

Explanation: It gives the value of expr2 if expr1 evaluates to true otherwise it gives the value of expr3.

Q.35 The expression “ 6.8 % 2.2 “ when evaluated, will give the result

a) as error.

b) 0.

c) 0.2.

d) 3.

Answer:

(a)

Explanation: Modulus operator requires two int operands and not the float ones.

Q.37 The result of the following two expressions, if initially I=20, is

1++I<=20 2 I++<=20

a) true true.

b) false true.

c) false false.

d) true false.

Answer:

(b)

Explanation: Pre increment operator firsts increments the value and then prints the value, whereas post increment operator first prints the value and then increments it.

Q.38 The result of the below code, if initially a = 100, is

a+= a++ + ++a

a) 202.

b) 302.

c) 303.

d) 304.

Answer:

(d)

Explanation: Step wise process is a+= 100+102, a+=202, a= 102 +202 =304

Q.39 Given int a, b, c, d ; float p, q, r; double x, y, z ;

The example of valid arithmetic expression is

a) (sqrt (a) *b ) – c.

b) a +- b * c / d.

c) x + * r.

d) p / q + a – * c.

Answer:

(a)

Explanation: Here, two operators are in continuation in rest of the options.

Q.40 Given int a, b, c, d ; float p, q, r; double x, y, z ;

The example of valid arithmetic expression is

a) (sqrt (a) *-b ) – c.

b) q (a + b- z /4 ).

c) a + b * c / d.

d) p / q a – c.

Answer:

(c)

Explanation: Operator is missing between q and a in 2nd and 4th options. Two operators are in continuation in 1st option.

Q.41 Given int x, y, z, d; float p, q, r; double a, b, c ;

The example of valid arithmetic expression is

a) (ceil (p) +/ x ) z.

b) c/a +p * x / z.

c) log (-18 + x/ y.

d) a + b c / d.

Answer:

(b)

Explanation: Logarithm of a negative number is not possible. So it is a domain error in 3rd option. Two operators are in continuation in 1st option and operator is missing between b and c in 4th option.

Q.42 The process of converting one predefined type into another is called

a) type conversion.

b) typedef.

c) type expression.

d) integral promotion.

Answer:

(a)

Explanation: Constants and variables are mixed in an expression, then they are converted to same type. This is called as type casting or type conversion.

Q.43 If Student is an object, then roll no, name, marks, etc. are its

a) classes.

b) behaviour.

c) methods.

d) attributes.

Answer:

(d)

Explanation: These are the characteristics or properties. Its behavior is: it takes rest, it attends lectures, etc.

Q.44 The term used to refer to an instance of a class is

a) object.

b) class value.

c) reference.

d) method.

Answer:

(a)

Explanation: An object consists of data and methods. It is the value of the class type.

Q.45 The general form of an assignment statement is a=xyz, where

a) “xyz” is the target variable and “a” can be a constant or variable or expression.

b) “a” is the target variable and “xyz” can be a constant or variable or expression.

c) “a” is the target variable and “xyz” is a constant always.

d) “a” is the target variable and “xyz” is a constant or variable only.

Answer:

(b)

Explanation: An assignment statement assigns a value to the variable.

Q.45 The valid logical expression is

a) x<= ! y && z.

b) (-/y).

c) a+b > && z.

d) (x-<y).

Answer:

(a)

Explanation: Two operators cannot occur in continuation.

Q.47 If initially I=20, then the result of following expression is

++I<=20

a) 20.

b) 21.

c) false.

d) true.

Answer:

(c)

Explanation: Pre increment operator first increments the value and then prints.

Q.48 If I=50, then the result of the following expression is

I++<=50

a) 50.

b) true.

c) 51.

d) false.

Answer:

(b)

Explanation: Post increment operator first prints the value and then increments.

Q.49 In Java, statements are terminated with a

a) colon.

b) semicolon.

c) comma.

d) full stop.

Answer:

(b)

Explanation: Semicolon (;) is used to terminate statements in Java. The simplest statement is null statement, or empty statement.

Q.50 The logical expression to represent the condition “exp is an uppercase letter” is

a) exp <= 65 && exp >= 90.

b) exp >= 65 || exp <= 90.

c) exp >= 65 && exp <= 90.

d) exp > 65 && exp < 90.

Answer:

(c)

Explanation: The ASCII codes for uppercase characters are from 65 to 90.

Q.51 The operator that accesses instance members of an object or class members of a class is

a) dot (.) operator.

b) () operator.

c) (type) operator.

d) instance operator.

Answer:

(a)

Explanation: Dot operator is used to access class, structure, or union members. It is also used to test or set the properties of an object or top-level class.

Q.52 The operator that tests whether its first operand is an instance of its second, is called

a) dot (.) operator.

b) () operator.

c) (type) operator.

d) instance operator.

Answer:

(d)

Explanation: The syntax is: op1 instance of op2

Here op1 must be the name of an object and op2 must be the name of a class.

Q.53 A group of objects that share common properties and relationships is called

a) module.

b) class.

c) abstract.

d) data.

Answer:

(b)

Explanation: A class is a template or blue-print representing a group of objects that share common properties.

Q.54 Java, C++, Smalltalk are examples of

a) modular languages.

b) procedural languages.

c) structural languages.

d) object-oriented languages.

Answer:

(d)

Explanation: Object oriented programming is a type of programming in which the programmer defines the data types of a data structure and associated operations. To perform an object oriented programming, one needs an object oriented programming language (OOPL).

Informatics Practices

Frequently Asked Questions on chapter-Programming Fundamentals