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 10 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
Find the error in the following code.
#include (conio,);
#include (stdio.h);
Void main ()
{
printf("OK");
}
Answer: 1
1-95
Errors: Error is brackets do not used in library.
Question: 2
What is the use of printf() function?
Answer: 2
2-95
Use of printf() Function:To see results of program execution, we must have a way to specify what variables values should be displayed . The standard library function printf (pronounced as print -eff) has been used for formatted output . It takes as arguments a format string and an optional list of variable to output.
Question: 3
What is Control String in printf function?
Answer: 3
3-95
Control String: The format of each expression may be controlled using a control string that precedes the expression and is separated by a colon(:).These control string use the same structured as the control strings in C printf() routines.
Example: The following specifies that each element of the parallel array .A will be printed to 5 decimal places.
Control strings also may be applied to sequential expressions.
The colons have been used strictly to separate control strings from expressions, so each colon must follow a string and precede an expression.
Question: 4
Find the error in the following code.
Main();
{
printf(OK)
}
Answer: 4
4-95
Errors: Error is " " commas are not present with OK in printf statement .
Question: 5
Trace the Errors .
Int b =8;
Int c =0
C =number
Print f ("%f",x)
Answer: 5
5-95
Errors: Errors is x variable is not present which is written in printf statement
Question: 6
Predict the output of the following code.
{
Printf(."Hello World");
}
Answer: 6
6-95
Output: Hello World
Question: 7
List some important functions for output.
Answer: 7
7-95
Output Function in C-language:
  • Putchar()
  • Putch()
  • Puts()
  • printf()
Question: 8
Trace the errors in the following code.
#include <std.n>
Void main (void)
{
Printf ('Pakistan");
}
Answer: 8
8-95
Errors: Erros is wrong library has been used.
Question: 9
Find the errors from the following code.
#include <stdio.h>
#incluse<conio.h>
{
Void main();
printf (" Assembly Language");
}
Answer: 9
9-95
Errors: Errors is bracket is not correctly used in Main body.
Question: 10
Write the syntax of printf() statement.
Answer: 10
10-95
Printf(format string,&var,& var2,& var3,.......);
printf (format string);
Question: 11
What is the output of the following code?
Answer: 11
11-95
Printf ("I\Love\n programming");
Output: I
Love
programming


Question: 12
Find the output of the following code segment.
Int x = 10;
Int y = 5;
Int z = x+y;
Printf ("%d %d %d",x, y,z);
Answer: 12
12-95
Output: x = 10
y = 5
z = 15
Question: 13
Give single print statement to print the following message 'I Love Pakistan".
Answer: 13
13-95
Single Print Statement:
printf("I\N Love \n Pakistan");
Question: 14
Show Output.
Inti =515
Printf (" =%5d",i);
Printf (" =%2d",i);
Answer: 14
14-95
Output: I =515
I =51
Question: 15
Find Errors.
Main [ ];
(Float n;
Print f ('%dn);
}
Answer: 15
15-95
Errors:
  • 1st error is wrong brackets have been used with Main word
  • 2nd error is wrong brackets have been used with Main's body
  • 3rd error is variable n is not defines but it has been used in printf statement.
Question: 16
Write the Output of the following code :
Main()
{
printf("444\n");
printf("44");
}
Answer: 16
16-95
444
44
Question: 17
Find Errors in the following code.
Void main ( )
{
int num =10,
num + =5;
printf("\n %d" ,num);
}
Answer: 17
17-95
Errors:
  • Errors is ; terminator has not been used in statement where variable num is defined.
Question: 18
Find the error in the following code .
Void main ();
{
int num =10;
printf("%d,a);
}
Answer: 18
18-95
Errors:
  • Errors is Capital A is defined in int A= 10 statement but in printf statement small 'a' has been used
Question: 19
Find Error.
{
Float area ,r;
Printf ("Enter radius");
}
Answer: 19
19-95
Errors:
  • 1st error is no library has been used in program.
  • 2nd error is Mian body is not defined.
Question: 20
Give single print statement to print the following message.
No.of employees
No.of officers
Answer: 20
20-95
Single Print Statement:
printf("No.\n of \n employee");
printf(No.\n of \ n officers" );
Question: 21
Trace the error.
#include <stdio.h>
Void main (void)
Printf("Hello World");
Answer: 21
21-95
Errors: Errors is bracket have not been used in Main body.
Question: 22
Trace the errors.
#include<stdio.h>
Void main()
{
printf ("High Level Language")
}


Answer: 22
22-95
Errors:
  • Errors is terminator sign has not been used in printf statement.
Main()
{
printf("555\n");
printf ("55");
}
Question: 23
Find the Output of the following code.
#include <stdio.h>
Void main ()
{
int x =10, y= 20, z = 30;
x= x+y;
y =y+z;
z= x-y;
printf("result =%d%d%d",x,y,z);


Answer: 23
23-95
Output :
Result = 30 50 -20
Question: 24
Find the output.
#include <stdio.h>
Void main()
{
Int x, y;
X=10; y=20;
Printf(%d%d,x,y);
}
Answer: 24
24-95
Output:
X=10
Y=20
Question: 25
Trace the error in the following C code.
#include <stdio.h>
Void main()
{
prin ("C Language is interesting");
Answer: 25
25-95
Error:
  • Error is printf statement in not complete.
Question: 26
Find the error in the following code.
Main();
{
printf("Hellow);
}
Answer: 26
26-95
Error: Error is both commas is not written in printf statement.
Question: 27
Trace the error in the following code.
#include(stdio.h);
Void main()
{

Printf ("OK");
}
Answer: 27
27-95
Errors:
  • 1st error is brackets have been used in library which is not allowed.
  • 2nd error is both commas are not written in printf statement.
Question: 28
Trace the error.
#include <stdio.h>
Main()
{
printf("Hello world")
}
Answer: 28
28-95
Errors:
  • Errors is ; semicolon is not written in printf statement.
Question: 29
What is the use of field width specifier?
Answer: 29
29-95
Field Width Specifier: In a C program, the number of columns used to display a value on the screen is referred to a field width.
Field width: Field-width specifiers describe the number of columns that should be used to print a value.
Question: 30
Trace the error in th following code.
#include (std10.h)
Void main (void);
{
x = 5;
y = 6;
z = x+y;
printf ("%d",z);
}
Answer: 30
30-95
Errors: Errors is wrong library has been used in program.
Question: 31
Trace Error.
Include<STDIO.H>
VOID Main ();
{
printf ("Pakistan")
}
Answer: 31
31-95
Error:
  • 1st error is library is written in capital letter which is not allowed.
  • 2nd error is word void is written in capital letter which is not allowed
Question: 32
Trace output :
Int a =512;
Printf ("a+= %5d",a);
Printf ("a =%1d",a);
Answer: 32
32-95
Output:
a= 512
a=512
Question: 33
What is format specifier ?
Answer: 33
33-95
Format Specifier: Format specifier specify the information in which the value of the variable should be displayed on the screen . Format specifiers are specified in the format string.
Example: The following will show about format specifiers.
#include <stdio.h>
Void main (void)
{
Float var1, var2, res;
Var1 =24.27
var2 =41.50;
res var1 + var2;
Printf ("%f+%f =%f" ,var1, var2, res);
}
Here is the output of the program
24027+41.5 =65.77
Question: 34
Find the error in the following code.
Main();
{
printf("Hellow);
}
Answer: 34
34-95
Error: Error is both commas is not written in printf statement.
Question: 35
Trace the output.
Int I = 10
Printf ("%3d",i);
Answer: 35
35-95
Output: i=10
Question: 36
Trace the output.
Float f = 3.14159;
Printf ("f = %4.2f",f);
Answer: 36
36-95
Output: f=3.14
Question: 37
Trace the error in the following code.
#include<stdio.h>
#include<conio.h>
Void main <>
{
float area, r = 2.5;
area = 3.14x are * r;
printf ("Area =%f", area);
getch();
}
Answer: 37
37-95
Erros: Errors is brackets have not been used with Main which are necessary.
Question: 38
Write the output of the following code.
Int x= 9;
X = x%3;
Printf("\n%d is result",x);
Answer: 38
38-95
Output: x = 3
Question: 39
Trace the output :
Void main () {
CharW1,W2,W3;
W1 ='A'
W2 ='B'
W3 ='C';
Printf ("%c%cW3",W1,W2,);
Getch();
}

Answer: 39
39-95
Output:W3=Cw1 =Aw2 =B

Question: 40
Trace the output.
Void main() {
Int a, b, temp;
a =10;
b =10;
temp =b;
b = a
a = temp;
Printf ("%d\n",a);
Printf ("%d\n",b);
Getch ( ) ;}
Answer: 40
40-95
Output: a = 20
b = 10
Question: 41
Trace the output .
Int I = 20;
Printf ("%6d",i);
Answer: 41
41-95
Output;
i = 20
Question: 42
What will be the output of the following?
Float t = 3.8961
Printf ("value of t = % 6.2 f" ,t );
Answer: 42
42-95
Output:
t= 3.89
Question: 43
Write the output in the following code.
Int n =-25.41;
Printf ("%6.2f", n);
Answer: 43
43-95
Output: n= - 25.41
Question: 44
Find out the output of the following code.
Int a, b, c;
a =b =c = 6;
a= b;
b= a;
C=2;
Printf("%d%d%d",a,b,c);
Answer: 44
44-95
Output:
6,6,6
Question: 45
Trace the output of the following code.
{
Int x, y, z;
X = 3;
Y = 2;
z = 4;
Printf(%ds%d%d,x+y, y+5, x+z);
Getche();
}
Answer: 45
45-95
Output: 5,7,7
Question: 46
Trace the output.
#include <stdio.h>
Void main (void){
Int x = 10;
Print f (" %d",x %2);
Answer: 46
46-95
Output:
x = 5
Question: 47
Trace the output.
#include <stdio.h>
Void main (void)
{
int x = 1;
int y = 2;
x =x + 1;
y =y+ x ;
printf( "%d\n %d", x, y);
}
Answer: 47
47-95
Output:
x = 2
y = 4
Question: 48
Trace the error in the following code.
#include <stdio.h>
Void main (void)
{ int x= 4
Y =x+10
printf("%d",x+y);
}
Answer: 48
48-95
Errors:
  • 1st errors is terminator is not present in two statements.
  • 2nd error is variable y is not declared properly.
Question: 49
Trace the errors from the following piece of code.
Include <stdio.h>
Void main [ ]
{printf ('Pakistan');
}
Answer: 49
49-95
Errors:
  • 1st error is # sign is not present with include.
  • 2nd error is ( ) small brackets must be used with Main body.
Question: 50
Find the output of the following code.
Int a = 10, b =12;
Int sum =a+b;
Printf("%d",sum);
Answer: 50
50-95
Output:
Sum = 22
Question: 51
Determine the output of the given segment.
inti=212;
Printf ("i = %5d" ,i);
Printf ("i =%3d" ,i);
Answer: 51
51-95
Output:
i 212
i=212
Question: 52
Predict the output of the following code.
Int number = 2;
Number ++;
Printf ("%d",number);
Answer: 52
52-95
Output:
Number = 3
Question: 53
Trace out the errors in the following code.
Int a,
Prin ("%d",a);
Answer: 53
53-95
Errors:
  • 1st error is variable a must be declared with data type char.
  • 2nd error is spelling of printf in print statement is wrong.
Question: 54
What will be the output of the following?
Float f = 3.24;
Printf( "value =%f",f);
Answer: 54
54-95
Output:
f =3.24
Question: 55
Predict the output of the following code.
Int number =6;
Nymber ++;
Printf("%d\n", number);
Answer: 55
55-95
Output:
Number = 7
Question: 56
Write the output of the following code.
Int x =3;
Printf("%d",x);
Printf("%d",x++);
Printf("%d",++x);
Answer: 56
56-95
Output:
x = 3
x = 3
x = 4
Question: 57
Trace Output:
Void main( )
{
int a, b;
a = 10;
b = 12;
int c= a+b;
printf ("c = %3d",--c);
}
Answer: 57
57-95
Output:
c= 2221
Question: 58
Trace the error of the given code.
Include<stdio.h>
Main()
{int i = 10;
Printf("%d",i) ;}
Answer: 58
58-95
Errors:
  • Errors is # sign is not present with include.
Question: 59
Trace the errors in the following programs.
Include<stdio.h>
Mian()
{
int a = 10;
printf("%d",a);
}
Answer: 59
59-95
Errors:
  • 1st errors is # sign is not present with include.
  • 2nd error is capital S cannot be used is stdio.h library.
Question: 60
Find the errors in the following piece of code.
#include (stdio.h)
Void Main ()
int a =10;
Printf("%f",a);
Answer: 60
60-95
Errors:
  • 1st errors is Void Main must be written in small letters.
  • 2nd error is in printf statement starting of Printf must be with small letter.
Question: 61
Trace the error.
Int p,q, r;
P = 50000,10
Printf("%d",p);
Answer: 61
61-95
Errors:
  • 1st error is we cannot set two values together to a variable.
  • 2nd error is ;terminator sign has not been used in statement where variable P is declared.
Question: 62
Predict the output of the following.
Float f = 3.14159
Print f (" f = %4.2f" , f);
Answer: 62
62-95
Output:
f =3.14
Question: 63
Trace the output.
Void main () {
Int a, b, n;
N =400;
A = n % 100;
B = n/ 10;
N = n % 10;
Printf ("%d\n",a);
Printf (%d\n"b);
Printf (%d\n"n);
Getch( );}
Answer: 63
63-95
Output:
a = 4
b = 40
n =40
Question: 64
Predict the output of the following code.
Void main ( )
{
Char ch1 = ‘A’, ch2 =’B’, ch3 = ‘C’;

Printf (“ch2 \n %c\n ch1”,ch3);

Getch ( );

}

Answer: 64
64-95
Output: Ch2 = B

Ch1 = A

Ch3 = C

Question: 65
Find the output of the following code.
Printf("Book\ t reading\n");
Printf("is a \t very good \n habit");
Answer: 65
65-95
Output:
Book reading
is a very good
habit
Question: 66
Trace the errors from the following.
Void main ( );
{ float I = 15.6;
printf (" %d",i);
}
Answer: 66
66-95
Errors:
  • Errors is terminator sign has not been used with Main starting.
Question: 67
Define Escape sequence.
Answer: 67
67-95
Escape sequences are characters which are specified in the format string of the printf statement in combination with backslash (\). These cause an escape from the normal interpretation of a string so that the next character is recognized as having special meaning.
Question: 68
Write down output of the following.
Float f = 3.14159;
Printf ("f %4.f",f);
Answer: 68
68-95
Output:
F = 3.14
Question: 69
Write down output of the following piece of code.
Printf( "*\n**\n***);
Answer: 69
69-95
Output:
*
**
***
Question: 70
Find the error:
Void main ( )
{
int a =10;
printf ("%s",b);
}
Answer: 70
70-95
Error:
  • Error is variable b is not defined which is present in printf statement.
Question: 71
What will be the output from the following code?
Void main ( );
{ int a,b, temp;
a = 10;
b = 20;
temp = a;
a = b;
b = temp;
printf ("a =%d\t b = %d" , a, b);
}
Answer: 71
71-95
Output :
A = 20
B = 10
Question: 72
Find the output of the following code.
Printf( "Programming\t is \n very \t interesting");
Answer: 72
72-95
Output:
Programming is
very interesting
Question: 73
Trace the output of the following.
X = 5;
Y =x++;
Printf ("d%d",x,y);

Answer: 73
73-95
Output:
x = 5
y = 5
Question: 74
Trace the output.
Void main ( ){
Int x,y, z;
X = 10;
Y = 20;
Z = 30;
X = x+ y;
Y = y+ z;
Z = x- y;
Printf("result = %d%d%d\n",x,y,z);
getch();}
Answer: 74
74-95
Output
Result = 30, 50 10
Question: 75
List some input functions in C-Language.
Answer: 75
75-95
Input functions in C-Language:

  • Getchar ( )
  • Getch ( )
  • Gets ( )
  • Scanf ( )
Question: 76
Trace the error.
Int x = 5;
Int y
Y = x+3
Printf("%d" ,,y );
Answer: 76
76-95
Error:
  • Error is terminator sign id not present in statements in which variable y is defined and declared.
Question: 77
Find the output of the following code .
Printf ("Pakistan\n is an \n Islamic \ n country");

Answer: 77
77-95
Output:
Pakistan
is
an
Islamic
Country
Question: 78
Trace the output .
Int n =6;
N+ +;
Printf ("%d",n);
Answer: 78
78-95
Output :
n = 7
Question: 79
Define Standard input.
Answer: 79
79-95
Standard Input: Standard input is a steam sata (often text)
Going into a program.The program request data transfers by use of the read operation. Not all programs require stream input.
Example: the dir and Is programs (which displays files names contained in a directory) may take command-line arguments, but perform their operations without stream data input.
Question: 80
Why the ampersand (& )used in scanf is function?

Answer: 80
80-95
Ampersand (& )in scanf function: The ampersand is the address-off operators, In C, if we want to pass parameters by reference the address of (&) operators should be used. The scanf () function reads formatted input and has to put this input into something like a variable .
Question: 81
Predict the output of the following code.
Printf ("*\n**\n***\n****\n");
Answer: 81
81-95
Output:
**
***
****
Question: 82
Describe getch ( ) function.?
Answer: 82
82-95
getch ( ) function: The getch ( ) function is very handy in character manipulation. The getch ( ) function does not accept echo the character typed. This function does not accept any argument.However it returned the typed character to the calling function.
Question: 83
Trace the output of the following code .
Void main ( )
{
printf ("22\t");
printf ("666");
}
Answer: 83
83-95
Output:
22,666
Question: 84
Trace the error in the following code.
Float area , r
Printf (" Enter Radius")
scanf(%f"r);
Answer: 84
84-95
Errors:
  • 1st error no Main body is present
  • 2nd error is : terminator sign is not present in statement where variable is defined.

Question: 85
Trace the output of the following code.
Int i = - 786;
Printf( "%6d",i);
Answer: 85
85-95
Output:
i = -786
Question: 86
What is the use of "scan f" function?Also write its syntax.
Answer: 86
86-95
Scan f Function: In C, the standard input library provides function to perform input and output operations. This input operations are performed by scanf ( ) function. The scanf (pronounced as scan -eff) function is versatile as it is equally good for numeric as well as string input .
Syntax : Here is the syntax of scanf function.
Scanf(format string, &var1,&var2, &var3,....);
Question: 87
Find the error in the code .
#include <STDIO>H>
VOID MAIN( ){
Int a;
A = 20
Printf ("%f",a);
Getch( );}
Answer: 87
87-95
Error:
  • Error is wrong library has been used in this program.
Question: 88
Explain getch ( ) function .

Answer: 88
88-95
The getch ( ) function is very handy in character manipulation . This function does not accept any argument ,However it returned the typed character to the calling function.
Question: 89
Compare getch and getche functions
Answer: 89
89-95
Getch ( ) function:

  • Getch function is very handy is character manipulation.
  • It does not eco the character typed.
  • It does not accept any arguments.
Question: 90
Write the output of the following code.
Int x, y,z, r;
Printf("Enter three numbers;");
Scanf("%d%d%d", &x,&y, &z);
r =x + y *z ;
Printf( "Enter three numbers :");
Scanf ("%d%d%d", &x,&y,&z);
r = x+y* z;
Printf ("%d",r);

Answer: 90
90-95
Output :
Enter three number 235
r = 17
Question: 91
Find the errors in the following code.
#include <stdio.h>
Void main ()
{
Float area ;r ;
Scanf ("%c"&r);
Area = 3.14*r*r;
Printf ("area = %f"area);
}
Answer: 91
91-95
Error:
  • Error is the value of variable are is not declared.
Question: 92
Trace the error in the following code.
#include<stdio.h>
Void main( )
{
Inti;
Scanf ("%d",i);
Printf( "%d,i) ;
}
Answer: 92
92-95
Errors:
  • 1st errors is spelling of word main is incorrect.
  • 2nd error is in printf statement closing comma is not present.
Question: 93
Write the output of the following code.
#include <stdio.h>
#include <conio.h>
Void main ( )
{
int x, y,z,;
Printf ("Enter three numbers;")
Scanf ("%d %d %d" ,&x, &y, &z;
Y = x+z;
X =z+ 1;
Scanf("%d %d %d , x, y, z);
Y =x +z;
X =z +1 ;
Scanf ("%d %d %d",x, y,z);
Getch ( );
}
Answer: 93
93-95
Output:
Enter three numbers 2 3 5
x = 6
y = 7
z = 5
Question: 94
Trace out errors in the following code.
Float r;
Clscr ();
Printf ("enter radius);
Scanf ("%f; r);
Answer: 94
94-95
Errors:
  • Erros is no main body is present.
Question: 95
What is the output of the following ?#include <stdio.h>#include <conio.h>Void main ( ){Inti =5;Printf(%d%d%d",i.i++,++i);getch();}
Answer: 95
95-95
Output: 5,5,6