You must sign in Login/Signup

New student? Register here

An important facility for 12th class students preparing for short questions computer science 12th class chapter 9 of BISE. Get hundreds of questions to prepare and get better marks in 12th computer science
Generic placeholder image

0

Our database contains a total of 0 questions for computer science Short Questions. You’ll prepare using this huge databank.

Question: 1
Define Variable declaration.
Answer: 1
1-48
Variable Declared :C is a strongly typed language I.e all variable must be declared before being used. The compiler will report an error if an undeclared variable is used in a program. A variable is declared in C by specifying its types (data type) and name.
Question: 2
What is identifier ?
Answer: 2
2-48
Identifier are the names used to represent variables, constant, types, function, and labels in the program. Identifiers in C can contain any number of characters, but only the first 31 are significant to C : standard identifiers and user-defined identifiers.Example : int money; double account balance Here; money and account balance are identifiers.
Question: 3
Differentiate between declaring and defining a variable.
Answer: 3
3-48
Declaring :
  1. A variable declaration does not set aside memory location for the data to be stored. It just informs the compiler the name of the variable and the type of data to be stored in it.
  2. Declaration will identify the data type of the identifier.
  3. Re-declaration is illegal in C programming language.
Question: 4
Differentiate between Standard Identifier and User-defined identifiers.
Answer: 4
4-48
Standard Identifier : Like reserved words, standard identifiers have special meanings in C , but these can be redefined to use in the program for other purpose, however this practice is not recommended. If a standard identifier is redefined, C no longer remains able to use it for its original purpose.Example : There are the following example of standard Identifiers:Printf is used for outputScanf is used for input
Question: 5
Why is C known as strongly typed language?
Answer: 5
5-48
C is strongly typed language because its type rules are very strict. For Example you can't call a function that is designed to call integer with a string or decimal. If you want to so then you will have to explicitly convert them to Integer.
Question: 6
Write the legal characters of an identifier.
Answer: 6
6-48
There are the following legal characters of identifiers :
  • The first letter of an identifier should be either a letter or an underscore. However, it is discouraged to start an identifier name with an underscore.
  • There is no rule on length of an identifier. However the first 31 characters of identifiers are discriminated by the compiler.
Question: 7
List Type of identifier?
Answer: 7
7-48
There are two types of identifier .Standard identifiersUser-defined identifiers
Question: 8
Why is it important to assign data type to a variable?
Answer: 8
8-48
Data type refers to the type of the data being stored in variable.
For Example : int kgs; double length;
In the first example int data type show that the kgs will being stored in integer type in variable and In the second example double data type show that the length will being stored in integer type in variable.
Question: 9
What do you mean by Case Sensitive in C-Language ?
Answer: 9
9-48
C is a Case Sensitive language. This means that C compiler considers uppercase and lowercase letters to be distinct characters. For example, the compiler considers SQUARE_AREA and Square _Area as two different Identifiers to different memory locations.
Question: 10
What are Keywords?
Answer: 10
10-48
Keywords : Keywords or reserved are the words, which have predefined meanings in C. There are 32 words defined as keywords in C.These have predefined uses and cannot be used or redefined for any other purpose in a C program.They are used by the compiler as an aid to compile the program. They are always written in lower case.
Examples :
  • Auto
  • Break
  • Int
  • Double
  • For
  • If
  • Signed
  • static
Question: 11
Define Variables.
Answer: 11
11-48
Variables : Variables are named memory location (Memory cells), which are used to store programs input data and its computational results during program execution. Variables must not be matched with keywords or reserved words.
Example :
  • Salary
  • X
  • Number
  • Y
Question: 12
What do you Know about C statement ?
Answer: 12
12-48
C-Statement is a statement in which a command is given to the computer that instructs the computer to take a specific action, such as display to the screen, or collect input. A computer program is made up of a series of statements.
Question: 13
What is the value of y after the following code executes?
Answer: 13
13-48
Float y = 3.4 +sqrt (25.0)
Value of Y : Y= 8.4
Question: 14
What is increment operator?
Answer: 14
14-48
The increment operator increase the value of its operand by one . It is denoted by the symbol ++.
There are two type of increment:
Prefix:Increment: When ++ preceded its operand, it is called prefix increment.
Postfix Increment: When ++ follow its operand, it is called prefix increment.
Question: 15
What is variable Initialization ?
Answer: 15
15-48
Initialization : Assigning a value to variable at the time of its declaration is called initializing a variable. In a C program when variable is declared, the compiler set aside some memory space for it. This allocated memory space may contain data meaningless to the program (also called garbage). In C, a variable can also be initialized at the time of its declaration e.g.,
Question: 16
What is Arithmetic Expression?
Answer: 16
16-48
An expression, in which only arithmetic operators operate on operands, is known as arithmetic expression. To Solve different mathematicals problems, one needs to write arithmetic expression. Arithmetic expressions involve integers and floating point numbers, which are manipulated with arithmetic operators.
Question: 17
Find the Errors in the following code.
Answer: 17
17-48
#include<sttd10.h>
Void main (void)
{
int x, y, z
z= x+y+z
}
Errors: There are the following errors in this program:
  1. 1st error is in this program is that the library has been used is wrong because std10.h has been used instead of stdio.h.
  2. 2nd error is in this program is that no terminator has been used in both statements.
