SlideShare ist ein Scribd-Unternehmen logo
1 von 7
Downloaden Sie, um offline zu lesen
T: 2H
1
C and Data Structure
1. The operator & is used for
1. Bitwise AND
2. Bitwise OR
3. Logical AND
4. Logical OR
2. Built-in data structures in „C‟ are
1. Arrays
2. Structures
3. Files
4. All of the above
3 .The size of a character variable in „C‟ is
1. 4 byte
2. 8 bytes
3. 16 bytes
4. None of the above
4. What is the output of the following program segment?
#include<stdio.h>
main()
{
int i=10, m=10;
clrscr();
printf(“%d”, i>m?i*i:m/m,20);
getch();
}
1. 20
2. 1
3. 120
4. 100 20
5. Data type of the controlling statement of a SWITCH statement cannot of the type:
1. int
2. char
3. short
4. float
6. How long the following loop runs:
for (x=0; x=3; x++)
1. Three time
2. Four times
3. Forever
4. Never
7. An expression contains assignment, relational and arithmetic operators. If parentheses
are not specified, the order of evaluation of the operators would be:
1. assignment, arithmetic, relational
2. relational, arithmetic, assignment
3. assignment, relational, arithmetic
4. arithmetic, relational, assignment
8. The CONTINUE statement cannot be used with
1. for
2. switch
3. do
4. while
9. Output of the following program will be:
main( )
{
int a [ ] = {1, 2, 9, 8, 6, 3, 5, 7, 8, 9};
int *p = a+1;
int *q = a+6;
printf (“n%d”, q-p);
MM:50
2
}
1. 9
2. 5
3. 2
4. None of the above
10. Size of the following union (assume size of int=2; size of float=4 and size of char = 1):
union Jabb
{
int a;
float b;
char c;
};
1. 2
2. 4
3. 1
4. 7
11. int z, x=5, y=-10, a=4, b=2;
z=x++ - --y * b / a;
What will be the final value of z?
1. 5
2. 6
3. 10
4. 11
12. With every use of memory allocation function, what function should be used to release
allocated memory which is no longer needed?
1. dropmem( ) 2. dealloc( )
3. release( ) 4. free( )
13. int warr[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What will be the value of warr[2][1][0]?
1. 5
2. 7
3. 9
4. 11
14. char *ptr;
char myString[ ] = “abcdefg”;
ptr = myString;
ptr += 5;
The pointer ptr points to which string?
1. fg
2. efg
3. defg
4. cdefg
15. Suppose that x is initialized as:
short int x; /* assume x is 16 bits in size */
What is the maximum number that can be printed using printf (“%dn”, x),
1. 127
2. 128
3. 255
4. 32,767
16. When applied to a variable, what does the unary “&” operator yield?
1. The variable‟s address
2. The variable‟s right value
3. The variable‟s binary form
4. The variable‟s value
3
17. How is a variable accessed from another file?
1. via the extern specifier.
2. via the auto specifier.
3. via the global specifier.
4. via the pointer specifier.
18. What does the following function print?
func(int i)
{if(i%2) return 0;
else return 1;}
main( )
{
int=3;
i=func(i);
i=func(i);
printf(“%d”, i);
}
1. 3
2. 1
3. 0
4. 2
19. Given the piece of code
int a[50];
int *pa;
pa=a;
To access the 6th
element of the array which of the following is incorrect?
1. *(a+5)
2. a[5]
3. pa[5]
4. *(*pa + 5)
20. Regarding the scope of the variables; identify the incorrect statement:
1. automatic variables are automatically initialized to 0
2. static variables are automatically initialized to 0
3. the address of a register variable is not accessible
4. static variables cannot be initialized with any expression
21. Given the following code fragment:
void main(voi4.
{
char x = „0‟;
char n = „N‟;
printf(“%u” ”%sn”, &n, &n);
}
What will be the result of execution?
1. ddddd N ( where d represents any digit)
2. 78 N
3. 78 garbage
4. compilation error
22. Given the following code fragment:
int main(voi4.
{
int raw[20], i, sum=0;
int *p = raw;
for (i=0; i < 20; i++)
4
*(p+i) = I;
for(i=0; i < 20; I += sizeof(int))
sum += *(p+i)
printf(“sum = %dn”, sum);
return();
}
What will be the result of execution?
1. sum = 10
2. sum = 40
3. sum = 60
4. sum = 190
23. What is the missing statement in the following function which copies string x into string y
void strcpy( char *x, char *y)
{
while (*y != „0‟)
………………… /* missing stament */
*x = „0‟;
}
1. x = y
2. *x++ = *y++
3. (*x)++ = (*y)++
4. none of the above
24. Consider the following program,
main( )
{
int x = 49;
for(;x;)
x--;
printf(“%dn”, x);
}
the output of the program will be
1. 49
2. 0
3. -49
4. none of the above
25. # define dp(e) printf(#e “ = %dn”,e)
main( )
{
int x =3, y = 2;
dp(x/y)
}
What will be the output of the program?
1. prints x/y = 1
2. prints #e = 1. 5
3. prints #x/y = 1
4. none of the above
26 . Assume that i, j and k are integer variables and their values are 8, 5 and 0 respectively.
What will be the values of variables i and k after executing the following expressions?
k = ( j > 5) ? ( i < 5) ? i-j: j-i: k-j;
i -= (k) ? (i) ? (j): (i): (k);
1. -3 and 3
2. 3 and -5
3. 3 and -3
4. -5 and 3
5
27. The && and | | operators
1. compare two numeric values
2. combine two numeric values
3. compare two boolean values
4. none of the above
28. An external variable is one
1. Which resides in the memory till the end of the program
2. Which is globally accessible by all functions
3. Which is declared outside the body of any function
4. All of the above
29. Find the error in the following program:
main( )
{
int m;
char g;
switch(m)
{
case 5 : grade=”P”;break;
case 2 : grade=”Q”;break;
case 2 : grade=”R”;break;
default : grade=”S”;break;
}
}
1. No two labels may be identical
2. switch statement cannot have more than three labels
3. case label cannot be numbers
4. none of the above
30. Consider the following program:
main( )
{
char *k=”xyz;
f(k);
printf(“%sn”,k);
}
f(char *k)
{ k = malloc(4); strcpy(k, “pq”); }
What will be the output?
1. pq
2. xyz
3. syntax error
4. none of the above
31. Time complexity of insertion sort algorithm in the best case is
1. O(n)
2. O(n log2 n)
3. O(n2
)
4. none of the above
32. In linked list representation, a node contains at least
1. node address field, data field
2. node number, data field
3. next address field, information field
4. none of the above
6
33. Which of the following statements are true:
1. binary search is always better than sequential search.
2. binary search is better than sequential search when
number of elements is small.
3. binary search is better than sequential search when
number of elements is very large.
4. binary search is always inferior to sequential search.
34 In an 16-bit computer, 30 digit integer can be stored in
1. an integer variable
2. floating point variable
3. a circular list
4. none of the above
35 A stack can be used to
1. allocate resources by the operating system
2. to schedule jobs on round-robin basis
3. process procedure call in a program
4. none of the above
36. An ordered set of items from which items may be deleted at either end and into which
items may be inserted at either end is called.
1. Queue
2. Stack
3. Heap
4. Dequeue
37. The property of hash function is that
1. it minimizes the rate of overflow
2. it preserves the order of key values.
3. it minimizes number of collisions.
4. none of the above.
38. The number of comparisons needed to merge-sort a list of n elements is
1. O(n log n)
2. O(n log log n)
3. O(n)
4. O(n log n2
)
39. In the text of the divide and conquer algorithm must contain at least
1. One recursive call
2. Two recursive calls
3. Either one or zero calls
4. None of the above
40. In a stack, top=0 denotes that
1. stack is empty
2. stack is full
3. top has no element
4. none of the above
41. The correct increasing order of magnitude of computing time is-
1. O(1) < O(logn) < O(n) < O(n logn) < O(n2
) < O(n3
) < O(2n
)
2. O(2n
) < O(n3
) < O(n2
) < O(n logn) < O(n) < O(logn) O(1)
3. O(logn) < O(n logn) < O(n) < O(n2
) < O(n3
) < O(2n
) < O(1)
4. None of the above
42. Suppose the union is declared like
union
{
float x;
7
char c[10];
int y;
}num;
Assuming that float requires 4 bytes, char requires 1 byte and int requires 2 bytes, the memory
space used by the variable num is
1. 16 bytes
2. 10 bytes
3. 4 bytes
4. 7 bytes
43. Which data structure is implemented in automatic variable declaration?
1. Queue
2. Stack
3. Heap
4. Graph
44. If j=2, m=1, x=3, y=4. What is the value of the expression j++ = = m = = y * x
1. 0
2. 1
3. 2
4. 3
45. Which of the following data structure may give overflow error, even though the current number
of elements in it, is less than its size
1. simple queue
2. circular queue
3. stack
4. none of the above
46. Which one is not correct?
1. Pointers are used for dynamically allocating memory.
2. Dynamic memory allocation is preferred when storage requirement is not predictable.
3. Data access in dynamically allocated storage is faster than static allocated storage.
4. None of the above
47. Which of the following cannot be performed recursively?
1. Binary Search
2. Quick Sort
3. Depth First Search
4. None of the above
48. “p” is a pointer to the structure. A member “mem” of that structure is referenced by
1. *p.mem
2. (*p).mem
3. *(p.mem)
4. None of the above
49. If the file contains data (61, 41, 91, 11) then the most suitable sorting technique is–
1. Quick sort
2. Radix sort
3. Insertion sort
4. None of the above
50. If there are total n nodes, then memory compaction requires
1
. O (log2 n) steps
2. O (n) steps
3. O (n2
) steps
4. None of the above

Weitere ähnliche Inhalte

Was ist angesagt?

Virtual base class
Virtual base classVirtual base class
Virtual base class
Tech_MX
 
11 lec 11 storage class
11 lec 11 storage class11 lec 11 storage class
11 lec 11 storage class
kapil078
 

Was ist angesagt? (20)

Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
Operating system and C++ paper for CCEE
Operating system and C++ paper for CCEEOperating system and C++ paper for CCEE
Operating system and C++ paper for CCEE
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in C
 
C multiple choice questions and answers pdf
C multiple choice questions and answers pdfC multiple choice questions and answers pdf
C multiple choice questions and answers pdf
 
Storage classes in C
Storage classes in CStorage classes in C
Storage classes in C
 
Let us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionLet us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solution
 
file
filefile
file
 
Chapter 1 : Balagurusamy_ Programming ANsI in C
Chapter 1  :  Balagurusamy_ Programming ANsI in C Chapter 1  :  Balagurusamy_ Programming ANsI in C
Chapter 1 : Balagurusamy_ Programming ANsI in C
 
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solutionLet us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
Let us c (5th and 12th edition by YASHVANT KANETKAR) chapter 2 solution
 
Ansi c
Ansi cAnsi c
Ansi c
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
Central processing unit
Central processing unitCentral processing unit
Central processing unit
 
Digital electronics mcq
Digital electronics mcqDigital electronics mcq
Digital electronics mcq
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Let us c chapter 4 solution
Let us c chapter 4 solutionLet us c chapter 4 solution
Let us c chapter 4 solution
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Top C Language Interview Questions and Answer
Top C Language Interview Questions and AnswerTop C Language Interview Questions and Answer
Top C Language Interview Questions and Answer
 
11 lec 11 storage class
11 lec 11 storage class11 lec 11 storage class
11 lec 11 storage class
 
Function in C
Function in CFunction in C
Function in C
 
Cast 14 2 sample exam
Cast 14 2 sample examCast 14 2 sample exam
Cast 14 2 sample exam
 

Andere mochten auch

Instructions to candidates For DASDM
Instructions to candidates For DASDMInstructions to candidates For DASDM
Instructions to candidates For DASDM
prabhatjon
 

Andere mochten auch (10)

Oops Paper
Oops PaperOops Paper
Oops Paper
 
DVLSI Guess paper for CDAC CCAT Jun- Jul 2013 Enterence examination
DVLSI Guess paper for CDAC CCAT Jun- Jul 2013 Enterence examination DVLSI Guess paper for CDAC CCAT Jun- Jul 2013 Enterence examination
DVLSI Guess paper for CDAC CCAT Jun- Jul 2013 Enterence examination
 
CCAT Aug 2013 paper
CCAT Aug 2013 paperCCAT Aug 2013 paper
CCAT Aug 2013 paper
 
Section b a
Section b  aSection b  a
Section b a
 
Instructions to candidates For DASDM
Instructions to candidates For DASDMInstructions to candidates For DASDM
Instructions to candidates For DASDM
 
Dsda
DsdaDsda
Dsda
 
Delta final paper
Delta final paperDelta final paper
Delta final paper
 
Some question for Section C (Embeded )
Some question for Section C (Embeded )Some question for Section C (Embeded )
Some question for Section C (Embeded )
 
Some other Importent Question (Mix)
Some other Importent Question (Mix)Some other Importent Question (Mix)
Some other Importent Question (Mix)
 
Section c
Section cSection c
Section c
 

Ähnlich wie C and data structure

Ds lab manual by s.k.rath
Ds lab manual by s.k.rathDs lab manual by s.k.rath
Ds lab manual by s.k.rath
SANTOSH RATH
 
Getting Started Cpp
Getting Started CppGetting Started Cpp
Getting Started Cpp
Long Cao
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
gkgaur1987
 

Ähnlich wie C and data structure (20)

Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)Lab manual data structure (cs305 rgpv) (usefulsearch.org)  (useful search)
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)
 
Unit 3
Unit 3 Unit 3
Unit 3
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Arrays and function basic c programming notes
Arrays and function basic c programming notesArrays and function basic c programming notes
Arrays and function basic c programming notes
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
 
Unit 3
Unit 3 Unit 3
Unit 3
 
Ds lab manual by s.k.rath
Ds lab manual by s.k.rathDs lab manual by s.k.rath
Ds lab manual by s.k.rath
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework Help
 
02. Data Types and variables
02. Data Types and variables02. Data Types and variables
02. Data Types and variables
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdf
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptx
 
linkedlist.pptx
linkedlist.pptxlinkedlist.pptx
linkedlist.pptx
 
functions
functionsfunctions
functions
 
C++_notes.pdf
C++_notes.pdfC++_notes.pdf
C++_notes.pdf
 
Microkernel Development
Microkernel DevelopmentMicrokernel Development
Microkernel Development
 
C Programming Language
C Programming LanguageC Programming Language
C Programming Language
 
Getting Started Cpp
Getting Started CppGetting Started Cpp
Getting Started Cpp
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 
array
arrayarray
array
 

Mehr von prabhatjon

Dasdm advanced software development methodologies
Dasdm advanced software development methodologiesDasdm advanced software development methodologies
Dasdm advanced software development methodologies
prabhatjon
 

Mehr von prabhatjon (19)

Registration open for CCDAC AUG 2015 batch
Registration open for CCDAC AUG 2015 batchRegistration open for CCDAC AUG 2015 batch
Registration open for CCDAC AUG 2015 batch
 
C-CAT Exam Laptop Configuration
C-CAT Exam Laptop ConfigurationC-CAT Exam Laptop Configuration
C-CAT Exam Laptop Configuration
 
Core java
Core javaCore java
Core java
 
Os paper
Os paperOs paper
Os paper
 
Cplus plus abd datastructure
Cplus plus abd datastructureCplus plus abd datastructure
Cplus plus abd datastructure
 
Critical Aptitude Question
Critical Aptitude QuestionCritical Aptitude Question
Critical Aptitude Question
 
Cyber law ipc
Cyber law ipcCyber law ipc
Cyber law ipc
 
Ccpp pune
Ccpp puneCcpp pune
Ccpp pune
 
Aloha paper for cdac ccpp
Aloha paper  for  cdac ccppAloha paper  for  cdac ccpp
Aloha paper for cdac ccpp
 
Diploma in Advanced Software Development Methodologies (DASDM)
Diploma in Advanced Software Development Methodologies  (DASDM)Diploma in Advanced Software Development Methodologies  (DASDM)
Diploma in Advanced Software Development Methodologies (DASDM)
 
Noida placement comp
Noida placement compNoida placement comp
Noida placement comp
 
New Address of CDAC
New Address of CDACNew Address of CDAC
New Address of CDAC
 
Course summary@bytes
Course summary@bytesCourse summary@bytes
Course summary@bytes
 
Admission booklet pg diploma courses cdac-v4
Admission booklet pg diploma courses cdac-v4Admission booklet pg diploma courses cdac-v4
Admission booklet pg diploma courses cdac-v4
 
Pg dst admissions-list
Pg dst admissions-listPg dst admissions-list
Pg dst admissions-list
 
List of companies visited Aug 2012 batch
List of companies visited Aug 2012 batchList of companies visited Aug 2012 batch
List of companies visited Aug 2012 batch
 
New added syllabus in ditiss by aug 2013 batch
New added syllabus in ditiss by aug 2013 batchNew added syllabus in ditiss by aug 2013 batch
New added syllabus in ditiss by aug 2013 batch
 
Dasdm advanced software development methodologies
Dasdm advanced software development methodologiesDasdm advanced software development methodologies
Dasdm advanced software development methodologies
 
Dasdm advertisement
Dasdm advertisement Dasdm advertisement
Dasdm advertisement
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

C and data structure

  • 1. T: 2H 1 C and Data Structure 1. The operator & is used for 1. Bitwise AND 2. Bitwise OR 3. Logical AND 4. Logical OR 2. Built-in data structures in „C‟ are 1. Arrays 2. Structures 3. Files 4. All of the above 3 .The size of a character variable in „C‟ is 1. 4 byte 2. 8 bytes 3. 16 bytes 4. None of the above 4. What is the output of the following program segment? #include<stdio.h> main() { int i=10, m=10; clrscr(); printf(“%d”, i>m?i*i:m/m,20); getch(); } 1. 20 2. 1 3. 120 4. 100 20 5. Data type of the controlling statement of a SWITCH statement cannot of the type: 1. int 2. char 3. short 4. float 6. How long the following loop runs: for (x=0; x=3; x++) 1. Three time 2. Four times 3. Forever 4. Never 7. An expression contains assignment, relational and arithmetic operators. If parentheses are not specified, the order of evaluation of the operators would be: 1. assignment, arithmetic, relational 2. relational, arithmetic, assignment 3. assignment, relational, arithmetic 4. arithmetic, relational, assignment 8. The CONTINUE statement cannot be used with 1. for 2. switch 3. do 4. while 9. Output of the following program will be: main( ) { int a [ ] = {1, 2, 9, 8, 6, 3, 5, 7, 8, 9}; int *p = a+1; int *q = a+6; printf (“n%d”, q-p); MM:50
  • 2. 2 } 1. 9 2. 5 3. 2 4. None of the above 10. Size of the following union (assume size of int=2; size of float=4 and size of char = 1): union Jabb { int a; float b; char c; }; 1. 2 2. 4 3. 1 4. 7 11. int z, x=5, y=-10, a=4, b=2; z=x++ - --y * b / a; What will be the final value of z? 1. 5 2. 6 3. 10 4. 11 12. With every use of memory allocation function, what function should be used to release allocated memory which is no longer needed? 1. dropmem( ) 2. dealloc( ) 3. release( ) 4. free( ) 13. int warr[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; What will be the value of warr[2][1][0]? 1. 5 2. 7 3. 9 4. 11 14. char *ptr; char myString[ ] = “abcdefg”; ptr = myString; ptr += 5; The pointer ptr points to which string? 1. fg 2. efg 3. defg 4. cdefg 15. Suppose that x is initialized as: short int x; /* assume x is 16 bits in size */ What is the maximum number that can be printed using printf (“%dn”, x), 1. 127 2. 128 3. 255 4. 32,767 16. When applied to a variable, what does the unary “&” operator yield? 1. The variable‟s address 2. The variable‟s right value 3. The variable‟s binary form 4. The variable‟s value
  • 3. 3 17. How is a variable accessed from another file? 1. via the extern specifier. 2. via the auto specifier. 3. via the global specifier. 4. via the pointer specifier. 18. What does the following function print? func(int i) {if(i%2) return 0; else return 1;} main( ) { int=3; i=func(i); i=func(i); printf(“%d”, i); } 1. 3 2. 1 3. 0 4. 2 19. Given the piece of code int a[50]; int *pa; pa=a; To access the 6th element of the array which of the following is incorrect? 1. *(a+5) 2. a[5] 3. pa[5] 4. *(*pa + 5) 20. Regarding the scope of the variables; identify the incorrect statement: 1. automatic variables are automatically initialized to 0 2. static variables are automatically initialized to 0 3. the address of a register variable is not accessible 4. static variables cannot be initialized with any expression 21. Given the following code fragment: void main(voi4. { char x = „0‟; char n = „N‟; printf(“%u” ”%sn”, &n, &n); } What will be the result of execution? 1. ddddd N ( where d represents any digit) 2. 78 N 3. 78 garbage 4. compilation error 22. Given the following code fragment: int main(voi4. { int raw[20], i, sum=0; int *p = raw; for (i=0; i < 20; i++)
  • 4. 4 *(p+i) = I; for(i=0; i < 20; I += sizeof(int)) sum += *(p+i) printf(“sum = %dn”, sum); return(); } What will be the result of execution? 1. sum = 10 2. sum = 40 3. sum = 60 4. sum = 190 23. What is the missing statement in the following function which copies string x into string y void strcpy( char *x, char *y) { while (*y != „0‟) ………………… /* missing stament */ *x = „0‟; } 1. x = y 2. *x++ = *y++ 3. (*x)++ = (*y)++ 4. none of the above 24. Consider the following program, main( ) { int x = 49; for(;x;) x--; printf(“%dn”, x); } the output of the program will be 1. 49 2. 0 3. -49 4. none of the above 25. # define dp(e) printf(#e “ = %dn”,e) main( ) { int x =3, y = 2; dp(x/y) } What will be the output of the program? 1. prints x/y = 1 2. prints #e = 1. 5 3. prints #x/y = 1 4. none of the above 26 . Assume that i, j and k are integer variables and their values are 8, 5 and 0 respectively. What will be the values of variables i and k after executing the following expressions? k = ( j > 5) ? ( i < 5) ? i-j: j-i: k-j; i -= (k) ? (i) ? (j): (i): (k); 1. -3 and 3 2. 3 and -5 3. 3 and -3 4. -5 and 3
  • 5. 5 27. The && and | | operators 1. compare two numeric values 2. combine two numeric values 3. compare two boolean values 4. none of the above 28. An external variable is one 1. Which resides in the memory till the end of the program 2. Which is globally accessible by all functions 3. Which is declared outside the body of any function 4. All of the above 29. Find the error in the following program: main( ) { int m; char g; switch(m) { case 5 : grade=”P”;break; case 2 : grade=”Q”;break; case 2 : grade=”R”;break; default : grade=”S”;break; } } 1. No two labels may be identical 2. switch statement cannot have more than three labels 3. case label cannot be numbers 4. none of the above 30. Consider the following program: main( ) { char *k=”xyz; f(k); printf(“%sn”,k); } f(char *k) { k = malloc(4); strcpy(k, “pq”); } What will be the output? 1. pq 2. xyz 3. syntax error 4. none of the above 31. Time complexity of insertion sort algorithm in the best case is 1. O(n) 2. O(n log2 n) 3. O(n2 ) 4. none of the above 32. In linked list representation, a node contains at least 1. node address field, data field 2. node number, data field 3. next address field, information field 4. none of the above
  • 6. 6 33. Which of the following statements are true: 1. binary search is always better than sequential search. 2. binary search is better than sequential search when number of elements is small. 3. binary search is better than sequential search when number of elements is very large. 4. binary search is always inferior to sequential search. 34 In an 16-bit computer, 30 digit integer can be stored in 1. an integer variable 2. floating point variable 3. a circular list 4. none of the above 35 A stack can be used to 1. allocate resources by the operating system 2. to schedule jobs on round-robin basis 3. process procedure call in a program 4. none of the above 36. An ordered set of items from which items may be deleted at either end and into which items may be inserted at either end is called. 1. Queue 2. Stack 3. Heap 4. Dequeue 37. The property of hash function is that 1. it minimizes the rate of overflow 2. it preserves the order of key values. 3. it minimizes number of collisions. 4. none of the above. 38. The number of comparisons needed to merge-sort a list of n elements is 1. O(n log n) 2. O(n log log n) 3. O(n) 4. O(n log n2 ) 39. In the text of the divide and conquer algorithm must contain at least 1. One recursive call 2. Two recursive calls 3. Either one or zero calls 4. None of the above 40. In a stack, top=0 denotes that 1. stack is empty 2. stack is full 3. top has no element 4. none of the above 41. The correct increasing order of magnitude of computing time is- 1. O(1) < O(logn) < O(n) < O(n logn) < O(n2 ) < O(n3 ) < O(2n ) 2. O(2n ) < O(n3 ) < O(n2 ) < O(n logn) < O(n) < O(logn) O(1) 3. O(logn) < O(n logn) < O(n) < O(n2 ) < O(n3 ) < O(2n ) < O(1) 4. None of the above 42. Suppose the union is declared like union { float x;
  • 7. 7 char c[10]; int y; }num; Assuming that float requires 4 bytes, char requires 1 byte and int requires 2 bytes, the memory space used by the variable num is 1. 16 bytes 2. 10 bytes 3. 4 bytes 4. 7 bytes 43. Which data structure is implemented in automatic variable declaration? 1. Queue 2. Stack 3. Heap 4. Graph 44. If j=2, m=1, x=3, y=4. What is the value of the expression j++ = = m = = y * x 1. 0 2. 1 3. 2 4. 3 45. Which of the following data structure may give overflow error, even though the current number of elements in it, is less than its size 1. simple queue 2. circular queue 3. stack 4. none of the above 46. Which one is not correct? 1. Pointers are used for dynamically allocating memory. 2. Dynamic memory allocation is preferred when storage requirement is not predictable. 3. Data access in dynamically allocated storage is faster than static allocated storage. 4. None of the above 47. Which of the following cannot be performed recursively? 1. Binary Search 2. Quick Sort 3. Depth First Search 4. None of the above 48. “p” is a pointer to the structure. A member “mem” of that structure is referenced by 1. *p.mem 2. (*p).mem 3. *(p.mem) 4. None of the above 49. If the file contains data (61, 41, 91, 11) then the most suitable sorting technique is– 1. Quick sort 2. Radix sort 3. Insertion sort 4. None of the above 50. If there are total n nodes, then memory compaction requires 1 . O (log2 n) steps 2. O (n) steps 3. O (n2 ) steps 4. None of the above