computer- question bank
TRANSCRIPT
ARYAVART INSTITUTE OF TECHNOLOGY & MANAGEMENTARYAVART INSTITUTE OF TECHNOLOGY & MANAGEMENT
ECS-101, Computer Concepts & Programming in CQUESTION BANK
UNIT IOBJECTIVE QUESTIONS
1. A Compiler is ____
a combination of computer hardware
a program which translates from one high-level language to another
a program which translates from one high-level to a machine level
None of these
2. When a key is pressed on the keyboard, which standard is used for converting the keystroke into the corresponding bits
ANSI ASCII EBCDIC ISO
3. A Pixel is
A computer program that draws picture
A picture stored in secondary memory
The smallest resolvable part of a picture
None of these
4. Which device is used as the standard pointing device in a Graphical User Environment
Keyboard Mouse Joystick Track ball
5. Which number system is usually followed in a typical 32-bit computer?
2 10 16 32
6. Which of the following is not an output device?
Scanner Printer Flat Screen Touch Screen
7. Which of the following devices have a limitation that we can only information to it but cannot erase or modify it
Floppy Disk Hard Disk Tape Drive CDROM
8. Which technology is used in Compact disks?
Mechanical Electrical Electro Magnetic Laser
9. Which of the following storage devices can store maximum amount of data?
Floppy Disk Hard Disk Compact Disk Magneto Optic
Disk
10. The programs which are as permanent as hardware and stored in ROM is known as
Hardware Software Firmware ROMware
11. Memory is made up of
Set of wires Set of circuits Large number of
cells All of these
12. Primary memory stores
Data alone Programs alone Results alone All of these
13. EPROM can be used for
Erasing the contents of ROM
Reconstructing the contents of ROM
Erasing and reconstructing the contents of ROM
Duplicating ROM
14. Which device can understand difference between data & programs?
Input device Output device Memory Microprocessor
15. The contents of information are stored in
Memory data register
Memory address register
Memory access register
Memory arithmetic register
16. Memory unit is one part of
Input device Control unit Output device Central Processing
Unit
17. Algorithm and Flow chart help us to
Know the memory capacity
Identify the base of a number system
Direct the output to a printer
Specify the problem completely and clearly
18. Which of the following is not a valid size of a Floppy Disk?
8" 5 1/4"
19. C is a ___ language
High Level Low Level Middle Level Machine Level
20. C language is available for which of the following Operating Systems?
DOS Windows Unix All of these
UNIT ISHORT QUESTIONS
1. To which numbering system can the binary number 1101100100111100 be easily
converted?
2. Draw a flowchart to find the greatest of three numbers.
3. What is structured programming? Explain.
4. What do you mean by programming environment, name few C compilers.
5. Explain the importance of an operating system?
UNIT ILONG QUESTIONS
1. Differentiate between different number systems. How a binary number is converted
into a decimal number? Explain.
2. How flowcharts are different from algorithms, show with an example.
3. What is a digital computer? Explain its parts.
4. What do you understand by top down development of programs and stepwise
refinement?
5. Why C is called Middle level language? Explain.
UNIT IIOBJECTIVE QUESTIONS
1. Which of the following is a Scalar Data type
Float Union Array Pointer
2. Which of the following are tokens in C?
Keywords Variables Constants All of the above
3. What is the valid range of numbers for int type of data?
0 to 256 -32768 to +32767 -65536 to +65536 No specific range
4. Which symbol is used as a statement terminator in C?
! # ~ ;
5. Which escape character can be used to begin a new line in C?
\a \b \m \n
6. Which escape character can be used to beep from speaker in C?
\a \b \m \n
7. Character constants should be enclosed between ___
Single quotes Double quotes Both a and b None of these
8. String constants should be enclosed between ___
Single quotes Double quotes Both a and b None of these
9. Which of the following is invalid?
‘’ “ “ ‘a’ ‘abc’
10. The maximum length of a variable in C is ___
8 16 32 64
11. What will be the maximum size of a float variable?
1 byte 2 bytes 4 bytes 8 bytes
12. What will be the maximum size of a double variable?
1 byte 4 bytes 8 bytes 16 bytes
13. A declaration float a,b; occupies ___ of memory
1 byte 4 bytes 8 bytes 16 bytes
14. The size of a String variable is
1 byte 8 bytes 16 bytes None of these
15. Which of the following is an example of compounded assignment statement?
a = 5 a += 5 a = b = c a = b
16. The operator && is an example for ___ operator.
Assignment Increment Logical Rational
17. The operator & is used for
Bitwise AND Bitwise OR Logical AND Logical OR
18. The operator / can be applied to
integer values float values double values All of these
19. The equality operator is represented by
:= .EQ. = ==
20. Operators have hierarchy. It is used to know which operator
is most important is used first is faster operates on large
numbers
21. The bitwise AND operator is used for
Masking Comparison Division Shifting bits
22. The bitwise OR operator is used to
set the desired bits to 1
set the desired bits to 0
divide numbers multiply numbers
23. Which of the following operator has the highest precedence?
* == => +
24. The associativity of ! operator is
Right to Left Left to Right (a) for Arithmetic
and (b) for Relational (a) for Relational
and (b) for Arithmetic
25. Which operator has the lowest priority?
++ % + ||
26. Which operator has the highest priority?
++ % + ||
27. Operators have precedence. A Precedence determines which operator is
faster takes less memory evaluated first takes no
arguments
28. Integer Division results in
Rounding the fractional part
truncating the fractional part
Floating value An Error is
generated
29. Which of the following is a ternary operator?
? * sizeof ^
30. What will be the output of the expression 11 ^ 5?
5 6 11 None of these
31. The type cast operator is
(type) cast() // " "
32. Explicit type conversion is known as
Casting Conversion Disjunction Separation
33. The operator + in a+=4 means
a = a + 4 a + 4 = a a = 4 a = 4 + 4
34. p++ executes faster than p+1 because
p uses registers p++ is a single
instruction ++ is faster than
+ None of these
UNIT IISHORT QUESTIONS
1. Write a program to compute the addition, subtraction, product, quotient and remainder of two given numbers.
2. Write a program to compute the average of three given numbers3. Write a program to compute simple interest and compound interest from the given
principal, time period and interest rate.4. Write a program to compute the area of a circle from the given radius.
Hint: - Area of the circle=3.14 x (radius) 2.5. Write a program to swap the values of two variables.
UNIT IILONG QUESTIONS
1. What does static variable mean?2. Explain the difference between printf statement and scanf statements.3. What does the storage classes refer in ‘C’ language? 4. What are operators and expressions? Explain various types of operators used in C.5. Differentiate between Data Types and Storage Classes? Classify different datatypes.
UNIT IIIOBJECTIVE QUESTIONS
1 What will be the output of the following program?main() { int i=1,j,k;if(i>=2)j=2;k=3;printf(“\n%d%d”,j,k);
}A) 2,3B) 0,0C) 0,3D) 3,2
2 Which of the following keyword is used to jump out of a loop without waiting to get back to the conditional test?A) breakB) continueC) whileD) exit
3 Pick up the odd one out from the following.A) a=a+1;B) a+=1;C) a++;D) a=+1;
4 In the for statement : for (exp1; exp2; exp3 ) { ……..}where exp1, exp2 and exp3 are expressions. What is/are optional?
A) None of the expressions are optional.B) Only exp1 and exp3 are optional.C) Only exp1 is optionalD) All the expressions are optional.
5 Which of the following is false for goto statement?
A) Use of the goto statement should generally be avoided.B) A goto statement transfers the control to a labeled statement.C) No two statements in a function can have same label.D) With a goto statement, the control can be transferred to any statement of other
program.
6 The output of the following code segment will bechar x = ‘B’;switch ( x ) {
case ‘A’ : printf(“a”);case ‘B’ : printf(“b”);case ‘C’ : printf(“c”);
}
A) BB) bC) BCD) bc
7 How many times following loop will be executed?for(a = 0; a < 14 ; a++)printf(“hello\n”);A) 15B) 13C) 14D) infinite
8 What is the output of the following code:b = ++c + ++ c; if c is 10 initiallyA) 20B) 23C) 24D) 22
9 The goto statement causes control to go toA) an operatorB) a labelC) a variableD) a function
10. void main(){int i=0;for( ; i; )print”there is some mail for you”);}A. no output B. infinite loop C. there is….
D. error
11. C supports how many basic looping constructs
2 3 4 6
12. What should be the expression return value for a do-while to terminate
1 0 -1 NULL
13. Which among the following is a unconditional control structure
do-while if-else goto for
14. continue statement is used
to go to the next iteration in a loop
come out of a loop exit and return to
the main function restarts iterations
from beginning of loop
15. The continue command cannot be used with
for switch do while
16#include<stdio.h>void main(){float a=0.7;if(0.7>a)printf(“Hi ”);elseprintf(“Hello ”);}a ] Hi b ] Hello c ]Hi Hello d ] None of the above
17#include<stdio.h>void main(){extern int i;i=20;printf(“%d ”,sizeof(i));}a ] 2 b ] 4 c ] Cannot be said d ] None of the above
18#include<stdio.h>void main(){int i=5.99999;printf(“%d ”,i);}a ] 6 b ] 5 c ] Error cannot assign float to integerd ] None of the above
19 #include<std o.h>
void main(){int i=1;if(!i)printf(“recursive calls are painful \n ”);else{i=0;printf(“recursive calls are challenging \n ”);main();}}a ] recursive calls are challengingrecursive calls are painfulb ] recursive calls are painfulrecursive calls are challengingc ] recursive calls are painfuld ] recursive calls are challenging (infinitely.....)20#include<std o.h>void main(){printf(“%d ”,main());}a ] prints garbage value infinitelyb ] it runs an infinite loop without printing anythingc ] compiler reports an error since main cannot be called recursivelyd ] address of main gets printed infinitely
UNIT IIISHORT QUESTIONS
1. Write a program to compute net amount from the given quantity purchased and rate per quantity. Discount @10% is allowed if quantity purchased exceeds 100.Net Amount = (Quantity Purchased x Rate Per Quantity) – Discount.
2. Write a program to find out a person is insured or not. The person is insured if following conditions are satisfied: -
i) If the person is married.ii) If the person is unmarried, male & above 30 years of age.iii) If the person is unmarried, female & above 25 years of age.
In all other cases the person is not insured.
3. Write a program to compute the division from the given marks of 5 subjects. The division can be calculated as follows: -
Average Mark Division>=60 First>=50 Second>=40 Third<40 Fail
4. Write a program to ask the user to enter a series of marks of a student. If the user enters –1, come out of the loop and print the average mark.
5. Write a program to print the sum of digit of a given number.
6. Write a program to print “Hello World” in the main function and “Welcome To C” in another function.
UNIT IIILONG QUESTIONS
1. What is recursion?
2. Differentiate between a for loop and a while loop? What are it uses?
3. Explain multi way decision statements with examples.
4. Differentiate between while and do-while loop.
5. How recursion is different then other functions? Explain.
UNIT IVOBJECTIVE QUESTIONS
1. A multidimensional array can be expressed in terms of
array of pointers rather than as pointers to a group of contiguous array
array without the group of contiguous array
data type arrays None of these
2. C allows arrays of greater than two dimensions, who will determined this
programmer compiler parameter None of these
3. A pointer to a pointer in a form of
multiple indirection
a chain of pointers both a and b None of these
4. Pointers are of
integer data type character data
type unsigned integer
data types None of these
5. Maximum number of elements in the array declaration int a[5][8] is
28 32 35 40
6. If the size of the array is less than the number of initializers then,
Extra values are being ignored
Generates an error message
Size of Array is increased
Size is neglected when values are given
7. Array subscripts in C always start at
-1 1 0 Value provided by
user
8. A Structure
can be read as a single entity
cannot be read as a single entity
can be displayed as a single entity
has member variables that cannot be read individually
9. Identify the invalid pointer arithmetic
Addition of float value to a pointer
Comparision of pointers that do not point to the element of the same array
Subtracting an integer from a pointer
Assigning the value 0 to a pointer variable
10. In C, a Union is
memory location memory store memory screen None of these
11#include<stdio.h>void main(){union a{int i;char ch [2 ];};union a u;u.ch [0 ]=3;u.ch [1 ]=2;printf(“%d ”,u.i);}a ] 515 b ] 770 c ] 0 d ] Error:u.i is uninitialized
12Assume that variable x resides at memory location 100, y at 200 and ip at 1000.
int x=1; y=2; int *ip;ip=&xy=*ip
What will be the value of y after execution of above code?A) 1B) 2C) 100D) 1000
13Which of the following is the correct way of declaring an array of integer pointers?A) int *arr[10];B) int arr[10];C) *int arr[10];D) int *arr;
14Consider the following code segment
int a[10], *p1, *p2;p1 = &a[4];p2 = &a[6[;
Which of the following is incorrect w.r.t pointers?
A) p1 +2B) p2 - 2C) p2 - p1D) p2 +p1
15
Which variable type holds at a common assigned area different data types of varying sizes at different points in time?A) structB) unionC) enumD) none of the above
16.void main(){struct test{char ch;int data;float f;}printf(“%d”,sizeof(struct test));}a. 7 b. can’t predict c. error d. none of the above
17.void main(){int a[5];a[0]=0;if(a[0]++)print(“forget me”);elseprint(“miss me”);}a. forget me b. miss me c. error d. none of the above
18. void main(){printf(“It is a small world after all”);main();}a. print one time b. print infinite c. print nothing d. error
19. void main(){int i=5, j=2;fun(i,&j)printf(“\n%d %d”,i,j);}void fun(int i, int *j){i=i*i;*j=(*j) * (*j);}
20. void main(){int m[2];int *p=m;m[0]=100;m[1]=200;printf(“\n %d%d”,++*p,*p);}a. 101100 C 100101 c. 101101 d. 100100UNIT IVSHORT QUESTIONS
1. Write a program to create an array. Print the highest and lowest number in the array.2. Write a program to create two matrixes. Multiply the values of the two matrixes and
store it in another matrix. Display the new matrix.3. Write a program to check if a given string is palindrome or not. A string is said to be
palindrome if the reverse of the string is equal to the string.4. Write a program to find the maximum number within n given numbers using pointers.5. Write a program to create a book structure having name, author, page and price.
UNIT IVLONG QUESTIONS
1. Write down the equivalent pointer __expression for referring the same element a[i][j][k][l]?
2. What is difference between Structure and Unions? 3. What the advantages of using Unions? 4. What are the advantages of using pointers in a program? 5. What is the difference between Strings and Arrays?
UNIT VOBJECTIVE QUESTIONS
1. Which of the following statements is true?
C Library functions provide I/O facilities
C inherent I/O facilities C doesn’t have I/O facilities
Both (a) and (c)
2. Header files in C contain
Compiler commands
Library functions Header
information of C programs
Operators for files
3. Which pair of functions below are used for single character I/O.
Getchar() and putchar()
Scanf() and printf()
Input() and output()
None of these
4. The printf() function retunes which value when an error occurs?
Positive value Zero Negative value None of these
5. Identify the wrong statement
putchar(65) putchar('x') putchar("x") putchar('\n')
6. Which of the following is charecter oriented console I/O function?
getchar() and putchar()
gets() and puts() scanf() and printf() fgets() and fputs()
7. The output of printf("%u", -1) is
-1 minimum int value maxium int value Error message
8. An Ampersand before the name of a variable denotes
Actual Value Variable Name Address Data Type
9. Symbolic constants can be defined using
# define const symbols None of these
10. Null character is represented by
\n \0 \o \e
11. Which header file is essential for using strcmp() function?
string.h strings.h text.h strcmp.h
12. malloc() function used in dynamic allocation is available in which header file?
stdio.h stdlib.h conio.h mem.h
13. File manipulation functions in C are available in which header file?
streams.h stdio.h stdlib.h files.h
14. Which of the following header file is required for strcpy() function?
string.h strings.h files.h strcpy()
15. which of the following is not a header file in C?
string.h strings.h stdbook.h strcpy()
16 #include<stdio.h>#define SWAP(a,b,c)(c t;t=a,a=b,b=t;)void main(){int x=10,y=20;SWAP(x,y,int);printf(“%d %d ”,x,y);}
17 #include<stdio.h>#define MAX(a,b,c)(a>b?a>c?a:c:b>c?b:c)/*?:has right to leftassociativity */void main(){int x;x=MAX(3+2,2+7,3+7);printf(“%d ”,x);}a ] 5b ]9c ]10d ]3+7
18Which of the following is returned by the function ‘strcmp’ if the strings that are compared are identical?
A) 0B) 1C) 2D) true
19The statement that defines an input file handle called input_file, which is a pointer to type FILE, is:
A) FILE*input_file;B) type input _file as FILE;C) input_file FILE;D) *FILE input_file;
20Close the file associated with input_file
A) close input_file;B) fclose(input_files);C) fcloseall();D) input_file(fclose);
UNIT VSHORT QUESTIONS
1. Write a program which uses Command Line Arguments
2. Write a program which uses functions like strcmp(), strcpy()? etc
3. Write a program to sort an array using Bubble Sort Algorithm.
4. Write a program to search a key number in an array using Sequential Search Methd.
5. Write a program to read a text file print it on the screen.
UNIT VLONG QUESTIONS
1. What are macros? what are its advantages and disadvantages?
2. In a header file whether functions are declared or defined?
3. Are the variables argc and argv are local to main?
4. What do the functionsatoi(), itoa() and gcvt() do?
5. Can you use the function fprintf() to display the output on the screen?