ShortQuestionsowp P
ShortQuestionsowp P
Assembly language is a programming language in which instructions are written in the form of
mnemonics.
Mnemonics are the symbols used to represent complex instructions or information in a simplified
form.
5. List four commonly used HLPL. [BWP-16, RWP-15, GRW-22]
Computer programmers, also known as developers, are the individuals responsible for creating or
modifying computer programs. They use programming languages to create instructions for a
computer to execute.
8. Define Low-Level Language. [BWP-17, SGD-18]
Low-level language is a programming language that is very close to the actual hardware of a
computer.
A low-level programming language is machine-dependent, A machine-dependent language runs
on only one type of computer.
9. What is a Programming Language? [GRW-19]
A programming language is a set of words, abbreviations, and symbols that allows a programmer
to convey instructions to a computer. It is a mode of communication between a user and a
computer. It is a tool for creating sets of instructions to guide the computer.
10. Define Unstructured Programming Language. [FSD-22]
Unstructured Programming is a type of programming in which the logic of a whole program is
written in a single function, module, or piece of code.
11. What is Machine Language? [DGK-19]
Machine language is a programming language in which instructions of the program are written in
binary codes.
Machine language is a first-generation computer language composed of 0s and 1s, that computers
can understand without any translator.
Preprocessor directives or Compiler directives are the instructions given to the compiler before the
beginning of the actual program.
Preprocessor directives are special commands in C that start with a "#" symbol. They are like
instructions given to a tool called the C preprocessor which prepares your code for compilation.
13. Define Header Files / Library files.
These files contain the headers of standard library functions. Each header file contains the headers
of one type of functions only. The extension of the header file is “.h”.
14. What is meant by define directives or Constant Macro? [FSD-17, GRW-18, RWP-19, SGD-
21, SWL-22]
Constant macro is a name that is replaced by a particular constant value before compilation. It is
used to assign a constant value to an identifier. The macro name cannot be changed during
program execution.
15. What are Delimiters? [FSD-21, GRW-19, MTN-18, SGD-19, SWL-22]
Delimiters are the braces within the main function that represent the start and end of the program.
The "{" shows the starting point of your code, and the "}" indicates the endpoint of the function's
code. Anything you want your program to do lies within these curly braces – those lines are the
statements that make your program work.
16. Define include preprocessor. [BWL-21, MTN-21,22, RWP-19, SGD-22]
The "#include" directive provides access to library functions defined in standard header files. These
instructions tell the compiler to act compiling the source program.
17. What is meant by Statement Terminator? [GRW-17, LHR-22, MTN-22]
The statement terminator in a C program is a semicolon (;); which is used at the end of each
statement. This little semicolon serves as a signal to mark the conclusion of one instruction before
moving on to the next. Without it, the compiler will get confused and, as a result, will generate an
error message, typically stating "Statement missing."
18. What is meant by Linker? [LHR-16, MTN-18, SGD-22]
Linking is the process of combining the object file produced by the compiler with additional
library files. The linker combines these files, and the final machine language program is saved
as an executable file with a “.exe” extension.
19. Write short cut key of compile and run (execute) a C program. [SWL-21,22]
Ctrl + F9 is the shortcut key to run (execute) the program, and Alt+F9 is the shortcut key to
compile the program
20. What are Logical Errors? [BWL-16, SGD-18]
Logical errors occur when a program follows the wrong logic, leading to unintended outcomes.
Unlike syntax errors, compilers cannot detect these errors. Logical errors do not cause program
crashes but make them difficult to identify.
Runtime errors occur when a program tries to perform an illegal operation during its execution.
These errors are detected and displayed by the computer during program execution.
printf function is used to display text messages and values of variables on monitor
screen in a specific format. It is also called formatted output function.
57. How printf function is used to print value of a variable? Write its syntax.
[LRH-16]
printf can also be used to display values of different variables on the output screen.
For this purpose, printf function require two parameters. It is written as:
Syntax: printf(Format string, Argument list);
58. For what purpose format string is used in printf function? [LHR-13, MLT-16]
It is also called control string. It is written in between double quotation marks. This
format string may contain simple text, format specifiers and escape sequences.
59. What are format specifiers? What is the purpose of format specifier in
input/output statements?
[AJK-18, BWP-22, DGK-15, FSD-22, GRW-21,16, RWP-22,17,14, SWL-22, SRG-21,16]
Format specifier is a special code used to specify the type and format of the data
being read or written. It specifies the data type, field width and format of the value.
It helps the computer understand how to interpret and display the values correctly.
A format specifier is written in the format string of printf and scanf statements.
60. Write general form of format specifiers. Also write an example. [SWL-1,14]
A format specifier begins with “%” symbol followed by a conversion character.
Its general form is: % conversion character.
Example: “%d” is the format specifier for integers. Here “%” is format symbol and
“d” is the conversion character that represents “int” data type.
61. Discuss the purpose of any two format specifiers. [DGK-21,GRW-18, MLT16]
“%d” format specifier is used to read or print a decimal integer value.
“%f” format specifier is used to read or print a real or floating point value.
62. Enlist the format specifiers for characters. [BWP-14] E, K
Format specifiers for characters are: %c and %s.
63. Discuss the purpose of field width specifier. Where it is written?
[BWP-14, FSD-21]
Field width specifier is a numeric code or rule that specifies the minimum number
of columns used to printf a value. It determines the space occupied by a value on
the output screen. It is written within format specifier in printf or scanf statements.
Its use is optional.
64. What is meant by escape sequence?
[LHR-14, BWP-18, FSD-14, GRW-14,13, MLT-18, RWP-18, SWL-21]
Escape sequence ae the characters that are used to control or format the output
on the output devices. These can be used anywhere within the control string of a
printf statement. An escape sequence begins with a backslash “\” followed by a
single character. Backslash “\” is called control character or escape character. The
next single character after backslash is called code character or sequence
character.
65. Enlist any five escape sequence characters. [BWP-21,16, RWP-21]
Escape sequence characters are: \n, \t, \b, \r and \f.
66. What is the purpose of scanf function? [LHR-22, FSD-16, GRW-19,15,14]The
scanf function in C is used to obtain input from the user during the executionof a
program. It allows user to store the input in one or more variables in a specific
format. scanf is also known as a formatted input statement. It can handle various
types of input data including numbers, characters and strings.
67. Why (&) sign is used before variable name in scanf statement?
[LHR-21, BWP-21, MLT-21, SRG-16, SWL-19]
& sign is called address of operator. It specifies the address of variable in which
the value is to be stored. It is written with each variable separately.
68. Differentiate between printf and scanf functions. [DGK-15, MLT-19]
printf function is used to display text messages and values of variables on monitor
screen in a specific format. It is also called formatted output function. Whereas,
the scanf function in C is used to obtain input from the user during the execution
of a program. It allows user to store the input in one or more variables in a specific
format. scanf is also known as a formatted input statement.
69. Enlist any two functions used for character input in C. [BWP-
16] C language provides functions that are specifically designed for character
input like getch and getche. These functions allow programmers to receive input
characters from the keyboard during program execution.
70. What is the purpose of getch function?
[LHR21, BWP-21, DGK-22, FSD-18, GRW-13, MLT-21, SRG-19]
getch stands for Get character. It is used to get a single character as input from
the keyboard during the execution of the program. When a character key is
passed, the entered character is not displayed on the screen. getch function is also
used to pause a program during execution.
71. What is the purpose of getch function? [DGK-15, FSD-15, RWP-14, SRG-15]
getch stands for Get Character with Echo. Echo means to show or display. It is used
to get a single character as input from the keyboard during the execution of the
program. When a character key is pressed, the entered character is echo or
displayed on the screen.
72. Differentiate between getch and getche functions.
[LHR-18, AJK-21, BWP-14, GRW-21, MLT-22, SRG-14]
The functions getch and getche are used to get a single character as input from
the keyboard during the execution of the program. In case of getch, the entered
character is not displayed on the screen. In case of getche, the entered character
is displayed on the screen.
▶ Selection
▶ Repetition
73. Define the selection statement. List two basic selection statements in C. (SGD-16)
OR
If a break statement is omitted from a case, the code within a switch statement
after the true case will execute sequentially until a break statement is encountered.
76. Why a default label is used in switch statements? (DGK-16, GRW-16-19, SWL-
17) The statements under default are executed when none of the cases is matched.
Its use is optional.
77. Write three advantages of switch statement in C-Language.
(GRW-14, SWL-14, FSD-14-15)
switch statement can make code more readable, especially when dealing with
multiple conditional branches.
Compared to a series of nested if-else statements, a switch statement can be more
concise and easier to understand, particularly when there are many cases to consider.
Adding or removing cases typically requires minimal changes to the code, making
it less error-prone and more maintainable.
78. Distinguish between if-else if and switch statements.
(SWL-15, BWP-14-15, RWP-15-16, AJK-16-17, LHR-18, MTN-16-18, FSD-16)
case label-1:
Statements;
break; case label-2:
Statements; break;
case label-3:
Statements; break;
default:
statements;