Question: 18
Differentiate between increment and decrement operators.
Answer: 18
18-48
Increment Operators: The increment operator increase the value of its operand by one. It is denoted by the symbole ++.
Example: Count++, Where count is a variable. The effect of this expression is equivalent to the following expression:
Count =
Count +1;
Question: 19
Differentiate between function definition and declaration .
Answer: 19
19-48
Function Definition : A function is a group of statements that together perform a task . A function definition provides that actual body of the function . The C standard library provides numerous built-in functions that your program can call .
Question: 20
Described Single Comments in C.
Answer: 20
20-48
Comments is used to increase the readability of the program.With comments, informative notes are inserted in the program's code , which helps in debugging and modifying the program. One can insert single line comments by typing two (forward) slashes at the start of the note such as:
// This program calculated the factorial of the given number .
These are called single-line comments.
Question: 21
What is Character constant .
Answer: 21
21-48
A character constant is a single alphabet, a single digit or a single symbol enclosed within apostrophes e.g, A' is a valid Character constant e.g 'A', 'I' '5' '=' etc. The maximum length of a character constant is 1 character.
Question: 22
Differentiate between constant and variable?
Answer: 22
22-48
Constant: A constant is a quantity whose value cannot be changed during program execution.
Question: 23
What is a Relational Operators?
Answer: 23
23-48
Relational Operators : Relational Operators is used to compare two values.These operators always evaluates to true or false. They produce a non-zero value (in most cases 1) if the relationships evaluates to true and a 0 if the relationship evaluates to false.
Question: 24
Writes any two rules for naming Variables.
Answer: 24
24-48
1) A variable name can consist of letters, digits, and the underscore character (_)
2) A variable can only be declared for only one data type.
Question: 25
Identify the errors in the following lines:
Answer: 25
25-48
Integer A= 2+3 ;
Float B =5;
int C = A+B
Errors in the Lines :
  1. Integer A =2+3
  2. If we want to store a value in integer variable we should write int instead of integer in this line integer is written which is an error
  3. Float B =5;
  4. If the data type is float then value must be in point but in this line an integer value is assigned to float variable which is an error
  5. Int C = A+B;
  6. A is an integer variable and B is a float variable, integer can be added in float but its answer cannot be stored in an integer and in this line the answer of integer and float variable is stored in integer variable which is an error.
Question: 26
What is the use of assignment statement ?

Answer: 26
26-48
An Assignment statements gives value to a variable .
Syntax: the general Syntax of an assignment statement is:
Variable = expression;
Example: x= 5
Givess x the value 5.
The value of a variable may be changed.
If x has the value 5, then the assignment statement : x=x+1
Question: 27
Define Data Type.
Answer: 27
27-48
In C, the data type defines a set of values and aset of operations on those values. We know that computer program manipulates various types of data. In a C program we may need to process different types of data . Therefore variables should be capable of storing data of different types.This is done by associating certain data types to the variables.There are two different types of data.
  • Standard Data Types
  • User-define Data Types
Question: 28
Trace the output.
Int number = 6;
Int x= 0;
X =-- number ;
Printf ("%d",x);
Answer: 28
28-48
Output: x=5
Question: 29
Define Expression with Example?
Answer: 29
29-48
Expression: An Expression is the combination of operators and operands . The operand may either be a constant or variable.
Example: A+b,7+m
Question: 30
What is the use of | | (OR) Operators ?
Answer: 30
30-48
OE Operators: Logical operator // (logical OR ) when combines two conditions , evaluates to true if any one of the conditions evaluates to true, otherwise evaluates to false .
Question: 31
List any four types of integer data in C-Language.
Answer: 31
31-48
There are the following types of integer data in C-Language:
  • Int
  • Short
  • Long
  • Long long
