Search This Blog

Friday, 5 November 2021

UNIT 03. INPUT/OUTPUT HANDLING in C++ - MCQs - Computer Science For Class X

GO TO INDEX

Computer Science For Class X
Unit 03: Input / Output Hnadling In C++
Multiple Choice Questions And Fill In The Blanks

Multiple Choice Questions (MCQs)

By Mrs. Ayesha Arif
Vice Principal
(Jauhar Progressive School)


A. ENCIRCLE THE CORRECT ANSWER:
i) The C++ header file contains function prototype for the standard Input and Output functions.
a. <iomain.h>
b. <iostream> ✓
c. <fstream.h>
d. <cstdio.h>

ii) Which operator is used for input stream?
a. >
b. <<
c. >> ✓
d. <

iii) gets stands for
a. get stream
b. get string ✓
c. get str
d. get std

iv) getch() and getche() are included in header file.
a. <cstdio.h>
b. <conio.h> ✓
c. <stdlib.h>
d. <stdio.h>

v) Which operator is used for logical AND operation?
a. &
b. && ✓
c. ||
d. !

vi) Which of the following operator is correct to compare two values of variables?
a. =
b. <=
c. ==
d. both b and c ✓

vii) Which of the following needs pressing Enter Key from the keyboard?
a. getch( )
b. getche( )
c. getchar( ) ✓
d. gets( )

viii) != operator belong to which type of operator.
a. Relational ✓
b. Logical
c. Arithmetic
d. None of these

ix) Which operator add the first operand to the second operand and gives the result to first operand.
a. *=
b. += ✓
c. ++
d. +

x) cout « 12-6/2; What will be the result on screen?
a. 3
c. 6
c. 9 ✓
d.12


MORE MCQs


11) The C++ program consists of __________________ parts.
a. 3 ✓
b. 4
c. 7
d. 2

12) It is used to include header files like iostream, conio.h, etc.
a. gets ( )
b. compiler
c. main( )
d. #include ✓

13) It is the collection of identifiers.
a. gets ( )
b. namespace ✓
c. main( )
d. #include

14) The ________ function is compulsory element of the C++ program.
a. gets ( )
b. namespace
c. main( ) ✓
d. puts ( )

15) The comment statements are those statements that are ignored by the ________.
a. operators
b. Compiler ✓
c. identifiers
d. terminator

16) The ________ are not executable.
a. gets ( )
b. namespace
c. comment statements ✓
d. #include

17) ________ is a standard library file that contains definitions of Standard Input and Output functions.
a. return value
b. multi line comment
c. cout statement
d. I/O Stream ✓

18) cout is an ___________ object.
a. input
b. output ✓
c. comment
d. statement

18) ________ is used to display the output through output device like monitor.
a. cout ✓
b. return value
c. main( )
d. #include

20) __________ is a string function and it is included in <cstdio> header file.
a. gets ( )
b. puts ( ) ✓
c. main( )
d. getch ( )

21) cin works as an___________________ object in C++.
a. statement
b. output
c. comment
d. input ✓

22) Statement terminator (;) is used for statement _________ in C++ programming.
a. middle
b. beginning
c. ending ✓
d. writing

23) Escape Sequences is a ________ characters.
a. non - printable ✓
b. printable
c. specific
d. executable

24) Escape Sequences is used only with ___________ statement.
a. cout ✓
b. return value
c. main( )
d. #include

25) These are special symbols used for specific purposes.
a. compilers
b. Operators ✓
c. identifiers
d. terminators

26) Each escape sequence must start with___:
(a) & (and sign)
(b) / (forward slash)
(c) \ (back slash) ✓
(d) % (percentage sign)

27) The multi-line comment begins with the character set of ____:
(a) */
(b) /* ✓
(c) \*
(d) *\

28) <stdio.h> is ____ file.
(a) Document file
(b) Spreadsheet file
(c) Header file ✓
(d) Executable file

29) Every C++ program must have this function.
(a) cout( )
(b) main ( ) ✓
(c) cin( )
(d) None of these

30) In this statement "int main(void)" the second void is:
(a) Return type
(b) Argument ✓
(c) Function
(d) Variable

31) The # symbol is called ____ directives.
(a) Preprocessor ✓
(b) Multiprocessor
(c) Postprocessor
(d) None of these

32) All C++ statements must end with:
(a) comma (,)
(b) semicolon (;) ✓
(c) >
(d) <

33) This is a statement terminator in C++.
(a) ()
(b) "
(c) ; ✓
(d) :

34) Single line comment written in C++ with ___ symbol.
(a) /+
(b) // ✓
(c) *
(d) None of these

35) gets ( ) function is used to input data type:
(a) Character
(b) Integer
(c) Float
(d) None of them ✓

36) getche ( ) function gets a character and the character:
(a) Display ✓
(b) Print
(c) Read
(d) Variable

37) cin( ) statement is used to data from standard input device:
(a) Process
(b) Input ✓
(c) Output
(d) None of them

38) In which logical operator, the result of operation will be true, if both operands are true, otherwise false:
(a) NOT
(b) AND ✓
(c) OR
(d) None of them

39) Logical NOT operator takes operand:
(a) Two
(b) Three
(c) Four
(d) None of them ✓

40) The remainder operator (%) requires that both operands be:
(a) Float
(b) Integer ✓
(c) Double
(d) Character

41) Relational operators are used to two operands:
(a) Add
(b) Combine
(c) Compare ✓
(d) Collect

42) Increment and decrement operators operate on only one operand and are called:
(a) Unary operator ✓
(b) Binary operator
(c) Ternary operator
(d) None of these

43) \n escape sequence is used to move the cursor to:
(a) New page
(b) New line ✓
(c) New paragraph
(d) New section

44) Equality operator is denoted by:
(a) =
(b) == ✓
(c) !=
(d) None of them

45) The symbol >> is called:
(a) New line symbol
(b) Output operator
(c) Insertion operator ✓
(d) None of them

46) Which of the following operator works only with integer variables?
(a) Increment
(b) Decrement
(c) Binary operator
(d) Both increment & decrement ✓

47) If an increment or decrement operator is placed after a variable, it is called as:
(a) Pre-increment and Pre-decrement
(b) Post-increment
(c) Post-decrement
(d) Post-increment and Post-decrement ✓

48) Which of the following escape sequence represents carriage return?
(a) \r ✓
(b) \n
(c) \n\r
(d) \c

49) What value does the variable a have, after all of the code executes?
int a =1;
int b;
b = a++;

(a) 2 ✓
(b) 1
(c) 3
(d) Unknown / undefined

50) Those operators that require two operands are known as:
(a) Unary operators
(b) Binary operators ✓
(c) Ternary operators
(d) None of them

Fill In The Blanks:

1. The C++ program consists of three parts, Preprocessor Directives, main Function header and Body of program.
2. #include is used to include header files like iostream.h, conio.h, etc.
3. namespace is the collection of identifiers.
4. The main( ) function is compulsory element of the C++ program.
5. The comment statements are those statements that are ignored by the compiler.
6. The comment statements are not executable.
7. I/O Stream is a standard library file that contains definitions of Standard Input and Output functions.
8. cout is an output object.
9. cout is used to display the output through output device like monitor.
10. puts() is a string function and it is included in <cstdio> header file.
11. cin works as an input object in C++.
12. Statement terminator (;) is used for statement ending in C++ programming.
13. Escape Sequences is a non - printable characters.
14. Escape Sequences is used only with cout statement.
15. Operators are special symbols used for specific purposes.
16.Arithmetic Operator are used for arithmetic operations or calculation.
17. Increment and Decrement Operator are used in two different ways in programming, such as Prefix and Postfix.
18. Relational Operators are used to test the relation between two values.
19. Logical Operators are used to determine two relational expression.
20. Relational and Logical Operators works on a decision making and loops.


 



8 comments:

  1. When would you upload chap 3 question answer?

    ReplyDelete
    Replies
    1. Education Is The Key To Success11 December 2021 at 06:34

      From tomorrow we will start upload chapter 3 notes INSHALLAH

      Delete
  2. if we solve the 10th mcq by BODMAS then the answer will be 9. soo its 3 or 9

    ReplyDelete
    Replies
    1. Yeah that's the same problem with me.
      I think it would be 9.

      Delete
    2. Education Is The Key To Success18 September 2022 at 13:10

      Yes, You both are right. we have made correction. Thank you for your feed back.
      JAZAKALLAH

      Delete
  3. Yeah that's the same problem with me.
    I think it would be 9.

    ReplyDelete
    Replies
    1. Education Is The Key To Success18 September 2022 at 13:12

      Yes, You are right. we have made correction. Thank you for your feed back.
      JAZAKALLAH

      Delete
  4. Thanks for sharing the comprehensive post, your post having informative & valuable content, it will be helpful.
    https://www.acesoftech.com/

    ReplyDelete