0% found this document useful (0 votes)
313 views

CP Bits

This document contains details about a computer science and engineering course file including information about units of study, subject code, academic year, and objective type questions related to topics like introduction to computers, designing structured programs, pointers and strings, and derived types and files. The objective type questions cover topics like basic computer components, programming concepts in C like functions, arrays, structures, pointers, strings and files.

Uploaded by

Ashok Oruganti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
313 views

CP Bits

This document contains details about a computer science and engineering course file including information about units of study, subject code, academic year, and objective type questions related to topics like introduction to computers, designing structured programs, pointers and strings, and derived types and files. The objective type questions cover topics like basic computer components, programming concepts in C like functions, arrays, structures, pointers, strings and files.

Uploaded by

Ashok Oruganti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

COURSE FILE
SUBJECT CODE:
L:3 P:3 T:1 C:6
ACADEMIC YEAR: 2014-2015
UNIT-I
INTRODUCTION TO COMPUTERS
Objective Type Questions
1. ALU stands for ________
2. The process of repeating statements in an algorithm is known as ________
3. _______ translates high level language source code into low-level language
4. Output of the assembler in the form of 0s and 1s is called _________
5. Which of the following is a component of of a computer system
a) Hardware b) Software

c) both hardware & software d) pseudocode

6. Which of the following is an example of application software


a) Database Management Systems b) Language translator
c) Operating System

d) Security monitor

7. Tool used for translating assembly language program into machine language is ________
8. Pictorial representation of algorithm is _____________
9. _________ computing environment splits the computing function between a central computer and
users computers.
10. Computing environments are divided into ____ types
a) 2

b) 4

c) 5

d) 3

11. The software used to write programs is known as a _________


12. Popular development life cycle model is _
a) Waterfall b) prototype

c) object-oriented

d) spiral

13. Structure chart is also known as


a) Hierarchy chart

b) flowchart

c) Multichart d) none

14. Black-box testing is developed by looking only at the _______ statement


a) Functioning

b) requirement

c) both

d) none

15. ___ connector is used to connect flowchart from one page to another
a) circle

b) Pentagon

c) square

d) rectangle

16. a<<1 is equivalent to


a) multiplying by 2 b) dividing by 2 c) adding 2 d)none of the above
17. The operation of a stair case switch best explains the
a) or operation b) and operation c)exclusive nor operation d)exclusive or operation
18. Which of the following is/are syntactically correct?
a) for(); b) for(;); c) for(,); d) for(;;);
19. The expression 4+6/3*2-2+7%3 evaluates to
a) 3 b) 4 c) 6 d) 7
20. Any C program
a) must contain at least one function b) need not contain ant function c) needs input data d)
none of the above
21. Using goto inside for loop is equivalent to using
a)continue b) break c) return d)none of the above
22. The program fragment int a=5, b=2; printf(%d,a+++++b);
a)prints 7 b)prints 8 c) prints 9 d)none of the above
23. printf(ab , cd,ef); prints
a)ab abcdef c) abcdef, followed by garbage value d) none of the above
24. Consider the following program segment. i=6720; j=4; while((i%j)==0)
{
i=i/j;
j=j+1;
}
On termination j will have the value
a)4
b) 8
c) 9
d) 6720
25. What types of errors checked during compilation
a)Logical errors
b) divide-by-zero error
c) run-time error
d) syntax error
26. Size of long double variable is ________
27. ____________ are identifiers reserved by the C language for special use
28. The ___________ of operator gives the order in which operators are applied in expressions.
29. _________ is very similar to the while loop except that test occurs at the end of loop
30. What will be output when you will execute following c code?
#include<stdio.h>
int main(){
printf("%d\t",sizeof(6.5));
printf("%d\t",sizeof(90000));
printf("%d",sizeof('A'));

31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.

return 0;
}
Choose all that apply:
a)4 2 1 b) 8 2 1
c) 4 4 1
d)8 4 1
e)821
Which of the following language is predecessor to C Programming Language?
a)A
b) B c) BCPL
d) C++
C programming language was developed by
A) Dennis Ritchie b) Ken Thompson c) Bill Gates d) Peter NortonDf
C was developed in the year _____
Which of the following symbol is used to denote a pre-processor statement?
a)!
b) #
c) ~
d) ;
Which escape character can be used to begin a new line in C?
a) \a b) \b c) \m d) \n
Which escape character can be used to beep from speaker in C?
a)\a
b) \b c) \m d) \n
Character constants should be enclosed between ___
a)Single quotes
b) Double quotes
c) Both a and b
d) None of these
The maximum length of a variable in C is ___
a)8
b) 16 c) 32 d) 64
What will be the maximum size of a float variable?
a)1 byte
b) 2 bytes
c) 4 bytes
d)8 bytes
What will be the maximum size of a double variable?
A)1 byte
b) 4 bytes
c) 8 bytes
d) 16 bytes
A declaration float a,b; occupies ___ of memory
The size of a String variable is __________

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


COURSE FILE
SUBJECT CODE:
L:3 P:3 T:1 C:6
ACADEMIC YEAR: 2014-2015
UNIT-II
DESIGNING STRUCTURED PROGRAMS
Objective Type Questions
1. A function which calls itself is known as _______
2. Which one of the following is not a part a function header
a) Name b) Parameter List
c) return type d) title
3. Which of the following is not a storage class
a) Static b)auto c) run d)registrar
4. The default value of static storage class
a) 0 b) 1 c) null d) none of the above
5. What is the default storage class
6. a) auto b) extern c) static d) register
7. which of the following is not an application of recursion
a) gcd b) factorial c) Fibonacci d) sum of element in an array
8. Which of the following is not part of a function header
a) Name b) parameter list c) return type d) title
9. Which of the following is correct about array?
a) *(s+2) b) *(s+3) c) s+3 d) s+2
10. Default return type of main function is
a) Float b) char c) int d) none of the above
11. An array is collection of _________________ type of elements
12. Which of the following is not a preprocessor directives
a) #define b) #if c) #else d) #and
13. A function can be called in_____________ ways
14. An array is ___________datatype
a) Primary b) derived c) both d) none
15. Find the wrong answer from the following
a) Size of an array must be positive b) size of an array must be negative
b) Both
d) none
16. Which of the following is the correct way of declaring a float pointer
a) Float ptr b) float *ptr
c) *float ptr d) none
17. What is the output of the following
Main()
{
Int a[10],I;
For (i=0;i<=5;i++)
{
a[i]=i;
Printf(%d,a[i]);
}
a) 3 b)4 c) 5 d) none

18. Which of the following is correct about an array


a) int num[10]
b) int num(10) c) int num{10}
19. What is the output of the following
Main()
{
int b[5]={10,20,30,40,50};
int i;
For (i=0;i<=4;i++)
printf(%d,*(b+i));
}
a) 100 B)50 c) 150 d) none

d) none

20. Which of the following is possible functions with arrays


a) Calling individual elements in an array
b) Calling an entire array into a function
c) Calling two element in an array
d) Both a,b,only

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


COURSE FILE
SUBJECT CODE:
L:3 P:3 T:1
ACADEMIC YEAR: 2014-2015
UNIT-III
POINTERS & STRINGS
Objective Type Questions

C:6

1. What is (void*)0?
a) Representation of NULL pointer
b) Representation of void pointer
c) Error
d) None of above
2. Can you combine the following two statements into one?
char *p;
p = (char*) malloc(100);
a) char p = *malloc(100);
b) char *p = (char) malloc(100);
c) char *p = (char*)malloc(100);
d) char *p = (char *)(malloc*)(100); fgf
3. In which header file is the NULL macro defined?
A stdio.h
B. stddef.h
C stdio.h and stddef.h
D. math.h
4. If a variable is a pointer to a structure, then which of the following operator is
used to access data members of the structure through the pointer variable?
A.
.
B.
&
C.
*
D.
->
5. What would be the equivalent pointer expression for referring the array element
a[i][j][k][l]
A.
((((a+i)+j)+k)+l) B.
*(*(*(*(a+i)+j)+k)+l)
C.
(((a+i)+j)+k+l)
D.
((a+i)+j+k+l)
6. A pointer is
A.
A keyword used to create variables
B.
A variable that stores address of an instruction
C.
A variable that stores address of other variable
D.
All of the above
7. The operator used to get value at address stored in a pointer variable is
A.
*
B.
&
C.
&&
D.
|| bvcb
8. What will be output when you will execute following c code?
#include<stdio.h>
int main(){
const int *p;
int a=10;
p=&a;
printf("%d",*p);
return 0;
}
Choose all that apply:

(A)
0
(B)
10
(C)
Garbage value
(D)
Any memory
address
9. Which of the following is not possible with pointers
a) Pointer addition b) Pointer multiplication c) pointer division d) none
10.Any string is end with _______________
11.A string is collection of _______________
12.Which of the following is a string input function
a)gets() b)puts()
c)getc()
d)putc()
13.What is function we used to count the remaining space in dynamic memory
allocation
A) Malloc() b) calloc() c) free() d)coreleft()
14.A generic pointer is a
a) Pointer with void
b) pointer with integer
c)pointer with float

d) none of the above

15.Which of the following is not a string function


a)printf()
b) strcpy()
c)strncpy()

d)strcmp()

16.Which of the following is correct about command line argument


a) Main(int argc, char *argv)
b) main(int argc, char **arg v())
c)main(char *argv(), int argc)
d)main( char **argv(), int argc)
17.In command line argument the input is given from:?
a)from run time
b)at compile time
c)from command line
d)none
18.A pointer to pointer is a_________________________________________
19.A Pointer can be represented by using ______________ key
20.Which of the following is a disadvantages of pointers
a. Implementing the data structures
b) dynamic memory
allocation
c)memory leakage
d) none
.

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


COURSE FILE
SUBJECT CODE:
L:3 P:3 T:1
ACADEMIC YEAR: 2014-2015
UNIT-IV
DERIVED TYPES & FILES
Objective Type Questions

C:6

1. Structures may contains a) multiple data items b)single data items c) a only d) a&b
2. The size of structure and union is same when they contain a)single member b) any number of
members c) a & b d) none
3. The operator used to find the size of any variable a) sizeof b) Sizeof c) sizeOf d) all the above
4. The operator that is used to access the members of the structure using pointer variable a) . b) -> c)*
d)none of the above
5. The operator used to access the member of the structure a) . b) -> c)* d)none of the above
6. The operator -> is same as the combination of the operators a) * and . b) & and . c) * and & d) none
of the above
7. Bitfields are used to a) save time b) save memory c) change order of allocation of memory d) none
of the above
8. Union can store _________ number of values at a time a) all its members b) only 1 b) 2 d) cannot
hold value
9. Consider on following declaring of enum.
(i)
enum cricket {Gambhir,Smith,Sehwag}c;
(ii) enum cricket {Gambhir,Smith,Sehwag};
(iii) enum {Gambhir,Smith=-5,Sehwag}c;
(iv) enum c {Gambhir,Smith,Sehwag};
Choose correct one:
(A) Only (i) is correct declaration
(B) Only (i) and (ii) is correct declaration
(C) Only (i) and (iii) are correct declaration
(D) Only (i),(ii) and are correct declaration
(E) All four are correct declaration
10. A Structure is ________________________- collection of data elements
11. A structure can be created by using _______________ keyword
12. What is output of the following
#include<stdio.h>
Void main()
{
Struct emp
{
Int id;
Char name[10];
Float sal;
}
Struct emp e1={12,ravi,5000};
a) 12 ravi 5000
b) 12 ravi 5000.000000 c) both a&b d) none
13. State True or False
a) All structure elements are stored in the contiguous memory locations
b) An array should be used to store dissimilar elements, and a structure to store similar elements

c) Both a&b
d) None
14. What is output of the following
Struct s
{
Int I;
Struct s *p;
};
Main()
{
Struct s var1,var2;
Var1.i=100;
Var2.i=200;
Var1.p=&var2;
Var2.p=$var1;
Printf(%d%d,var1.p->I,var2.p->i)
a)100 200 b) 200 100 c) both a&b d) none
15. A union is _____________________
16. A union can be created by using _______________ keyword
17. The use of the bit fields are
a) To increase program lengh
b) To decrease the program length
c) To reduce the memory
d) None of the above
18. The major difference between structure and union is
a)same no change
b)initialization
c)memory allocation
d) none of the above
19. Which of the following is keywords are used for created user defined datatyes
a)typedef & enum
b) type & num
c)usertype & defined
d) none of the above
20. What is mean by self reference structre?
a) A structure calls itself
b) A union calls itself
c) Both a & b
d) None of the above
21. Which one of the following is an application for self reference structures?
a)stack
b)linked list
c)queue
d) none of the above

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


COURSE FILE
SUBJECT CODE:
L:3 P:3 T:1
ACADEMIC YEAR: 2014-2015
UNIT-IV-B
INPUT AND OUTPUT
Objective Type Questions

C:6

1. The I/O library functions are listed the header file [ ] (A)<stdio.h> (B) <conio.h> (C) <ctype.h> (D)
None
2. Standard error stream is called [ ]
(A)error (B)stderr (C)stdio (D)None
3. If the file was not able to be opened, then the value returned by the fopen routine is [ ] (A)Null (B)
non-empty (C) empty (D)None
4. A file must first be ___________properly before it can be accessed for reading or writing.
5. Once the files are________, they stay open until you close them or end the program
6. If a file is opened in r+ mode then a)reading is possible b)writing is possible c) it will be created if it
does not exist d)appending is possible
7. If a file is opened in w+ mode then a)reading is possible b)writing is possible c) it will be created if it
does not exist d)appending is possible
8. If a file is opened in r mode then a)reading is possible b)writing is possible c) it will be created if it
does not exist d)appending is possible
9. If a file is opened in a mode then a)reading is possible b)writing is possible c) it will be created if it
does not exist d)appending is possible
10. ftell a) is a function b) gives the current file position indicator c)can be used to find the size of a file d)
none of the above
11. The fseek function a) needs 2 arguments b)makes rewind function unnecessary c)takes 3 arguments
d)none of the above
12. rewind function takes __ number of arguments a) 1 b) 2 c) 3 d)0
13. fseek(fptr,0,0) is equivalent to a) ftell b) rewind c)a & b d) none of the above
14. ferror function is used to find _________________ errors
15. The contents of the file are lost if it is opened in _______ mode
16. The contents of the file are safe if it is opened in _________ mode
17. The valid binary modes of operation are a) ab b)rb+ c) wb+ d)ab+
18. rewind function is used to a) reset the file pointer b) point it to the end of the file c) stay at current
position d)none of the above
19. feof function checks for a) file opening error b) data error c) end of file d) file closing error
20. The value returned by fopen() function when the file is not opened a) 0 b) garbage value c) NULL d)
none of the above
21. The fcloseall() function performs a) closing of all the files b) closes all the files that are opened by that
program c)closes only specified files d) none of the above
22. The function that is not used for random access to files is a)rewind b)ftell c)fseek d)fprintf

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


COURSE FILE
SUBJECT CODE:
L:3 P:3 T:1
ACADEMIC YEAR: 2014-2015
UNIT-V
SEARCHING & SORTING
Objective Type Questions

C:6

1. Divide and conquer mechanism is used in


[
]
(A)Selection sort (B)Quick sort (C) Bubble sort (D)Merge sort
2. Before searching, the list of items should be sorted in ascending order can be done in
[
]
(A) Binary searching (B) Linear searching (C) Both A&B (D)None
3. Time Complexity of Bubble sort is
[
]
2
(A) O ( n log n ) (B) O ( 1 ) (C) O ( n ) (D)None
4. Select the smallest and Exchange mechanism is used in
[
]
(A) Insertion sort (B) Bubble sort (C) Quick sort (D) selection sort
5. O(N) is of which time complexity [ ]
[ ]
(A)Quadratic (B)Linear (C)Cubic (D)Logic
6. If all the data that is to be sorted can be accommodated at a time in memory is called______ sorting.
7. Complexity of Quick Sort in the Best case is____________.
8. The time complexity of binary search in average case is
9. a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
10. The time complexity of bubble sort in best case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
11. The time complexity of selection sort in best case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
12. The time complexity of insertion sort in best case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
13. The time complexity of quick sort in best case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
14. The time complexity of heap sort in best case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
15. The time complexity of merge sort in best case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
16. The best sorting technique among the following is
a) quick b)heap c) merge d) bubble
17. In worst case quick sort behaves like
a) insertion b)heap c) selection d) bubble
18. The time complexity of bubble sort in worst case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
19. The time complexity of selection sort in worst case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
20. The time complexity of insertion sort in worst case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
21. The time complexity of quick sort in worst case is

a) O(n) b) O(n2) c) O(nlogn) d) O(logn)


22. The time complexity of heap sort in worst case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
23. The time complexity of merge sort in worst case is
a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
24. Quick sort is an application of a) partition exchange sort b) partition sort c) greedy method d)divide
and conquer
25. Merge sort is an application of a) greedy method b)divide and conquer c) a&b d) none
26. The space complexity of Quick sort in average case is a) 0 b)O(n) c) O(nlogn) d) O(logn)
27. The space complexity of bubble sort in worst case is a) 0 b)O(n) c) O(nlogn) d) O(logn)
28. Binary search is effective only when the elements are in a) ascending order b) descending order c) a& b
d) jumbled order

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


COURSE FILE

SUBJECT CODE:
L:3 P:3 T:1
ACADEMIC YEAR: 2014-2015
UNIT-V
DATA STRUCTURES
Objective Type Questions

C:6

1. Postfix notation is sometimes called as [ ] (A)Polish notation (B)reverse polish notation (C) Both
A&B (D)None
2. Postfix expression for (1+2)*7 [ ] (A)12*7+ (B)127+* (C)12+7* (D)None
3. ____________complexity is defined to be the amount of memory the computer needs to run a
program.
4. A ________________list allows traversal of the list in forward direction, but not in backward
direction.
5. A Doubly Linked List is a data structure having an ordered list of nodes, in which each node consists of
______pointers
6. A linked list does not require any extra space therefore it does not _______extra memory.
7. _________Complexity is defined to be the time the computer takes to run a program.
8. A Circular Doubly Linked List ( CDL ) is a ______________with first node linked to last node and
vice-versa.
9. The prefix equivalent for the postfix ab+cd+* is a)a+b*c+d b)+ab*+cd c)*+ab+cd d)*++abcd
10. The postfix equivalent for the prefix *++abcd is a)ab+c+d* b)abcd++* c)ab+cd+* d)ab+c*d+
11. The infix equivalent to the postfix expression abc+d-*e%f/ is a) a+b*c-d%f/f b) a*(b+c-d)%e/f
c)a*b+c-d%e/f d)a*(b-c+d)%e/f
12. Evaluate the expression 2*3/5+6-4 a) 1 b) 2 c)3 d) 4
13. The value of the prefix expression +/*2-5 6 4 3 is a) 1 b) 2 c)3 d) 4
14. The value of the postfix expression 1 4 +3 / 2 * 6 4 % - is a) 1 b)-1 c)0 d)4
15. Towers of Hanoi is an application of
a) stack b) queue c) linked list d) dequeue
16. The data structure used in railway reservation is a) stacks b) queues c)priority queues d) binary tree
17. The data structure applicable for a fully packed bus is a) stacks b) queues c)priority queues d) binary
tree
18. The recursive functions are evaluated using a) stacks b) queues c)priority queues d) binary tree
19. The nested loops are evaluated using a) stacks b) queues c)structures d) binary tree
20. The data structure used in resource sharing systems is a) stacks b) queues c)arrays d) binary tree
21. Which of the following is not a linear data structure a) stacks b) queues c)linked list d) binary tree
22. In evaluation of postfix expression the data structure used is a) stacks b) queues c)arrays d) binary tree
23. Linked list uses __________ type of memory allocation
a) static b)random c)dynamic d)compile time
24. Binary tree can be implemented using
a)arrays b) double linked list c) a& b d) b only
25. In a complete binary tree, if the parent is at nth position then the children will be at a)n+1, n+2
b)2n,2n-1 c)2n,2n+1 d)2n+1,2n-1
26. The number of non leaf nodes in a complete binary tree of height 5 is
a) 16 b)32 c) 31 d)15
27. The number of leaf nodes in a complete binary tree of height 5 is
a) 16 b)32 c) 31 d)15
28. The number of nodes in a complete binary tree of height 5 is
a) 16 b)32 c) 31 d)15
29. The number of edges in a minimum cost spanning tree of n nodes is a) n b)n+1 c)n-1 d)2n

30. Traveling sales man problem is an application of a) spanning trees b) binary tree c) greedy method
d)divide and conquer
31. The number of extra pointers required to reverse a singly linked list is a)1 b)2 c)3 d)4
32. The number of extra pointers required to reverse a double linked list is a)1 b)2 c)3 d)4
33. The functions used for memory allocation a) malloc b)calloc c)a&b d) none of the above
34. Linked lists uses __________ type of structures. a) nested structures b) self referential structures c)
simple structures d)unions
35. _________ cannot be used to represent Linked lists. a) arrays b) structures c)unions d) all the above
36. Binary trees cannot be implemented using a) arrays b)unions b)single linked list d)all the above

You might also like