Question: 32
Trace the output in the following code.
Int x =10 y =15;
X=x++;
Y= ++y;
Prontf ("%d%d",x,y);
Answer: 32
32-48
Output: x= 11
y=16

Question: 33
Define Constant .
Answer: 33
33-48
A constant is a quantity whose value cannot be changed during program execution .Unlike a variable, the value stored in a constant can't be changed during program execution .We Know that define directive can be used to define constant macros.
Question: 34
What is assignment operator ?
Answer: 34
34-48
The Assignment operator is used to store a value or a computational result in a variable . In C, the symbol= represents the assignment operator e.g. In the following statement, values of the two variables, height and width, are multiplied and the results is assigned to the variable Area
Area = Height*width
The value of the right side of the operator is assigned to the variable on the left side of the assignment operator .
Question: 35
Differentiate between string constant and character constant .
Answer: 35
35-48
String Constant : String constant are always enclosed in double quotes.'A'or '?' . A Character constant has an equivalent integer value
.
Question: 36
Differentiate between Unary and binary operator.
Answer: 36
36-48
Unary Operator: Unary mean consisting of single component or element. Operator means a symbol that tells the compiler to perform specific mathematical or logical functions. A unary operator in C is an operator that takes a single operand in an expression or statement.
Question: 37
What is the use of AND logical operator?
Answer: 37
37-48
AND Operator: Logical operator & (logical AND) when combine two conditions , evaluates to true if both the condition are true ,otherwise it evaluates to false.
Example: Suppose, if the salary of an employee in an organization is less than Rs.10000 and he/she is married than he/she will be given an additional relief allowance. In a C program, let we have two variables; Salary (an int type variable and status) a char type variable representing the marital status of the employee. To evaluate this condition , we can use the && operator:
Question: 38
Write C statement to print the value of unsigned long x.
Answer: 38
38-48
Statement to print the value of unsigned long x:

Unsigned long n;
Printf("%",n);

Question: 39
Predict the output of the following code:
Int number =6;
++ number;
Printf ("%d\n", number);
Answer: 39
39-48
Output: number =7
Question: 40
Which operators have been used to evaluate compound condition?
Answer: 40
40-48
Logical Operators have been used to evaluate compound condition.
Types: There are the following types of logical Operators:
  • Logical AND (&&)
  • Logical OR (||)
  • Logical NOT (!)
Question: 41
List three names of functions used for charter input.
Answer: 41
41-48
The data type char is used to represent a letter, number.A char type variable occupies 1 byte in memory and can represent
Individual characters such as 'a' ,'x' '5', and '#' etc. (The character '5' is manipulated quite differently than the integer 5 in the computer, so one should not consider both the same. We shall thoroughly discuss the topic in next chapter).In C,a character is expressed as enclosed in apostrophes such as 'a'.'e','i','o'. And 'u' etc.
Question: 42
Trace the output:
Int n = 6;
N++;
Printf ("%,n");
Answer: 42
42-48
Output: n=7
Question: 43
Find out the errors from the following code.
Answer: 43
43-48
Void main ()
{ char ch, ch2;
ch1 = '2';
Ch2 = '6';
}
Erros:
  • 1st error is variable ch2 is not declared above .
Question: 44
Define compound assignment statement.
Answer: 44
44-48
Compound Assignment Statement: The statement in which we used compound assignment operators is called compound assignment statement
Question: 45
Find out the errors in the following code .
Answer: 45
45-48
#include (stdio.h)
Main ()
{
Char ch ='a' ;
Float 3 digit = 33.3 ;
Errors: There are the following errors in this program:
  • 1st error is in this program is that brackets do not use with library
  • 2nd error is float 3 digit is not any sata type.
Question: 46
What is compound assignment operator?
Answer: 46
46-48
The ++and - operators respectively increment and decrement the value of their operand by one. There are four other compound assignment operators that can increment or decrement the values of their operand by other than one.
There are the following types of compound assignment operators:
  • + =
  • -+
  • * =
  • / =

Question: 47
List any four types of operations in C.
Answer: 47
47-48
There are four following types of Operators in C:
  1. Arithmetics Operators
  2. Relational Operators
  3. Logical Operators
  4. Assignment Operators
Question: 48
Trace the output.
Int number = 6;
Int x= 0;
X =-- number ;
Printf ("%d",x);
Answer: 48
48-48
Output: x=5