WorksheetsEC8393
Total questions: 45
Worksheet time: 31mins
Which of the following is a User-defined data type?
typedef int Boolean;
typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;
struct {char name[10], int age};
all of the mentioned
The format identifier ‘%i’ is also used for _____ data type.
char
int
float
double
Which of following is not accepted in C?
static a = 10; //static as
static int func (int); //parameter as static
static static int a; //a static variable prefixed with static
all of the mentioned
When double is converted to float, then the value is?
Truncated
Rounded
Depends on the compiler
Depends on the standard
Which among the following has the highest precedence?
&
<<
sizeof()
&&
What is a preprocessor?
That processes its input data to produce output that is used as input to another program
That is nothing but a loader
That links various source files
All of the mentioned
Which of the following is an invalid assignment operator?
a %= 10;
a /= 10;
a |= 10;
None of the mentioned
Comment on the following pointer declaration.
int *ptr, p;
ptr is a pointer to integer, p is not
ptr and p, both are pointers to integer
ptr is a pointer to integer, p may or may not be
ptr and p both are not pointers to integer
What is (void*)0?
Representation of NULL pointer
Representation of void pointer
Error
None of above
A pointer is
A keyword used to create variables
A variable that stores address of an instruction
A variable that stores address of other variable
All of the above
Choose correct statements about C Language Pass By Value.
Pass By Value copies the variable value in one more memory location.
Pass By Value does not use Pointers.
Pass By Value protects your source or original variables from changes in outside functions or called functions.
All the above
A function which calls itself is called a ___ function.
Self Function
Auto Function
Recursive Function
Static Function
A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as a ?
Queue
Stack
Tree
Linked list
Circular Queue is also known as ________
Ring Buffer
Square Buffer
Rectangle Buffer
Curve Buffer
A data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is?
Queue
Circular queue
Dequeue
Priority queue
Queues serve major role in ______________
Simulation of recursion
Simulation of arbitrary linked list
Simulation of limited resource allocation
Simulation of heap sort
A queue follows
FIFO (First In First Out) principle
LIFO (Last In First Out) principle
Ordered array
Linear tree
The time complexity of converting a prefix notation to infix notation is _________
O(n) where n is the length of the equation
O(n) where n is number of operands
O(1)
O(logn) where n is length of the equation
To obtain a prefix expression, which of the tree traversals is used?
Level-order traversal
Pre-order traversal
Post-order traversal
In-order traversal
The number of elements in the adjacency matrix of a graph having 7 vertices is __________
7
14
36
49
An expression tree is a kind of?
Binary search tree
Fibonacci tree
Binary tree
Treap
Which of the following is the name of the node having child nodes?
Brother
Sister
Mother
Parent
What is the maximum number of children that a binary treenode can have?
0
1
2
3
Which of these operators have the highest order of precedence?
‘(‘ and ‘)’
‘*’ and ‘/’
‘~’ and ‘^’
‘+’ and ‘-‘
Where is linear searching used?
When the list has only a few elements
When performing a single search in anunordered list
Used all the time
When the list has only a few elements andWhen performing a single search in anunordered list
What is an external sorting algorithm?
Algorithm that uses tape or disk during thesort
Algorithm that uses main memory duringthe sort
Algorithm that involves swapping
Algorithm that are considered ‘in place’
Which of the following sorting algorithms is the fastest?
Merge sort
Quick sort
Insertion sort
Shell sort
What is a hash table?
A structure that maps values to keys
A structure that maps keys to values
A structure used for storage
A structure used to implement stack and queue
What is a hash function?
A function has allocated memory to keys
A function that computes the location of the key in the array
A function that creates an array
A function that computes the location of the values in the array
Which of the following is not an application of stack?
evaluation of post
conversion of infix to postfix expression
balancing symbols
line at ticket counter
What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
3. {
4. enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};
5. printf("PEACH = %d\n", PEACH);
6. }
PEACH = 3
PEACH = 4
PEACH = 5
PEACH = 6
What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
3. {
4. int a = 1, b = 1;
5. switch (a)
6. {
7. case a*b:
8. printf("yes ");
9. case a-b:
10. printf("no\n");
11. break;
12. }
13. }
yes
no
compile time error
yes no
1. #include <stdio.h>
2. int main()
3. {
4. printf("C programming %s", "Class by\n%s Sanfoundry", "WOW");
5. }
C programming Class by WOW Sanfoundry
C programming Class by\n%s Sanfoundry
C programming Class by %s Sanfoundry
Compilation error
Can you combine the following two statements into one?
char *p;
p = (char*) malloc(100);
char p = *malloc(100);
char *p = (char) malloc(100);
char *p = (char*)malloc(100);
char *p = (char *)(malloc*)(100);
What is the output of a C program with functions.?
void show();
void main()
{
show();
printf("RAINBOW ");
return;
}
void show()
{
printf("COLOURS ");
}
RAINBOW COLOURS
COLOURS RAINBOW
COLOURS
Compiler error
What is the output of C Program with functions.?
int main()
{
int a=20;
printf("CINEMA ");
return 1;
printf("DINOSAUR");
return 1;
}
CINEMA DINOSAUR
CINEMA
DINOSAUR
Compiler error
What would be the Prefix notation for the given equation?
A+(B*C)
+A*CB
*B+AC
+A*BC
*A+CB
What would be the solution to the given prefix notation?
+ 9 * 3 / 8 4
14
15
18
12
What would be the Prefix notation for the given equation?
(A*B)+(C*D)
+*AB*CD
*+AB*CD
**AB+CD
+*BA*CD
The average depth of a binary tree is given as?
O(N)
O(log N)
O(M log N)
O(√N)
An expression tree’s nodes can be deleted by calling?
malloc
calloc
delete
free
What is the maximum number of possible non zero values in an adjacency matrix of a simple graph with n vertices?
(n*(n-1))/2
(n*(n+1))/2
n*(n-1)
n*(n+1)
What does the following piece of code do?
public voidfunc(Tree root)
{
func(root.left());
func(root.right());
System.out.println(root.data());
}
Preorder traversal
Inorder traversal
Postorder traversal
Level order traversal
Which of the following is not a collision resolution strategyfor open addressing?
Linear probing
Quadratic probing
Double hashing
Rehashing
What is the worst case complexity of bubble sort?
O(nlogn)
O(logn)
O(n)
O(n2)
