0% found this document useful (0 votes)
193 views10 pages

None of These

The document contains 44 questions related to C programming concepts like data types, operators, functions, arrays, pointers, structures, linked lists, queues etc. Multiple choice options are given to choose the right answer for each question. Questions cover a wide range of fundamental and advanced C programming topics to test the knowledge of the reader.

Uploaded by

Salu Sasi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
193 views10 pages

None of These

The document contains 44 questions related to C programming concepts like data types, operators, functions, arrays, pointers, structures, linked lists, queues etc. Multiple choice options are given to choose the right answer for each question. Questions cover a wide range of fundamental and advanced C programming topics to test the knowledge of the reader.

Uploaded by

Salu Sasi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 10

1.int a=123.

12;
int b=-123.12;
c=a+b;
printf("%2f",c);

a) 0.00
b) 123.12
c) 246.24
d) None of these

2. struct emp
{
int a;
char *name;
};
main()
{
struct emp *e;
printf("%d",sizeof(e));
}
ANs: 4

3. which is the best thing for linked list than arrays?


i) Insertion
ii) Deletion
iii) Traversal

a) (i) only
b) (i),(ii) only
c) ii,iii only
d) iii only

4. consider the character array of size 10. When a string is more than 10

a) Error
b) Overwrites
c) Nothing
d) garbage value

5. main()
{
char *str;
char *fun();
str=fun();
printf("%s",str);
}

char * fun()
{
char *buffer;
strcpy(buffer,"Hello world");
return buffer;
}

a) hello world
b) Compiler error
c) Runtime error
d) None of the above

6. main()
{
char *str;
char *fun();
str=fun();
printf("%s",str);
}

char * fun()
{
char *buffer;
buffer=(char *) malloc(sizeof(char));
strcpy(buffer,"Hello world");
return buffer;
}

a) hello world
b) Compiler error
c) Runtime error
d) None of the above

7) what is the prefix expression for the given Infix expression A+B*C/D

8) int a;
a=65536;
printf("%d",a);
a) 0
b) Garbage
c) 65535
d) -32768

9) main()
{
char p=65;
printf("%c",p);
}

a) 65 b) p c) error d) none of the above

10) In a function call, _____________ is passed as arguments.


a) variables
b) constants
c) Expressions
d) All the above

11) The value of EOF is ___-1______.

12) () is used for __________

a) function body
b) Arguments
c) Return type
d) Declaration of function

13) How does the string ends?

a) /n
b) /t
c) /0
d) none

14) The range of Unsigned integer is

a) 127 to -128
b) 0 to 65535
c) Depend up on the compiler
d) -32768 to 32767

15) which one of the following is a illegal real constants


a) 32.535
b) -1.5E25 to 3.5E65
c) "53682"
d) -6.583

16) main()
{
int i,a[5];
a[1]=5;
for(i=0;i<5;i++)
{
printf("%d",a[i]);
a++;
}

a) 0 0 0 0 0
b) Garbage value
c) 0 5 0 0 0
d) Compiler error

17) The size of int is 2 bytes,then what is the size of short int?
a) 1
b) 2
c) 4
d) 8

18) In a queue,what condition applies

a) First In First Out


b) Last in first out
c) Elements are inserted and deleted at one end
d) Elements can be inserted and deleted in different ends

19) which of the following statements are true in the case of doubly linked list
i) Every node is connected to other node
ii) We can traverse in both the directions

a) i) only
b)ii) only
c) Both i and ii
d) neither i nor ii

20) main()
{
char str[]="Wipro Infotech";
char *s;
s=&str[13]-13;
while(*s)
printf("%c",*s++);
}

21) char *a="Malayalam";


char *s;
Char *str;
str=a;
s=str+8;
for(;s>=str;s--)
printf("%c",*s);

a) Malayalam
b) malayalaM
c) error
d) None of the above

22) struct main


{
int a;
int b;
struct main *e1;
}
printf("%d %d",sizeof(e1),sizeof(*e1));

23) #define wipro Hai


void main()
{
printf("wipro");

24) Is allocating a block of memory effectively the same as defining an array?


a) True
b) false

25) the size of a node od doubly linked list is always greater than the single linked list
a) True
b) false
26) Queue is used for
i) Expression Evaluation
ii) Scheluding the job in First come First serve

a) i) only
b) ii only
c) both i & ii
d) neither i nor ii

27) what should be replace ????? in the program to get the output 25?

?????
void main()
{
int x=2,y=3,j;
j=SQRT(x+y);
printf("%d",j);
}

a) #define SQRT(int) (int * int)


b) #define SQRT(int) (int) * (int)
c) #define SQRT(int) (int + int)
d) #define SQRT(int) (int) + (int)

28) void fun()


{
static char p[]="Hello";
return p;
}

main()
{
printf("%s",fun());
}
what will be the output?

a) Compiler Error b) Hello c) Garbage value d) None

29) void main()


{
int *p;
p=(int *)malloc(sizeof(int));
for(i=0;i<5;i++)
printf("%d ",p[i]);
}
What is the output?

30) main()
{
int i,j;
for(i=1,j=10;i<j;i++,j--);
printf("%d %d",i,j);
}

31) Which of these will pass the address of the pointer *ptr to the function demofun()?

a) demofun(ptr) b) demofun(&ptr)
c) demofun(*ptr) d) demofun(*&*ptr);

32) which is not a valid expression


a) x!=y b) x! c) !x d) x!y

33) If max=10,rear=max,front=0,then what will be my queue?

a) Queue Empty
b) Queue Full
c) Queue has one element
d) Queue has max-1 elements

34) which is an indefinite loop?


a) do while(0);
b) for(;0;);
c) while(1);
d) while(0);

35) int *ptr;


ptr=(int *)malloc(10*sizeof(int));
which is correct?
i) All Values are intialised to garbage values
ii) Creates memory for 10 integer data

a) i only
b) ii only
c) both i and ii
d) neither i nor ii
36) int *ptr;
ptr=(int *)calloc(10*sizeof(int));
which is correct?
i) All Values are intialised to zero
ii) Creates memory for 10 integer data

a) i only
b) ii only
c) both i and ii
d) neither i nor ii

37) Struct queue


{
int rear;
int front;
int a[100];
}
struct queue *q;
then how will you add a new element called 'item' in the queue?

a) q->rear[a]=item;
b) q->a[q->rear]=item;
c) q->a[rear]=item;
d) q->rear[q->a]=item;

38) In which of the following we can sort the data without moving the data
a) Array
b) Single Linked list
c) Doubly linked list
d) Binary search trees

39) Char d=128;


printf("%c",d);

a)128
b)-128
c) error
d) Garbage values

40) In the following definition


struct node *ptr;
ptr=(struct node *)calloc(sizeof(ptr));

a) ptr is allocated 4 bytes


b) ptr will be allocated sizeof struct node
c) Error
d) ptr will have 8 bytes

41) In a doubly linked list ,if the first node is first and the last node is end,what will be
the output?

traverse(struct node*end)
{
while(end!=NULL)
traverse(end->prev);
printf("%d",end->data);
}

if the input is 1,2,3,4,5 then the output will be

a) 1,2,3,4,5
b) 5,4,3,2,1
c) compilation error
d) none

42) void main()


{
int b=20;
printf("%d"*&b++);
}
what will be the output?
a) 21 b)20 c) error d) Garbage value

43) how will you refer the last node in the doubly linked list which is pointed by the
pointer variable 'cursor'?
a)cursor==NULL
b)cursor->link=NULL
c) Cursor->link=0
d) cursor->data=NULL

44) how will you refer the previous node of the pointer 'cursor' in the doubly linked list
(cursor is not in the first or in the last)?
a)cursor->link++
b)cursor=cursor->left
c) Cursor++
d) cursor->left++

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