What must match in pairs in a C program?
Click to see answer
Braces ({ and }).
Click to see question
What must match in pairs in a C program?
Braces ({ and }).
What is the purpose of the printf() function?
To output data to the screen.
What does the format specifier %o represent?
Octal Integer.
What are constants in C?
Fixed values that do not change during the execution of a program.
What is the precision of a float type in C?
6 digits.
What characters can a C variable name consist of?
Letters, digits, and underscores, starting with a letter or underscore.
What is the significance of the order in which variables are defined in C?
The order can be important; using a variable before defining it will cause an error.
How many flow lines should come out of a process symbol?
Only one flow line.
What does the modulo division operator (%) do?
Produces the remainder of integer division.
What is a real constant?
A number that consists of a fractional part, representing quantities that vary continuously.
What does the printf function display in the first program?
It displays the initialized integer, float, and character values.
What are backslash character constants used for?
They are special characters used in output functions.
What does the bitwise OR operator do?
It performs the logical OR of the bits in each position of a number in its binary form.
What is an algorithm?
A method of representing the step-by-step logical procedure for solving a problem.
What are identifiers in C?
User-defined names for variables, functions, and arrays.
What is the purpose of the conditional operator in C?
To construct conditional expressions in the form exp1 ? exp2 : exp3.
What is the purpose of data types in C programming?
To inform the compiler about the type of value stored in a memory location and the amount of memory required.
How does the conditional operator work?
If exp1 is true, exp2 is evaluated; if false, exp3 is evaluated.
What are examples of legal floating point constants?
0.65e4, 12e-2, 1.5e+5, 3.18E3, -1.2E-1.
Is C case-sensitive?
Yes, upper and lower case characters are different.
What is the meaning of the logical operator '!'?
Logical NOT.
What is the ASCII value for the digit '0'?
What is an operator in C?
A symbol that tells the computer to perform mathematical or logical manipulations.
How can the validity of a flowchart be tested?
By passing through it with simple test data.
What are unformatted I/O functions in C?
They are used for simple reading of data from the keyboard and writing to an I/O device without any format.
What does the operator '>' signify?
Greater than.
What is the hexadecimal representation of the decimal number 11703?
2DB7.
What does the keyword 'const' do in C?
It declares a variable whose value must not be modified during program execution.
Give examples of real constants.
0.0026, -0.97, 435.29, +487.0.
What is a potential issue with flowcharts regarding technical details?
The essentials of what is done can easily be lost in the technical details of how it is done.
What is the general form of a real number in exponential notation?
mantissa * 10^exponent.
What is the syntax for using putchar()?
putchar(character_variable/expr);
What was a major limitation of the earlier programming languages like ALGOL60 and CPL?
They were either too general, too abstract, or too difficult to learn.
What is the output format of the second program?
It displays the accepted integer, float, and character values in the order of reading.
Give examples of valid C variable names.
Alpha, X, fyear_9899, matrix, income.
What is the format code for a single character?
%c.
What does the one's complement operator (~) do?
It inverts the bits of a given number, turning 1s into 0s and vice versa.
What are the advantages of using shorthand assignment operators?
What is the significance of the main function in a C program?
It is the starting and ending point of program execution.
What is the difference between pre and post increment/decrement operators?
PRE performs the operation first, followed by any assignment; POST performs the operation after any assignment.
What is the first step in writing and running a C program in Turbo C?
Creation of the Source Program.
What does the format specifier %s represent?
String or sequence of characters.
What should be used to describe data or computational steps in a flowchart?
The annotation symbol.
What is essential for a flowchart to have?
A logical start and finish.
What is a string constant in C?
A sequence of characters enclosed in double quotes.
What are integers in C?
Whole numbers with a machine-dependent range of values.
What is the first step in learning the C language?
Knowing the character set, which includes alphabets, numbers, and special symbols.
How are the steps of an algorithm represented in a flowchart?
In the form of shapes of boxes and logical flow with arrows.
How is learning C similar to learning English?
Both involve learning basic elements (alphabets or character set) and combining them to form more complex structures (words or instructions).
What does any non-zero value represent in C?
True value.
What types of symbols are included in the character set of C?
Alphabets (A-Z, a-z), digits (0-9), and special symbols (!@#~`%^&*(){}-+=_{}[]|"'/<>:;).
What is the purpose of the 'volatile' qualifier in C?
It indicates that a variable's value may be changed by external sources, prompting the compiler to check its value each time.
How is an octal integer constant indicated in C?
By starting with a 0.
What are derived data types in C?
Secondary data types including arrays, structures, unions, and pointers.
How do increment and decrement statements commonly used in C?
They are extensively used in for and while loops.
How many flow lines are used in conjunction with a terminal symbol?
Only one flow line.
How does the second program accept user input?
Using scanf for character, integer, and float values.
What is the function of putchar()?
It transmits a single character to a standard output device.
What does the format code '%d' represent?
It represents a decimal integer.
What is the ASCII value for the uppercase letter 'A'?
What does 'Definite' mean regarding algorithm steps?
Each step must be precisely defined with no ambiguity or contradiction.
What is the first step in finding the area and circumference of a rectangle?
Start.
What is the syntax for using getche()?
character_variable = getche();
What are the smallest individual units in a C program called?
C Tokens.
What is a flowchart?
A pictorial representation of an algorithm.
How are C operators classified?
What is an example of a flowchart task?
Finding the sum and average of two numbers.
How many classes of integer storage does C have?
Three classes.
What is another example of a flowchart task?
Finding the largest of three numbers.
What is the difference between signed and unsigned integers?
Signed integers can be positive or negative, while unsigned integers are always positive.
What should a C variable name not be?
A keyword.
What is the file extension for C source files?
.c
What is the size of a short integer in C?
1 byte (8 bits).
Why can't keywords be used as variable names?
Because it would assign a new meaning to the keyword.
What is the output of the program when 'k', 'l', and ';' are entered?
First character is k, Second character is l, Third character is ;
What is the significance of C's built-in functions and operators?
They can be used to write complex programs.
What are operands in the context of C operators?
Variables that operators act upon, such as 'a' and 'b' in the example.
What is the purpose of Example 4 in the text?
To write pseudo code to check whether a student is passed or not.
What is the output of the expression '0 < 20'?
True (1).
What is the syntax for using getchar()?
character_variable = getchar();
What libraries are included in the C programs?
stdio.h and conio.h.
What is a single character constant?
A single character enclosed within a pair of single quote marks.
Where should user-defined functions be placed in a C program?
Immediately after the main function.
What does the format code '%h' represent?
It represents a short integer.
What is the storage size of floating point numbers in C?
32 bits (4 bytes).
Who developed the C programming language?
Dennis Ritchie.
What values can a logical constant take in C?
Either true or false.
What is the purpose of the first C program example?
To initialize int, char, and float data types.
Are variable names in C case sensitive?
Yes, uppercase and lowercase letters are treated differently.
What are the initialized values in the first C program?
Integer: 78, Float: 3.0, Character: 'y'.
What is the size of the void data type in C?
0 bytes.
What characters are not permitted in decimal integers?
Spaces, commas, and non-digit characters.
What is the syntax for scanf in C?
scanf("", list of address of variables separated by commas);
What is the decimal equivalent of the octal number 3623?
1939 in decimal.
What is the syntax for declaring a variable in C?
data_type variable_name;
What are the two main parts of a C program?
Declaration and Execution Parts.
What is the ASCII value for the space character?
What is the syntax for using putch()?
putch(character_variable/expr);
Are uppercase and lowercase letters permitted in identifiers?
Yes, both are permitted, but lowercase is commonly used.
How many bits are characters usually stored in?
8 bits (1 byte).
What format specifier is used to read an integer in scanf?
%d.
How is the character constant '5' different from the number 5?
'5' is a character constant, while 5 is a numeric constant.
What do increment (++) and decrement (--) operators do?
++ adds 1 to the operand, while -- subtracts 1.
What happens to the high-order bits during a right shift operation?
Zeros are placed in the n high-order bits of the variable.
What is the result of left-shifting the binary 00001100 by 3?
The result is 01100000 (decimal 96).
What is an algorithm?
A step-by-step procedure for solving a problem.
What is one advantage of using flowcharts in programming?
Effective analysis: problems can be analyzed in a more effective way.
What are relational operators used for in C?
To test the relationship between two variables or between a variable and a constant.
What are the six types of C tokens?
Keywords, Identifiers, Constants, Strings, Special Symbols, Operators.
What does the putch() function do?
It prints any alphanumeric character taken by the standard input device.
What is a character in C language?
Any symbol that denotes alphabets, digits, or special symbols used to represent information.
What does the prefix increment operator do in C?
It adds 1 to the operand first, then assigns the result to the variable on the left.
How many flow lines should enter a decision symbol?
Only one flow line.
How is the area of a circle calculated?
By calculating the product of the radius with itself and the PI value.
What is the result of the statement y = m++; when m = 5?
y = 5 and m = 6.
What is the significance of the first 8 characters of a variable name in many compilers?
Only the first 8 characters are treated as significant.
What happens if you try to use a variable before it is defined?
It will result in an error, as the variable must be defined before it can be used.
How is the binary number 1011 interpreted in decimal?
As 11 in decimal.
When is a logical expression true?
When all combined relational expressions are true.
What is a variable in C?
A quantity that may vary during program execution.
How can multiple statements be displayed using printf?
By calling printf multiple times with different messages.
What is the purpose of a variable name in C?
To identify the memory location where the variable value is stored.
What happens if the '-o' option is not specified during compilation?
An executable file named 'a.out' is created.
What earlier languages did C evolve from?
BCPL and B.
What are bitwise operators used for in C?
For manipulation of data at the bit level.
How do you execute a C program if the executable file name is specified?
./helloworld
What are global variables in a C program?
Variables that are used in more than one function, declared in the global declaration section.
How does the statement y = ++m; affect the values of y and m if m starts at 5?
Both y and m will be 6 after the statement executes.
What is the format specifier for an unsigned long integer in C?
%lu.
What percentage of the UNIX operating system is written in C?
90%.
What is an integer constant?
A sequence of digits representing fixed values.
How do flowcharts aid in program maintenance?
They make the maintenance of a program easier.
What is the size and precision of a double type in C?
8 bytes (64 bits) with 14 digits of precision.
What is the base of the octal number system?
Base Eight.
What is the purpose of the long double type in C?
To extend precision further, using 80 bits.
What digits are used in the octal number system?
0, 1, 2, 3, 4, 5, 6, and 7.
How many keywords are available in C?
32 keywords.
What is the result of a relational expression if the relation is true?
One (1).
What is the purpose of the character set in C?
To form the vocabulary of C, including constants, variables, and keywords.
What happens during integer division in C?
It truncates any fractional part.
What does getche() do?
It reads a single character without waiting for the enter key and echoes the character on the screen.
What are format codes in C?
They are coding characters used to represent data types for formatted output.
What are the types of constants mentioned in C?
Numeric, integer, real, character, single character, string, and logical.
What command is used to compile a C program in UNIX/LINUX?
gcc helloworld.c -o helloworld
What programming efficiency does C provide?
Relatively good machine efficiency and support for various data types.
What will be the value of x in the expression x = (a > b) ? a : b when a = 10 and b = 15?
x will be assigned the value of b (15).
What is the ASCII value for the lowercase letter 'a'?
What is meant by 'Effectiveness' in an algorithm?
Each step must be effective, easily converted into program statements, and performed in a finite amount of time.
Which data types can bitwise operators be applied to in C?
They may not be applied to float or double.
What is the significance of Input/Output in an algorithm?
Each algorithm must take zero, one, or more quantities as input data and produce one or more output values.
What are the format specifiers for floating point values in C?
%e, %f, %g.
How can you view the output of an executed program in Turbo C?
Press Alt+F5.
What are the basic flowchart symbols?
What is the purpose of the putchar() function?
It prints a single character to the standard output.
In what years was C developed?
Between 1969 and 1973.
What role do flowcharts play in documentation?
Flowcharts serve as good program documentation.
What are keywords in C?
Predefined words whose meanings are known to the C compiler.
What is a disadvantage of flowcharts related to complex logic?
Flowcharts can become complex and clumsy when the program logic is complicated.
What is the purpose of the getchar() function?
It reads a single character from the keyboard after the confirmation key is pressed.
How many flow lines should leave a decision symbol?
Two or three flow lines, one for each possible answer.
What is the purpose of the second C program example?
To accept and display values of int, char, and float data types.
What are the three broad classifications of data types in C?
Primary data types, derived data types, and user-defined data types.
What is the file extension for executable files created from C programs?
.exe
What is the purpose of the assignment operator (=) in C?
To assign the result of an expression to a variable.
What is the purpose of a flowchart?
To illustrate the sequence of operations to solve a problem.
What are shorthand assignment operators?
Operators of the form v op= exp, where v is a variable, exp is an expression, and op is a C arithmetic operator.
What is the purpose of the Documentation Section in a C program?
It consists of comment lines giving the name of the programmer, the name of the program, and other details.
Where are variables typically defined in a C program?
At the beginning of the block.
What is the range of signed characters in C?
−128 to +127.
What is defined in the Definition Section of a C program?
All the symbolic constants.
What does the bitwise AND operator (&) do?
It performs a logical AND on the bits in each position of a number in its binary form.
What is the result of right-shifting the binary 00001100 by 2?
The result is 00000011 (decimal 3).
What key combination is used to execute a program in Turbo C?
Ctrl+F9.
What capabilities does a C compiler combine?
The capabilities of an assembly language with features of high-level language.
What is the maximum length of a C variable name?
Up to 8 characters, with some translators allowing up to 32.
In what language is an algorithm typically written?
In English-like language with words.
What is the first step in finding the area, diameter, and circumference of a circle?
Start.
What is a binary number?
A number made up of only 0s and 1s.
What value is initialized to 0 in the circle area calculation?
PI.
How do you print a message 'Hello World' in C?
Using printf("Hello World");
What low-level features does C support?
Manipulation of bits and direct memory addressing using pointers.
What file extension is used for machine code generated from a C source file?
.obj
What is a logical expression?
An expression containing a logical operator that yields a value of one or zero.
What is the purpose of the clrscr() function in C?
To clear the screen before displaying output.
What are the properties of an algorithm?
Fitness, Definite, Effectiveness, Generality, Input/Output.
Can variables be initialized during declaration in C?
Yes, for example: int a = 10;
What must all C statements end with?
Semicolon (;).
What are the advantages of using flowcharts?
They make logic clear, facilitate communication, and guide coding during system analysis and program development.
Give an example of a shorthand assignment operator.
x += y + 1; is equivalent to x = x + (y + 1);
What function is used to clear the screen in the C programs?
clrscr().
What is the significance of the '&' symbol in scanf?
It is used to provide the address of the variable where the input will be stored.
What is stored in the variable 'temp' during the rectangle calculation?
The sum of length and breadth.
How can comments be added to a C program?
Comments can be added using /* comment */ syntax, but cannot be nested.
What key combination is used for compilation in Turbo C?
Alt+F9.
What should be avoided to enhance the effectiveness of a flowchart?
The intersection of flow lines.
How many types of tokens are there in C?
Six types.
What types of integer constants are supported in C?
Binary, decimal, octal, and hexadecimal.
What data type do unformatted I/O functions primarily work with?
Character data type.
What is the meaning of the operator '=='?
Equal to.
What are valid examples of decimal integers?
123, -321, 0, 654321, +78.
Can the modulo division operator (%) be used on float and double datatypes?
No, it cannot be used on float and double datatypes.
What does the Logical NOT operator do?
It reverses the truth value of its operand (e.g., NOT F -> T).
What is the final goal of combining instructions in C?
To form functions or complete programs.
What is the range of a signed short integer?
−128 to +127.
What does ASCII stand for?
American Standard Code for Information Interchange.
What are flowchart symbols?
Different geometric shapes used in flowcharts.
What characters can identifiers consist of?
Letters and digits, starting with a letter, and can include underscores.
What is the range of an unsigned character?
0 to 255.
What is the result of the bitwise XOR operation between 00111110 and 00011001?
The result is 00110001.
What do the letters A to F represent in hexadecimal?
Decimal values 10 to 15.
How do you execute a C program if the executable file name is not specified?
./a.out
What is the result of applying the one's complement operator to 00111111?
The result is 11000000.
What is the ASCII value for the exclamation mark '!'?
What are the standard formatted I/O functions in C?
printf() and scanf().
What is recommended if a flowchart becomes complex?
Use connector symbols to reduce the number of flow lines.
What keyword is used to define floating point numbers in C?
float.
What is a key guideline for creating a flowchart?
The flowchart should be clear, neat, and easy to follow.
What is the binary representation of the decimal number 11?
1011 in binary (2).
What is the purpose of the printf function in C?
To print formatted output to the screen.
What does zero (0) represent in C?
False value.
What does the scanf function do in C?
It accepts input from the user and stores it in variables.
What does an algorithm explain?
How a certain process is followed or a problem is solved.
What are the components of C language vocabulary?
Keywords, reserved words, and identifiers.
What does the puts() function do?
It takes a string as an argument and writes it to the screen.
What may a flowchart lack compared to an algorithm?
Detailed instructions about how the tasks are done.
What is the formula to calculate the diameter of a circle?
Diameter = 2 * radius.
What does the escape sequence '\n' represent?
New Line.
What is the result of the bitwise OR operation between 00111110 and 00011001?
The result is 00111101.
What formula is used to find the range of signed data types?
−2^(n-1) to 2^(n-1) − 1.
What does the exponent in exponential notation do?
It causes the decimal point to 'float'.
What does 'Fitness' mean in the context of algorithms?
An algorithm must terminate in a finite number of steps.
What is the output of the program that prints 'Hello World'?
'Hello World'.
How does a variable differ from a constant in C?
A variable can hold different values during execution, while a constant is restricted to one value.
What does the Link Section in a C program do?
It provides instructions to the compiler to link functions from the system library, e.g., '#include<stdio.h>'.
How is the area of a rectangle calculated?
By calculating the product of length and breadth.
What do the shift operators (<< and >>) do in C?
They shift the bits in an integer variable by a specified number of positions to the left or right.
What is the result of the bitwise AND operation between 0011 and 1100?
The result is 0000.
What does the format specifier %ld represent?
Long integer.
What does the function getchar() do in C?
It reads a single character from the standard input.
What are some application areas of C?
System software, application software, device drivers, internet protocols, translators, print spoolers, and utilities.
What is the usual direction of flow in a flowchart?
From left to right or top to bottom.
What are the basic arithmetic operators in C?
What is C considered in terms of programming language levels?
A middle level programming language.
What is the purpose of the gets() function?
It reads a string of characters from the standard input.
What are some high-level features supported by C?
Commands like if, else, goto.
What happens to flowcharts when alterations are required?
The flowchart may require re-drawing completely.
How does getch() differ from getchar()?
getch() reads a single character without waiting for the enter key and does not display the character on the screen.
What does the logical operator '&&' represent?
Logical AND.
What is the purpose of Example 3 in the text?
To draw a flowchart to compute the final price of an item after figuring in sales tax.
What does a flowchart visually represent?
The flow of data through an information processing system and the sequence of operations.
What is the base of the hexadecimal number system?
Base Sixteen.
What does the bitwise exclusive OR (XOR) operator do?
It adds the two bits discarding the carry, resulting in zero only when both bits are the same.
How are hexadecimal integers indicated in C?
By prefixing with 0X or 0x.
What does the logical operator '||' signify?
Logical OR.
What is the syntax for using getch()?
character_variable = getch();
What does the format code '%i' represent?
It represents a decimal, hexadecimal, or octal integer.
What is a compound relational expression?
An expression that combines two or more relational expressions.
What are the two forms of I/O functions in C?
Formatted and Unformatted.
What is the first step in the example algorithm to find the sum and average of two numbers?
Read the numbers a, b.
What are some special operators supported by C?
Comma operator, sizeof operator, pointer operators (& and *), and member selection operators (. and ->).
What does 'Generality' refer to in algorithms?
The algorithm must be complete and work successfully for all problems of a particular type.
What is the ASCII value for the dollar sign '$'?
What is the last step in the example algorithm provided?
End of program.
What does the format specifier %u represent?
Unsigned decimal integer.
What is the significance of white spaces in exponential notation?
White spaces are not allowed.
What is the main function in a C program?
Every C program must have one 'main' function section, which contains a declaration part and an executable part.
What is the syntax for using printf()?
printf(""); or printf("", argument list);
What does the format specifier %x represent?
Unsigned hexadecimal integer.