KEMBAR78
Global Edge Paper Pattern | PDF | C (Programming Language) | Computer Hardware
0% found this document useful (0 votes)
160 views16 pages

Global Edge Paper Pattern

The document contains 16 multiple choice questions related to C programming and operating systems concepts. The questions cover topics like data types, operators, loops, functions, pointers, arrays, structures, file handling, preprocessor directives, networking, scheduling algorithms and synchronization. Sample questions include the output of code snippets, purpose of protocols like UDP, techniques to avoid race conditions and characteristics of real-time operating systems.
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)
160 views16 pages

Global Edge Paper Pattern

The document contains 16 multiple choice questions related to C programming and operating systems concepts. The questions cover topics like data types, operators, loops, functions, pointers, arrays, structures, file handling, preprocessor directives, networking, scheduling algorithms and synchronization. Sample questions include the output of code snippets, purpose of protocols like UDP, techniques to avoid race conditions and characteristics of real-time operating systems.
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/ 16

Global Edge Paper Pattern

1. main()
{ int arr[]={ 1,2,3,4 };
int *ptr ;;;;
ptr++ = arr;
printf("%d,%d",ptr[2],arr[2]);
return 0;
}
what is the output :

a. compile time error :multiple termination statements for pointer


b. lvalue required for ptr
c. prints 3 3
d. printd 4 3

ans b: lvalue required for ptr;

2. main()
{
char s[10];
scanf ("%s",s);
printf(s);
}
what is the output if input is abcd :

a. prints abcd
b. compiler error
c. prints abcd and 6 junk characters
d. printd s

ans a: prints abcd.

3. main()
{
char c = 255;
printf ("%d",c);
return 0;
}
what is the output

a. illegal character assignment


b. prints -1
c. prints 2
d. prints 255
ans b: prints -1.

4.
main()
{
int i;
for (i=7;i<=0;i--)
printf ("hello
");
}

what is the output

a. prints hello 7 times


b. prints hello 8 times
c. prints hello once
d. prints nothing

ans b: prints nothing.

5. main()
{
printf( printf ("world") );
}

a. prints world
b. prints printf ("world")
c. prints nothing
d. compiler error

ans d: compiler error.

Computer Concepts

1. A c source code file can be

a. compiled only
b. interpreted only
c. both compiled and interpreted
d. nothing

ans c : both compiled and interpreted

2. c programming approach is

a. Top down
b. bottom up
c. both topdown and bottom up
d. none of the above

ans a:top down approach

3. The access time is less for

a. hard disk
b. cache
c. registers
d. main memory

ans c:registers

4.resolving of external variables in a program is done at

a.complie time
b.run time
c.link time
4.load time

ans c: link time.

5. interrupts inform process about

a. events external to process asynchronously


b. events external to process synchronously
c. both a and b
d. events internal to a process

ans a: events external to process asynchronously

/* C question and answers

All questions are tested in Turbo C compiler and have not been tested in gcc or (linux platform) */

1)
#include
main()
{
scanf("%d");
printf();
}
which of the following is correct?
a)compilation error
b)Run time error
c)No output
d)depends on the compiler

ans : a

2)
#include
#define islower(c) ( a <=(c) && (c)<= z )
#define toupper(c) (islower(c)?(c)-( a - A ):(c))

main()
{
char *p="i am fine";
while(*p)
printf("%c",toupper(*p++));
}
a)bcd
b)AFE
c)aFe
d)BCd

ans : b ( macro substitution 3 times)

3)
#include
main()
{
200;
printf("tricky problem");
}
a)warning message
b)compilation error
c)run time error
d)none of these

ans : a

4)which is the null statement?


a) ;
b) {}
c) ;
d)all of these

ans : a
5)what is the correct prototype of printf function ?
a)printf(char *p,...);
b)printf(const *char *p,...);
c)printf(const char *p,...);
d)printf(const *char p,...);

ans : c

/* questions on computer concepts */

1)which of the following is not a system file?


a).sys
b).com
c).ini
d)none

ans : d

2)A magnetic tape is equivalent to which of the following structure?


a)Graphs
b)trees
c)Lists
d)Dictionaries

ans : c

3)For a linked list implementation which searching technique is not applicable?


a)linear search
b)none
c)quick sort
d)binary search

ans : d

4)Encryption and decryption is done in which layer?


a)DLL
b)Network layer
c)transport layer
d)presentation layer

ans : d

5)which of the following is not performed by the OS?


a)cpu shceduling
b)memory management
c)Transaction
d)none

ans : c Global Edge Sample Paper

1. What is the output of the following code ?


int main( )
{
for( ; ;);
printf("Hello
");
return 0;
}

a. give compilation error


b. prints Hello infinite times
c. Runs in an infinite loop without printing anything.
d. prints Hello once.

Ans: c

2. Output of the code?


FUNC (int *p)
{
p = (int *)malloc(100);
printf("p:%x",p);
}

int main( )
{
int *ptr;
FUNC(ptr);
printf("Ptr:%x",ptr);
return 0;
}

a. Both printf statements prints same values.


b. Both print different values.
c. Gives compile time error.
d. Gives run time error.

Ans: b
3. Output of the code?
int main()
{
char a[] = "world";
printf("%d %d
",strlen(a),sizeof(a));
return 0;
}

a. 5,5
b. 6,5
c. 5,6
d. 6,6

Ans: c

4. What is the output generated?

main()
{
char *s = "Hello";
printf("%s",1(s));
}

a. Hello
b. ello
c. e
d. none of these.

Ans: b

5. Interpret the given declaration

char ( * ( f ( ) ) [ ] )( )

a. f is a pointer to function returning char


b. f is a pointer to an array of function returning a char
c. Invalid declaration
d. f is a function returning pointer to array[] of pointer to function returning char.

Ans : d

1. A binary tree of height h, h > 0 has

a. at least h and atmost 2*h-1 elements in it.


b. at least 2^h and atmost (2^h)+1 elementz in it.
c. at least 2^h -1 and atmost h^2 elements in it.
d. at least h and atmost (2^h) - 1 elements in it.

Ans: d

2. Thrashing is

a. flooding of pages in the memory.


b. increase in removal of pages from memory.
c. increase in page faults leading to decrease in CPU utilization.
d. removal of unused pages from memory making space for new ones.

Ans: c

3. Recursive Descent parser is a type of

a. Bottom up parser.
b. Top Down parser.
c. None of these.
d. Bottom down parser.

Ans: b

4. alloca() allocates memory from

a. Heap.
b. Reserved memory.
c. Data segment.
d. Stack.

Ans: d

5. What is the octal equivalent of decimal (5468).

a. 12360.
b. 12560.
c. None of these.
d. 12650.

Ans : c

Global Edge Sample Paper

1. main()
{ int i;
i=(2,3);
printf("%d",i);
}

a)2 b)3 c)Compiler error d)Syntax error.

ans : 3

2. main(){
char str[]="GESL";
printf("%d %d",sizeof(str),strlen(str));
}

a)5,5 b)4,4 c)5,4 d)4,5


ans: 5, 4

3. main(){ for(i=0;i++;i<100) printf("hello world


"); }

a)100 times
b)0 times
c)Infinite loop
d)None of the above.

ans: 0 times.

4. main(){ for(i=1;i++;i<100) printf("hello world


"); }

a)100 times b)0 times c)Infinite loop d)None of the above.

ans: infinite loop

5. main(){ char c; scanf("%s",c); }

a) Compiler dependent
b) unpredictable
c) Compiler error
d) scans the i/p.

ans: Compiler dependent.

6. main(){
int k=5;
for(++k<5 && k++/5 || ++k<8);
printf("%d
",k);
}
a)5
b)6
c)7
d)8

ans: 7

7. main(){
int *ptr1,*ptr2;
ptr1=(int *)malloc(sizeof(int));
ptr2=func(20,10,ptr1);
printf("%d %d
",*ptr1,*ptr2);
}

int *func(int a, int b, int *c)


{
int x=a+b;
*c=a-b;
return(&x);
}

a) Bug in the code.


b) No Bugs prints correctly
c) Error
d) None of the above.

Ans: Bug in the code.

8). int main() {


int i = 10, j ;
if ( ( j = ~i ) < i )
printf ( "True" ) ;
else
printf ( "False" ) ;
}

a) True
b) False
c) Compiler Dependent
d) None of the above.
ans : True

9. How many bytes are required to create a 3*3 matrix using double pointer
ans: 12

10. take int=4,float=8,char=1


main() {
FILE *fp;
printf("%d
",sizeof(fp) );
}

a)2
b)4
c)Compiler dependent
d)Error

Ans:4

11. main()
{
int a=10,20;
a^=b^=a^=b;
printf("%d
%d
",a,b);

a) a=20,b=10
b) a=10,b=20
c) Syntax error
d) Unpredictable

Ans : a=20 b=10

12. main() {

int i=10;

switch(i) {
case 10: printf("Hello "); {
case 1 : printf("World ");
}
case 5: printf("Hello World ");
}
}

a) Hello
b) Hello
c) Hello World Hello World
d) Syntax Error.

Ans : Hello World Hello World

13. main() {
char str1[]="Hello";
char str2[]="Hello";
if ( str1==str2 )
printf("True
");
else
printf("False
");
}
Ans: False.

a)True
b)False
c)Error
d) Unpredictable.

15. main()
{
# include
int i = 10 ;
printf("%d
", i/2 );

}
a)10
b)5
c)error
d) warning.

ans : 5

16. #include
# pragma pack(2)

struct SIZE {
int i;
char ch ;
double db ;
};
main () {
printf ( "%d
",sizeof(struct SIZE) );
}
a)12
b)14
c)16
d)8
Global Edge Placement Paper

1) what is big-endian.
a) MSB at lower address LSB at higher address
b) LSB at lower address MSB at higher address
c) memory mgmt technique
d) none of the above
Ans:a

2)what is Little-endian.
a) MSB at lower address LSB at higher address
b) LSB at lower address MSB at higher address
c) memory mgmt technique
d) none of the above
Ans:b

3)8086 has
a)16 bit data bus ,16 bit address bus
b)16 bit data bus,32 bit address bus
c)8 bit data bus,16 bit address bus
d)8 bit data bus,8 bit address bus
Ans:a

4) what is the scheduling algorithm used in general operating systems.


a) FCFS algorithm
b) Highest Priority First algorithm
c) Round-Robin algorithm
d) None of the above
Ans:c

5)Router is present at
a)Physical layer
b)Data Link Layer
c)Network Layer
d)None of above
Ans:c

6)Condition for deadlock occurance


a) Mutual Exclusion
b) no premption
c) hold and wait
d) circular wait
e) all of the above
Ans:d

7)PCI stands for


a)Programmable computer Interface
b)Peripheral Computer Interface
c)programmable Control Interface
d)Peripheral Component Interface
Ans:d

8)Toggle state in J-K flip-flop is


a)0 1
b)1 0
c)1 1
d)0 0
Ans :c

9)Interrupt is serviced
a)Immediatly when it occurs
b)After the completion of current instruction.
c)Ignored
d)None of the above.
Ans:b

C Questions :

1.what is the o/p ?

void main()
{
char *mess[]={"Have","a","nice","day","Bye");
printf("%d %d",sizeof(mess),sizeof(mess[1]));
}
a. 16 4
b. 5 4
c. 20 4
d. Error
Answer: c
2.what is the o/p of the following programe?
void main()
{
int i,count=0;
char *p1="abcdefghij";
char *p2="alcmenfoip";

for(i=0;i<=strlen(p1);i++) {
if(*p1++ == *p2++)
count+=5;
else
count-=3;
}
printf("count=%d
",count);
}

a. 15
b. 6
c. 12
d. compiler error
Answer: b ( note : strlen(p1) == i when i=6)

3.what does main return on successful execution?


a. 1
b. 0
c. -1
d.Nonzero
Answer : b

4.
main(int argc,char *argv[])
{
printf((argc > 1 ? "%c" : "%c",*++argv);
}
If the i/p string is "GESL Bangalore".
a. G
b. E
c. B
d. GESL
Answer: c

5. How do u declare a pointer to an array of pointers to int?


a. int *a[5];
b. int **a[5];
c. int *(*a)[5];
d. u con not declare
Answer: c

Questions on OS:

1.UDP is a
a. Reliable protocol
b. Unreliable protocol
c. Connectionless protocol
d. Both b & c
Answer: d

2.Real Time OS uses


a. RISC processor
b. CISC processor
c. SISC processor
d. Any of the above
Answer: a

3.Race condition could be overcome using


a. A global variable
b. A local variable
c. Mutex
d. All of the above

4.Repeaters are in
a. Data link layer
b. Physical layer
c. Network layer
d. Transport layer
Answer: b

5.Telecom Networking uses


a. Packet switching
b. Circuit switching
c. Message switching
d. Non of the above

Ans : b ( normally )

You might also like