CP Bits
CP Bits
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
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
c) object-oriented
d) spiral
b) flowchart
c) Multichart d) none
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
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 __________
d) none
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)strcmp()
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
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
C:6
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