Friday 5 November 2021

UNIT 02. BASICS OF PROGRAMMING IN C++ - MCQs - Computer Science For Class X

GO TO INDEX

Computer Science For Class X
Unit 02: Basics Of Programming In C++
Multiple Choice Questions And Fill In The Blanks


Multiple Choice Questions (MCQs)
A. ENCIRCLE THE CORRECT ANSWER:
1. A computer program is a collection of:
a. Tasks
b. Instructions ✓
c. Computers
d. Programmers

2. High-level languages have syntax that is:
a. Easily readable by humans ✓
b. Easily readable by machines
c. Easily readable by both
d. None of the above

3. Low-level languages have syntax that is:
a. Easily readable by humans
b. Easily readable by machines ✓
c. Easily readable by both
d. None of the above

4. The primary characteristic of a compiler is to:
a. Translate codes line-by-line
b. Translate low-level code to machine language
c. Detect logical errors
d. Translate codes all at once ✓

5. The primary characteristic of an interpreter is to:
a. Translate codes line-by-line ✓
b. Translate low-level code to machine language
c. Detect logical errors
d. Translate codes all at once

6. An Integrated Development Environment facilitates a programmer to:
a. Edit source code
b. Complete and highlight syntaxes
c. Debug and compile codes
d. All of the above ✓

7. All errors, detected by users are typically:
a. Syntax Errors
b. Semantic Errors
c. Run- Time Errors
d. Logical Errors ✓

8. Allowed names for declaring a variable:
a. Can contain whitespaces
b. Can be one of the reserved words
c. Can contain letters, digits and underscores ✓
d. Can be the same as its data type

9. A bool data can store following type of value:
a. Numbers
b. Strings
c. Fractional numbers
d. True or false ✓

10. Which data type occupies the most space in memory?
a. Character
b. Integer
c. Floating point
d. Double floating point ✓

11. An identifier cannot consist more than characters:
(a) 30
(b) 31 ✓
(c) 32
(d) 35

12. Integer reserves ___ bytes in memory:
(a) 2
(b) 4 ✓
(c) 8
(d) 35

13. Float data type consists of the following:
(a) Numbers only
(b) Numbers and decimal point ✓
(c) Special characters
(d) Alphabets

14. Which of the following type of errors is detected by a language translator:
(a) Program design
(b) Logical errors
(c) Arithmetic errors
(d) Syntax errors ✓

15. A pictorial representation of program is called:
(a) A flowchart ✓
(b) An algorithm
(c) Pseudocode
(d) None of these

16. Software that translates assembly language into machine language is a/an:
(a) Binary translator
(b) Assembler ✓
(c) Compiler
(d) Link-loader

17. This type of error is detected by compiler:
(a) Runtime
(b) Logical
(c) Syntax ✓
(d) None of these

18. This is statement terminator in C:
(a) { }
(b) ; ✓
(c) "
(d) None of these

19. IDE stands for:
(a) International Development Environment ✓
(b) Integrated Development Environment
(c) Important Design Environment
(d) None of the above

20. Double/floating point reserves ____ bytes in memory:
(a) 4
(b) 6
(c) 8 ✓
(d) 10

21. A char data type contains any valid enclosed in a single quote:
(a) Alphabets only
(b) Symbols only
(c) ASCII characters ✓
(d) None of them

22. There are basic types of constant:
(a) 2 ✓
(b) 4
(c) 6
(d) 7

23. An integer constant must not have ___.
(a) Positive
(b) Negative
(c) Decimal Point ✓
(d) Numbers

24. ___ is a program that converts high-level language to machine language.
(a) Assembler
(b) Compiler ✓
(c) Debugger
(d) Linker

25. Which of the following is used to link all the parts of the program together for execution?
(a) Loader
(b) Linker ✓
(c) Memory
(d) Preprocessor

26. The output of an assembler is called:
(a) Data file
(b) Task file
(c) Object file ✓
(d) Program file

27. Users write the programs in which language?
(a) Low-level Language
(b) Middle-level Language
(c) Decimal-format
(d) High-level language ✓

28. A type of error that cannot be detected by a language translator is said to be:
(a) Syntax error
(b) Logical error ✓
(c) Inception error
(d) Conception error

29. Type of error generated by some undefined terms or wrong spelling term in a program is known as:
(a) Compile error
(b) Runtime error
(c) Conception error
(d) Syntax error ✓

30. A type of error that a language translator can detect is called:
(a) Compiler error
(b) Syntax error ✓
(c) Conception error
(d) Runtime error

31. Error in planing a program's logic would generate a ___.
(a) Inception error
(b) Conception error
(c) Syntax error
(d) Logic error ✓

32. Which is a valid identifier or variable name?
(a) diameter ✓
(b) void
(c) 55
(d) $12

33. A runtime error ___ program execution at the statement that cannot be executed.
(a) Halts ✓
(b) Resumes
(c) Starts
(d) None of the above

34. The constant are also called as ___:
(a) Const
(b) Preprocessor
(c) Literals ✓
(d) None of the above

35. The ___ are just like variables except that their values cannot be changed.
(a) Named constant
(b) Basic constant
(c) Number constant
(d) Symbolic constant ✓


Fill In The Blanks:
  1. A computer program is a list of instructions that tell a computer what to do.
  2. We refer to syntax in computer programming as the concept of giving specific word sets in specific orders to computers so that they do what we want them to do.
  3. Different programming languages can be classified into high, middle and low-level languages.
  4. High-level languages are easy to read for humans and contain English language like words.
  5. Middle-level languages have a human readable format along with direct control over the machine's resources.
  6. Low-level languages are easy for machines to read and hard for humans.
  7. Low-level programs mostly comprise of binary digits and memory operators.
  8. There are three types of translators namely, compilers, interpreters and assemblers.
  9. Compilers convert high-level languages into machine readable format.
  10. Interpreters also convert high-level programs into machine readable format.
  11. Interpreters convert instructions line-by-line.
  12. Assemblers convert low-level languages into machine readable format with added benefit of being interactive like an interpreter.
  13. Programming errors prevent the program from being compiled or executed.
  14. Syntax errors are words or symbols unrecognized by a particular programming language.
  15. Runtime errors only occur during program execution mostly due to an invalid input.
  16. Logical errors are considered when incorrect results are obtained based on provided input.
  17. Logical errors do not interrupt program execution.
  18. IDEs stand for Integrated Development Environments.
  19. Integrated Development Environments (IDEs) are programs that facilitate writing, compiling and executing codes.
  20. IDEs usually provide a single environment for programmers to write and executes codes efficiently.
  21. C++ is a general-purpose high-level programming language.
  22. Reserved words are part of programming language syntax and cannot be used as name of variable, function or label.
  23. A constant is a named identifier having a value that cannot be changed.
  24. A variable is a named identifier with a value that can be changed during normal execution of program.
  25. Different types of values can be stored in variables. These types are called data types such as int, string, bool, etc.
  26. A variable can be declared by giving it a name and type.
  27. A variable can also be initialized during declaration by assigning a value to it.
  28. In C++, a variable is defined and initialized as: "data type variable name= value;"
  29. C++ offers various data types for holding values in variables.



3 comments: