#include <stdio.h>
int f(int *a, int n)
{
if(n <= 0) return 0;
else if(*a % 2 == 0) return *a + f(a+1, n-1);
else return *a - f(a+1, n-1);
}
int main()
{
int a[] = {12, 7, 13, 4, 11, 6};
printf("%d", f(a, 6));
getchar();
return 0;
}
ans sunbeam mcq 15
int main()
{
float farr[] = {1.1,2.2,3.3,4.4,5.5};
float *fp = farr+4;
int x ;
printf("%.2f",fp[-(x=sizeof(5.5)-6)]);
return 0;
}
ANs sunbeam mcq = 3.30
int main()
{
typedef enum {O1=2 >= 5 != 4 ,O2= !(2 < 5 != 4)} OPR;
OPR choice=0;
do
{
switch(choice)
{
case O1:
--choice;
printf("%2d",choice); break;
case O2:
printf("%2d",choice); break;
}
break;
} while (++choice);
return 0;
}
sunbeam mcq ans =0
int fun_test(int a,int b)
{
a= !a;
b = ~b;
return a,b;
}
int main()
{
int a=4,b=5;
a,b = fun_test(!a,~b);
printf("%d %d",a,b);
return 0;
}
sunbeam mcq ans = 4 5
#include<stdio.h>
typedef struct employee
{
int id;
char dept[10];
struct employee *emplist;
}EMP;
int main()
{
EMP e1={101,"ADMN",NULL};
EMP e2={102,"MRKT",NULL};
EMP e3={103,"TCT",NULL};
EMP e4={104,"SAN",NULL};
e1.emplist = &e2 ;
e2.emplist = &e3;
e3.emplist = &e4;
printf("%d",e1.emplist->emplist->emplist->id);
return 0;
}
sunbeam mcq ans = 104
int main()
{
int d;
d = printf("Sunbeam") == printf("\rSunBeam") ;
printf("%2d",d);
return 0;
}
sunbeam mcq ans = SunBeam 0
25#include<iostream>
using namespace std;
class C1 {
public:
void print() { cout <<"\n Inside C1"; }
};
class C2 : public C1 {
public:
void print() { cout <<"\n Inside C2"; }
};
class C3: public C2 { };
int main(void)
{
C3 c;
c.print();
return 0;
}
sunbeam mcq ans = Inside C2
2. PreProcessor replaces EXIT_SUCCESS symbol with --------
Answers
sunbeam mcq ans = 0
11. What is true about FILE *fp
Answers
sunbeam mcq ans = FILE is structure and fp is poninter to that structure of FILE type
12. What should be the output of the following code?
if file contents following data in rivers.txt
Neera Indrayani Venna Koyna
#include <stdio.h>
int main( void )
{
FILE *fp=NULL;
char c[1024];
fp = fopen("rivers.txt", "r");
fseek(fp, 0, SEEK_END);
fseek(fp, -9L, SEEK_CUR);
fgets(c, 5, fp);
puts(c);
return 0;
}
Answers
1. na k
2. na
3. a k
4. nna
sunbeam mcq ans =4
13. #include <stdio.h>
int main()
{
int a = 10;
int *p = &a;
printf("%u\n", *&*&p);
return 0;
}
Consider the address of 'a' variable is 3416378588
and address of 'p' pointer is 3416378592
Answers
1. 10
2. 3416378592
3. 3416378588
4. Compile time Error
sunbeam mcq ans = 3
Find the output of the following:
#include<stdio.h>
int main()
{
FILE *fp = fopen("abc.txt","w+");
int a,b,c;
fprintf(fp,"%d %d %d",10,20,30);
rewind(fp);
printf("%d",fscanf(fp,"%d %d %d",&a,&b,&c));
fclose(fp);
return 0;
}
Answers
1. 10 20 30
2. 3 +++
3. 1
4. -1
sunbeam mcq ans =2
15. #include <stdio.h>
int main()
{
int done = 0, i = 0, x = 25;
while(i < 10 && !done )
{
if((x /= 2) > 1)
{
i++;
continue;
}
done++;
}
printf("x = %d\n",x);
return 0;
}
Answers
1. 0
2. 1
3. 12
4. 25
sunbeam mcq ans = 2
16. Complete graph contains _____ no. of edges, if it contains "V" no. of vertices.
Answers
1. (V*(V+1))/2
2. (V*(V-1))/2
3. V
4. (V-1)
sunbeam mcq ans = 2
17. A data structure where elements can be added or removed at either end but not in the middle
Answers
1. Linked lists
2. Stacks
3. Queues
4. Deque
sunbeam mcq ans = 4
18. Quick sort is also known as ……..
Answers
1. merge sort
2. tree sort
3. shell sort
4. partition and exchange sort
sunbeam mcq ans =4
. The no of external nodes in a full binary tree with n internal nodes is?
Answers
1. n
2. n+1
3. 2n
4. 2n + 1
sunbeam mcq ans = 2
Which type of traversal of binary search tree outputs the value in sorted order?
1. Pre-order
2. Post-order
3. In-order
4. none of above
sunbeam mcq ans = 3
21. What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm?
1. LinkList
2. Stack
3. Queue
4. Tree
sunbeam MCQ ANS = 2
. The worst case occur in quick sort when
1. Pivot is the middle most element of an array and this happens when input array is sorted or reverse sorted
2. Pivot is the left-most element and this happens when the input array is sorted or reverse sorted
3. Pivot is the right most element and This happens when input array is sorted or reverse sorted
4. both B and C
sunbeam MCQ ANS = 4
23. Where we should declare a function as a friend to a class?
1. in the header of the friend function outside the class
2. inside the class declaration to which it is a friend
3. as a separate declaration inside main()
4. anywhere prior to the function invocation
sunbeam MCQ ANS = 2
24. ___________ is passed as a hidden argument to all nonstatic member function of class.
1. virtual pointer
2. static pointer
3. this pointer
4. function pointer
sunbeam MCQ ANS = 3
___________________ are used in object-oriented languages that set the accessibility of data members and methods.
Answers
1. Accessor
2. Access specifiers
3. Public
4. Templates
sunbeam MCQ ANS = 2
27. Class without name is called as _________.
Answers
1. Unknown class
2. Anonymous class
3. Empty class
4. Exception class
sunbeam MCQ ANS = 2
28. ________member function can be called without creating any object.
Answers
1. const
2. empty
3. static
4. virtual
sunbeam MCQ ANS = 3
29. An abstract base class is, that have _____________________.
1. One or more pure virtual member functions
2. One or more child classes
3. One or more static functions
4. One or more virtual member functions
sunbeam MCQ ANS = 1
30. Polymorphism means
1. Only one form
2. Hiding data
3. Many forms
4. Concrete forms
sunbeam MCQ ANS = 3
31. If a base class is inherited in protected mode then which one of following is true?
1. Public and Protected members of base class becomes protected members of derived class
2. Only protected members become protected members of derived class
3. Private, Protected and Public all members of base, become private of derived class
4. Only private members of base, become private of derived class
sunbeam MCQ ANS = 1
32. What is the size of IP Address?
1. 16 bits
2. 32 bits
3. 48 bits
4. 64 bits
sunbeam MCQ ANS = 2
33. Disk Cache is present _____.
1. Into the Main memory
2. Onto the Motherboard
3. Onto the System Bus
4. Into the External disk drive
sunbeam MCQ ANS = 1
34. A _____ is a device that forwards packets between networks by processing the routing information included in the packet.
1. Bridge
2. Router
3. Firewall
4. All of the mentioned
sunbeam MCQ ANS = 1
36. Which of the following components is not a part of the Modern CPU's?
1. CPU Registers
2. Cache Memory
3. Main Memory
4. None of the above
sunbeam MCQ ANS = 3
37. Cache Memory is used
1. To reduce speed mismatch between the CPU and Hard Disk Drive
2. To reduce speed mismatch between the CPU and Main memory
3. For execution of a programs
4. For permanent storage
sunbeam MCQ ANS = 2
38. Arrangement of computer network nodes and connection between them is called
Answers
1. Network Topology
2. Network Layout
3. both A and B
4. Network Link
sunbeam MCQ ANS = 1
39. What is the full form of SCSI?
1. Standard Computer Systems Interface
2. Small Computer Systems Interface
3. Super Computer Systems Interface
4. Small Computer Standard Interface
sunbeam MCQ ANS = 2
40. A set of rules that governs data communication
1. Protocols
2. Standards
3. RFCs
4. None of the mentioned
sunbeam MCQ ANS = 1
What is the term for a temporary storage area that compensates for differences in data rate and data flow between devices?
1. Buffer
2. Bus
3. Channel
4. Modem
sunbeam MCQ ANS = 1
42. Semaphore is a/an _____________ to solve the critical section problem.
1. Hardware of the system
2. Special Program of the system
3. Integer Variable
4. None of the mentioned
sunbeam MCQ ANS = 3
43. Which of the following is not a filesystem of Windows?
1. FAT
2. NTFS
3. HFS
4. None of the above
sunbeam MCQ ANS = 3
44. Memory Compaction involves
1. Removing of memory
2. No relocation
3. Static Relocation
4. Dynamic Relocation
sunbeam MCQ ANS = 4
45. In which of the following IO technique/s CPU utilization is maximum?
Answers
1. Program-Driven IO
2. Interrupt IO
3. DMA
4. All of the above
sunbeam MCQ ANS = 3
46. In _____ IPC mechanism at a time one process can send message to another process.
Answers
1. message queue
2. pipe 3. socket
4. all of the above
sunbeam MCQ ANS = 2
47. Which of the following CPU Scheduling Algorithm/s is/are free from starvation?
Answers
1. SJF
2. Priority
3. Round Robin
4. All of the above
sunbeam MCQ ANS = 3
48. _____ contains information to control disk operations.
Answers
1. Boot Block
2. Super Block
3. iNode List Block
4. All of the above
sunbeam MCQ ANS = 2
49. The heads of the magnetic disk are attached to a ____________ that moves all the heads as a unit.
1. Disk Arm
2. Spindle
3. Track
4. None of the mentioned
sunbeam MCQ ANS = 1
50. In Thrashing
1. Process is spending less time on paging than executing
2. Process is spending more time on paging than executing
3. Page Fault Occurs
4. Swapping can not take place
sunbeam MCQ ANS = 2
0 Comments