Explore topic-wise MCQs in Computer Science Engineering (CSE).

This section includes 36 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science Engineering (CSE) knowledge and support exam preparation. Choose a topic below to get started.

1.

What will be output if you will compile and execute the following c code? #includeint main(){double far* p,q;printf("%d",sizeof(p)+sizeof q); return 0; }

A. 12
B. 8
C. 4
D. 1
Answer» B. 8
2.

What will be output if you will compile and execute the following c code? #includeint main(){printf("%d",sizeof(5.2)); return 0;}

A. 2
B. 4
C. 8
D. 10
Answer» D. 10
3.

Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time?i) Insertion at the front of the linked listii) Insertion at the end of the linked listiii) Deletion of the front node of the linked listiv) Deletion of the last node of the linked list

A. i and ii
B. i and iii
C. i,ii and iii
D. i,ii and iv
Answer» C. i,ii and iii
4.

Consider an implementation of unsorted doubly linked list. Suppose it has its representation with a head pointer and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time?i) Insertion at the front of the linked listii) Insertion at the end of the linked listiii) Deletion of the front node of the linked listiv) Deletion of the end node of the linked list

A. i and ii
B. i and iii
C. i,ii and iii
D. i,ii,iii and iv
Answer» E.
5.

What will be output if you will compile and execute the following c code? #include int main(){int array[]={10,20,30,40};printf("%d",-2[array]); return 0;}

A. -60
B. -30
C. 60
D. garbage value
Answer» C. 60
6.

Consider the following definition in c programming languagestruct node{int data;struct node * next;}typedef struct node NODE;NODE *ptr;Which of the following c code is used to create new node?

A. ptr=(node*)malloc(sizeof(node));
B. ptr=(node*)malloc(node);
C. ptr=(node*)malloc(sizeof(node*));
D. ptr=(node)malloc(sizeof(node));
Answer» B. ptr=(node*)malloc(node);
7.

The memory address of fifth element of an array can be calculated by the formula

A. LOC(Array[5])=Base(Array[5])+(5-lower boun(D), where w is the number of words per memory cell for the array
B. LOC(Array[5])=Base(Array[4])+(5-Upper boun(D), where w is the number of words per memory cell for the array
C. LOC(Array[5]=Base(Array)+w(5-lower bou
D. , where w is the number of words per memory cell for the array
Answer» D. , where w is the number of words per memory cell for the array
8.

Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called

A. Elementary items
B. Atoms
C. Scalars
D. All of above
Answer» E.
9.

consider the function f defined here:struct item{int data;struct item * next;};int f (struct item *p){return((p==NULL) ||((p->next==NULL)||(p->data<=p->next->data) && (p->next)));}For a given linked list p, the function f returns 1 if and only if

A. the list is empty or has exactly one element
B. the element in the list are sorted in non-decreasing order of data value
C. the element in the list are sorted in non-increasing order of data value
D. not all element in the list have the same data value
Answer» C. the element in the list are sorted in non-increasing order of data value
10.

Each array declaration need not give, implicitly or explicitly, the information about the

A. name of array
B. data type of array
C. first data from the set to be stored
D. index set of the array
Answer» D. index set of the array
11.

What is error in following declaration?struct outer{ int a;struct inner{char c;};};

A. nesting of structure is not allowed in c
B. it is necessary to initialize the member variable
C. inner structure must have name
D. outer structure must have name
Answer» D. outer structure must have name
12.

What will be output if you will compile and execute the following c code? #includeint main(){int i=320;char *ptr=(char *)&i;printf("%d",*ptr); return 0;}

A. 320
B. 1
C. 64
D. none of the above
Answer» D. none of the above
13.

When in order traversing a tree resulted E A C K F H D B G; the preorder traversal would return

A. FAEKCDBHG
B. FAEKCDHGB
C. EAFKHDCBG
D. FEAKDCHBG
Answer» C. EAFKHDCBG
14.

What will be output if you will compile and execute the following c code?#include #include int main(){char *str=NULL;strcpy(str,"cquestionbank");printf("%s",str); return 0;}

A. cquestionbank
B. cquestionbank 0
C. (null)
D. it will print nothing
Answer» D. it will print nothing
15.

In a binary tree, certain null entries are re- placed by special pointers which point to nodes higher in tree for efficiency. These special pointers are called

A. Leaf
B. Branch
C. Path
D. Thread
Answer» E.
16.

What will be output if you will compile and execute the following c code?#include #include int main(){char c=' 08';printf("%d",c); return 0;}

A. 8
B. 8
C. 9
D. compiler error
Answer» E.
17.

What will be output if you will compile and execute the following c code? #includeint * call();int main(){ int *ptr;ptr=call();printf("%d",*ptr); return 0;} int * call(){int a=25;a++;return &a;}

A. 25
B. 26
C. any adress
D. garbage value
Answer» E.
18.

What will be output if you will compile and execute the following c code? #includeint main(){char c=125;c=c+10;printf("%d",c); return 0;}

A. 135
B. +inf
C. -121
D. -8
Answer» D. -8
19.

What will be output if you will compile and execute the following c code? #include#define max 5;int main(){int i=0;i=max++;printf("%d",i++); return 0;}

A. 5
B. 6
C. 7
D. 0
Answer» E.
20.

#include #include int main(){int i=0;for(;i<=2;)printf(" %d",++i); return 0;}

A. 0 1 2 3
B. 0 1 2
C. 1 2 3
D. compiler error
Answer» D. compiler error
21.

What will be output if you will compile and execute the following c code? #include int main(){float a=5.2;if(a==5.2)printf("Equal");else if(a<5.2)printf("Less than");elseprintf("Greater than"); return 0;}

A. equal
B. less than
C. greater than
D. compiler error
Answer» C. greater than
22.

What will be output if you will compile and execute the following c code? #includeint main(){int x;for(x=1;x<=5;x++);printf("%d",x); return 0;}

A. 4
B. 5
C. 6
D. compiler error
Answer» D. compiler error
23.

What will be output if you will compile and execute the following c code? #includeint main(){int a=10;printf("%d %d %d",a,a++,++a); return 0;}

A. 12 11 11
B. 12 10 10
C. 11 11 12
D. 10 10 12
Answer» B. 12 10 10
24.

What will be output if you will compile and execute the following c code? #includeint main(){char *str="Hello world";printf("%d",printf("%s",str)); return 0;}

A. 10hello world
B. 11hello world
C. hello world12
D. hello world13
Answer» E.
25.

What will be output if you will compile and execute the following c code? #includeint main(){int a=2;if(a==2){a=~a+2<<1;printf("%d",a);}else{break;} return 0;}

A. it will print nothing
B. -3
C. -2
D. compiler error
Answer» E.
26.

What will be output if you will compile and execute the following c code? #include#define x 5+2int main(){int i;i=x*x*x;printf("%d",i); return 0;}

A. 343
B. 27
C. 133
D. compiler error
Answer» C. 133
27.

What will be output if you will compile and execute the following c code? #include#define call(x,y) x##yint main(){int x=5,y=10,xy=20;printf("%d",xy+call(x,y)); return 0;}

A. 35
B. 510
C. 15
D. 40
Answer» E.
28.

What will be output if you will compile and execute the following c code? #includeint main(){int i=10;static int x=i;if(x==i)printf("Equal");else if(x>i)printf("Greater than");elseprintf("Less than"); return 0;}

A. equal
B. less than
C. greater than
D. compiler error
Answer» E.
29.

What will be output if you will compile and execute the following c code? #includeint main(){int i=4,x;x=++i + ++i + ++i;printf("%d",x); return 0;}

A. 21
B. 18
C. 12
D. compiler error
Answer» B. 18
30.

What will be the output of the program? #includeint main(){int X=40;{int X=20;printf("%d ", X);}printf("%d n", X);return 0;}

A. 40 40
B. 20 20
C. 20
D. error
Answer» E.
31.

The program fragmentint i = 263 ;putchar (i) ;prints

A. 263
B. ascii equivalent of 263
C. rings the bell
D. garbage
Answer» D. garbage
32.

What will be the output of the program? #includeint i;int fun();int main(){while(i){fun();main();}printf("Hello n");return 0;}int fun(){printf("Hi");}

A. hello
B. hi hello
C. no output
D. infinite loop
Answer» B. hi hello
33.

How many times the program will print "Amrutvahini" ? #includeint main(){printf("Amrutvahini");main();return 0;}

A. infinite times
B. 32767 times
C. 65535 times
D. till stack overflows
Answer» E.
34.

Which of the following is not a limitation of binary search algorithm ?

A. binary search algorithm is not efficient when the data elements are more than 1000.
B. must use a sorted array
C. requirement of sorted array is expen- sive when a lot of insertion and dele- tions are needed
D. there must be a mechanism to access middle element directly
Answer» B. must use a sorted array
35.

The complexity of the average case of an algorithm is

A. Much more complicated to analyze than that of worst case
B. Much more simpler to analyze than that of worst case
C. Sometimes more complicated and some other times simpler than that of worst case
D. None of the above
Answer» B. Much more simpler to analyze than that of worst case
36.

Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time?i) Insertion at the front of the linked listii) Insertion at the end of the linked listiii) Deletion of the front node of the linked listiv) Deletion of the last node of the linked lis

A. i and ii
B. i and iii
C. i,ii and iii
D. i,ii and iv
Answer» D. i,ii and iv