0% found this document useful (0 votes)
489 views5 pages

EnggRoom - Placement - HCL Campus Placement

This document contains a technical paper from HCL's campus placement in Gurgaon, 2009. It consists of 15 multiple choice questions related to C programming concepts like data types, operators, functions, pointers, structures, unions, and memory allocation. The questions cover topics like context switching, terminal emulation, clock cycles, memory addressing, semaphores, unions, function pointers, string manipulation, macros, dynamic memory allocation and more.
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)
489 views5 pages

EnggRoom - Placement - HCL Campus Placement

This document contains a technical paper from HCL's campus placement in Gurgaon, 2009. It consists of 15 multiple choice questions related to C programming concepts like data types, operators, functions, pointers, structures, unions, and memory allocation. The questions cover topics like context switching, terminal emulation, clock cycles, memory addressing, semaphores, unions, function pointers, string manipulation, macros, dynamic memory allocation and more.
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/ 5

HCL Campus Placement, Technical Paper, Gurgaon, 2009

Posted on AFW Team on June 28, 2010 // Leave Your Comment

HCL Campus Placement

Technical Paper

Gurgaon, 2009

1. Which of the following involves context switch,


(a) system call
(b) priviliged instruction
(c) floating poitnt exception (d) all the above
(e) none of the above

Ans: (a)

2. In OST, terminal emulation is done in


(a) sessions layer
(b) application layer
(c) presentation layer
(d) transport layer

Ans: (b)

3. For a 25MHz processor , what is the time taken by the instruction which needs 3 clock
cycles,
(a)120 nano secs
(b)120 micro secs
(c)75 nano secs
(d)75 micro secs

4. For 1 MB memory, the number of address lines required,


(a)11
(b)16
(c)22
(d) 24

Ans. (b)

5. Semaphore is used for


(a) synchronization
(b) dead-lock avoidence
(c) box
(d) none
Ans. (a)
6.

union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l;
}st;
int i;
}u;

main()
{
u.i = 100;
printf(“%d, %d, %d”,u.i, u.st.i, u.st.l);
}

a. 4, 4, 0
b. 0, 0, 0
c. 100, 4, 0
d. 40, 4, 0

Ans: c) 100, 4, 0

7.
union u
{
union u
{
int i;
int j;
}a[10];
int b[10];
}u;

main()
{
printf(“\n%d”, sizeof(u));
printf(” %d”, sizeof(u.a));
// printf(“%d”, sizeof(u.a[4].i));
}
a. 4, 4, 4
b. 40, 4, 4
c. 1, 100, 1
d. 40 400 4
Ans: 20, 200, error for 3rd printf

8.
main()
{
int (*functable[2])(char *format, …) ={printf, scanf};
int i = 100;

(*functable[0])(“%d”, i);
(*functable[1])(“%d”, i);
(*functable[1])(“%d”, i);
(*functable[0])(“%d”, &i);

a. 100, Runtime error.


b. 100, Random number, Random number, Random number.
c. Compile error

d. 100, Random number

9.
main()
{
int i, j, *p;
i = 25;
j = 100;
p = &i; // Address of i is assigned to pointer p
printf(“%f”, i/(*p) ); // i is divided by pointer p
}

a. Runtime error.
b. 1.00000
c. Compile error
d. 0.00000
Ans: c) Error becoz i/(*p) is 25/25 i.e 1 which is int & printed as a float,
So abnormal program termination,
runs if (float) i/(*p) —–> Type Casting

10.
main()
{
int i, j;
scanf(“%d %d”+scanf(“%d %d”, &i, &j));
printf(“%d %d”, i, j);
}

a. Runtime error.
b. 0, 0
c. Compile error
d. the first two values entered by the user
Ans: d) two values entered, 3rd will be null pointer assignment

11.

main()
{
char *p = “hello world”;
p[0] = ‘H’;
printf(“%s”, p);
}

a. Runtime error.
b. “Hello world”
c. Compile error
d. “hello world”
Ans: b) Hello world

12.
main()
{
char * strA;
char * strB = I am OK;
memcpy( strA, strB, 6);
}

a. Runtime error.
b. I am OK
c. Compile error
d. I am O

Ans: c) I am OK is not in ” ”

13. How will you print % character?


a. printf(“\%”)
b. printf(“\\%”)
c. printf(“%%”)
d. printf(“\%%”)
Ans: c) printf(” %% “);

14.
const int perplexed = 2;
#define perplexed 3

main()
{
#ifdef perplexed
#undef perplexed
#define perplexed 4
#endif
printf(“%d”,perplexed);
}

a. 0
b. 2
c. 4
d. none of the above

Ans: c)

15.
struct Foo
{
char *pName;
};

main()
{
struct Foo *obj = malloc(sizeof(struct Foo));
clrscr();
strcpy(obj->pName,”Your Name”);
printf(“%s”, obj->pName);
}

a. Your Name
b. compile error
c. Name
d. Runtime error

Ans a)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy