II-8 Programming Concepts
13. Explain the functions of a linker.
Ans: The linker puts together all other program files and functions that are required by the program.
For example, if the programmer is using pow() function, then the object code of this function should
be brought from math.h library of the system and linked to the main() program. After linking, the
program is stored on the disc.
14. What is the role of curly braces ({}) in a C program?
Ans: The curly braces are used to define the block of statements. The statements inside the curly
braces are having different scope than that of the statements outside the curly braces. The curly braces
can be used to define the blocks for decision and loop statements.
15. What are the user-defined functions?
Ans: The user-defined functions are created by the user; the contents of the user-defined functions
are completely known to the user and can be modified by the user.
16. Write details on header files stdio.h and conio.h.
stdio.h: Standard input and output file. All formatted and unformatted functions include file oper-
ation functions defined in this file. The most useful formatted printf() and scanf() are defined
in this file. Most useful functions from this header files are printf(), scanf(), getchar(),
gets(), putc() and putchar().
conio.h: Console input and output file. This file contains input and output functions along with a few
graphic-supporting functions. The getch(), getche() and clrscr() functions are defined in this file.
17. Which are the standard directories? Where are .h files kept?
Ans: The turbo-C has three standard directories; they are include, sys and lib. The sys is the sub-directory
of include. The include directory contains all the header files and lib contains all the library files. The header
files are stored in ‘include directory. The path could be c:/turboc2/include - if C is installed on ‘drive C’.
18. Write any three advantages of the C language.
Ans: The advantages of the C language include the following:
1. It contains a powerful data definition. The data types supported are characters, alphanumeric,
integers, long integer, floats and double. It also supports string manipulation in the form of
character array.
2. It supports a powerful set of operators.
3. It also supports powerful graphics programming and directly operates with hardware. Execution
of program is faster.
4. An assembly code is also inserted into C programs.
Multiple-choice Questions
1. Hard disc is a .
(a) Input device (b) Output device
(c) Both input as well as output (d) None of the above
2. Mouse is a .
(a) Input device (b) Output device
(c) Both input as well as output (d) None of the above
M01_ITL-ESL4791_02_SE_C01.indd 8 12/22/2012 4:59:19 PM
Basics and Introduction to C II-9
3. Brain of the computer system is .
(a) Mouse (b) Printer
(c) Keyboard (d) Central processing unit
4. ALU is a part of .
(a) Input (b) Output (c) CPU (d) Memory
5. Laptop is a device.
(a) Non-portable (b) Portable (c) Desktop (d) Non-programmable
6. Monitor of computer system is .
(a) Input (b) Output (c) Both input as well as output (d) None of the above
7. Random access memory is .
(a) Non-volatile (b) Volatile
(c) Both (a) and (b) (d) None of the above
8. Interpreter is a .
(a) Hardware (b) Software
(c) Both (a) and (b) (d) None of the above
9. Interpreter converts source code into .
(a) Machine code (b) ASCII code
(c) BCD code (d) Hamming code
10. The ‘C’ language has been developed by .
(a) Patrick Naughton (b) Dennis Ritche
(c) Ken Thompson (d) Martin Richards
11. The ‘C’ programming is a .
(a) High-level language (b) Low-level language
(c) Middle-level language (d) Assembly language
12. The ‘C’ programs are converted into machine language using .
(a) An assembler (b) A compiler
(c) An interpreter (d) An operating system
13. The ‘C’ language was developed in the year .
(a) 1972 (b) 1980
(c) 1975 (d) 1971
14. The ‘C’ language has been developed at .
(a) AT and T Bell Labs, USA (b) IBM, USA
(c) Borland International, USA (d) Sun Microsystems
15. The ‘C’ program should be written only in .
(a) Lower case (b) Upper case
(c) Title case (d) Sentence case
16. The role of compiler is to translate source program statements to .
(a) Object codes (b) Octal codes
(c) Decimal codes (d) None of the above
M01_ITL-ESL4791_02_SE_C01.indd 9 12/22/2012 4:59:19 PM
II-10 Programming Concepts
17. The extension for ‘C’ program files by default is .
(a) ‘.c’ (b) ‘.d’ (c) ‘.obj’ (d) ‘.exe’
18. The ‘C’ can be used with .
(a) Only UNIX operating system (b) Only Linux operating system
(c) Only MS-DOS operating system (d) All of the above
19. The ‘C’ language is closely associated with .
(a) MS-DOS (b) Linux (c) UNIX (d) MS-Windows
20. The ‘C’ programs are highly portable means .
(a) Same programs can be execute on different computers
(b) Program executes only on the same computer
(c) Program needs a lot of modification to run
(d) None of the above
21. Each instruction in ‘C’ program is terminated by .
(a) Dot (.) (b) Comma (,) (c) Semicolon (;) (d) Curly brace ({})
22. Which one of the following statements is incorrect?
(a) A compiler compiles the source program.
(b) An assembler takes an assembly program as input.
(c) A compiler does the same type of function as interpreter.
(d) None of the above.
23. ANSI committee was set up in the summer of .
(a) 1983 (b) 1985 (c) 1990 (d) 1976
24. C is an offspring of the .
(a) Basic combined programming language
(b) Basic computer programming language
(c) Basic programming language
(d) None of the above
25. An interpreter reads the source code of a program .
(a) One line at a time (b) Two lines at a time
(c) Complete program in one stroke (d) None of the above
26. A compiler reads the source code of a program .
(a) Complete program in one stroke (b) One line at a time
(c) Two lines at a time (d) None of the above
27. ‘C’ keywords are reserved words by .
(a) A compiler (b) An interpreter (c) Header file (d) (b) and (c)
28. The declaration of ‘C’ variable can be done .
(a) Anywhere in the program (b) In the declaration part
(c) In the executable part (d) At the end of the program
29. Variables must begin with character without spaces but C language permits .
(a) Underscore symbol (_) (b) Asterisk symbol (*)
(c) Ampersand symbol (&) (d) None of the above
M01_ITL-ESL4791_02_SE_C01.indd 10 12/22/2012 4:59:19 PM
Basics and Introduction to C II-11
30. In C, the statements following main() are enclosed within .
(a) { } (b) ( )
(c) < > (d) None of the above
31. Keys used for compiling the source program in C .
(a) Alt-C (b) Alt-R (c) Alt-F (d) Alt-G
32. Keys used for running the source program in C .
(a) Alt-C (b) Alt-R (c) Alt-F (d) Alt-T
33. Keys used for closing the C editor .
(a) Alt-C (b) Alt-X (c) Alt-F (d) Alt-F3
34. Computer is a electronic machine.
(a) Programmable (b) Non-programmable
(c) Unpopular (d) None of the above
35. Scanner is an device.
(a) Output (b) Input (c) Input and output (d) None of the above
36. Floppy is an device.
(a) Output (b) Input (c) Input and output (d) None of the above
37. Hard disc is a device.
(a) Semiconductor (b) Magnetic
(c) Conductor (d) None of the above
38. Program execution takes place in .
(a) CD (b) Tape (c) RAM (d) CPU
39. Header files appear in the C program .
(a) After the main() (b) Before the main()
(c) At the middle of the program (d) Nowhere
40. Comments in C are written within .
(a) /* */ (b) { } (c) ( ) (d) < >
41. is CPU dependent.
(a) Compiler (b) Assembler (c) Interpreter (d) None of the above
42. C is a language.
(a) Portable (b) Non-portable
(c) Both (a) and (b) (d) None of the above
43. Opening and closing braces in C should be .
(a) Unbalanced (b) Balanced
(c) Uncontrolled (d) None of the above
44. are predefined in the compiler.
(a) ASCII (b) Keywords
(c) User defined functions (d) None of the above
45. processes instructions and data.
(a) Keys (b) CPU (c) Hard disc (d) Memory
M01_ITL-ESL4791_02_SE_C01.indd 11 12/22/2012 4:59:19 PM
II-12 Programming Concepts
Answers
1. (c) 2. (a) 3. (d) 4. (c) 5. (b) 6. (b) 7. (b) 8. (b) 9. (a) 10. (b)
11. (c) 12. (b) 13. (a) 14. (a) 15. (a) 16. (a) 17. (a) 18. (d) 19. (c) 20. (a)
21. (c) 22. (d) 23. (a) 24. (a) 25. (a) 26. (a) 27. (a) 28. (b) 29. (a) 30. (a)
31. (a) 32. (b) 33. (b) 34. (a) 35. (b) 36. (c) 37. (b) 38. (d) 39. (b) 40. (a)
41. (b) 42. (a) 43. (b) 44. (b) 45. (b)
True or False
1. C language was developed by Ken Thompson.
2. C language was developed in 1972.
3. C language is closely associated with Linux.
4. C programs are not portable.
5. The ANSI C standard was developed in December 1989.
6. C programs are translated into object code by compiler.
7. An interpreter reads one line at a time.
8. Every 'C' program should have main() function.
9. In C, all the statements should be written in small letters only.
10. After compilation, object file of source program is created.
11. It is not possible to create .exe file in C.
12. Compiler executes the program even when the program contains warning messages.
13. In Turbo C editor, Alt+C is used to execute the program.
14. A comment can be split in more than one line.
15. The source code for the UNIX operating system is in C.
16. The assembly language program is in alphanumeric symbols.
17. Linking software is used to bring together the source program and library code.
Answers
1. False 2. True 3. False 4. False 5. True 6. True 7. True 8. True 9. True 10. True 11. False
12. True 13. False 14. True 15. True 16. True 17. True
M01_ITL-ESL4791_02_SE_C01.indd 12 12/22/2012 4:59:19 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset