# Data structure/Data Structure and Algorithms (DSA) set 3 Sample Test,Sample questions

## Question: ``` How will you print on screen?```

1.printf("\n");

2.printf(\ );

3. echo\\n;

4. printf("\\n");

1. 0 1 2 3

2.0 1 2

3.1 2 3

4.compiler error

## Question: ` a-> is systematically correct if_____`

1.a is a pointer to a structure in which b is a field

2.a and b are structure

3. a is a structure and b is a pointer to a structure

4.a is a pointer to a structure and b is a structure

## Question: ` Big O notation is defined for`

1.time and space complexity

2.optimality

3.seaching

4.none of the above

1.abacus

2.charles babage

3.thomson

4.dennis ritchie

1.0101 1001

2.1010 0100

3.0000 0010

4.None of These

1.two bytes

2. four bytes

3.one bytes

4. eight bytes

1.8

2. 8

3.9

4.Compile error

1.-60

2. -30

3.60

4.garbage value

## Question: ` Which of the following data structure is linear type ?`

1.strings

2.lists

3.queues

4.All of the above

## Question: ` Which of the following statement is true about char ****a ?`

1.a is pointer to a pointer to a pointer to char

2.a is pointer to a pointer to a pointer to char

3.a is a pointer to a char pointer

4.a is a pointer to a pointer to a char

## Question: ```. What is error in following declaration? struct outer{ int a; struct inner{ char c; }; };```

1. nesting of structure is not allowed in c

2.it is necessary to initialize the member variable

3. inner structure must have name

4.outer structure must have name

1. three fields

2.two fields

3.four fields

4. one field

1.static

2.auto

3.external

4.local

## Question: `An algorithm is made up of two independent time complexities f (n) and g (n). Then the complexities of the algorithm is in the order of`

1. f(n) x g(n)

2. max ( f(n),g(n))

3.min (f(n),g(n))

4. f(n) + g(n)

## Question: `Are *ptr++ and ++*ptr are same?`

1.no they are not same

2.yes they are one and the same

3. depends upon the value of ptr

4.None of These

1. strchar

2.strnset

3.strstr

4.strrchr

1.7

2.8

3.15

4.16

## Question: `If two string are identical then strcmp() function returns____`

1. A. -1 B. 1 D. none of these

2.1

3.0

4.None of These

## Question: `In C, if you pass an array as an argument to a function, what actually gets passed?`

1.value of elements in array

2.first element of the array

4.address of the last element of array

1.1

2. n-1

3.n(n-1)/2

4.none of these

## Question: `Pointer is a___________`

1. a keyword used to create a variable

2. a variable that stores the address of some instruction

3.a variable that stores the address of some other variable

4.All of the above

1. fifo

2.lifo

3.lilo

4.liso

## Question: `The data type created by the data abstraction process is called`

1.class

2.structure

3.abstract data type

4. user defined data type

## Question: `The members of the union are accessed by____`

1.dot operator

2.pointer -> operator

3.both a and b

4.None of These

1. <<

2. >>

3.&

4./

1. 0001 1111

2.1111 0001

3.0000 1000

4.None of These

1.0101 1100

2. 0010 1110

3.0000 0110

4.None of These

1. 0101 1100

2.0110 1000

3. 0001 1110

4.None of These

1. 0001 1111

2.1111 0001

3. 0001 0000

4.None of These

1.0101 1001

2.1010 0100

3.0000 0010

4.None of These

## Question: `The result of i)true AND false II)false or false`

1.i)is true and ii)is true

2. i)is true and ii)is false

3.i)is false and ii)is true

4. i)is false and ii)is false

1.interchange

2.searching

4.None of These

## Question: `What is the similarity between structure,union and enum?`

1.all of them let you define new values

2.all of them let you define new pointers

3.all of them let you define new structure

4.all of them let you define new data types

## Question: ```What will be output if you will compile and execute the following c code? #include <stdio.h> #include <string.h> int main(){ char *str=NULL; strcpy(str,"cquestionbank"); printf("%s",str); return 0; }```

1.cquestionbank

2.cquestionbank\0

3.(null)

4.it will print nothing

1.35

2.510

3.15

4. 40

1.5

2.6

3.7

4.0

1.343

2.27

3.133

4.compiler error

1.25

2.26

4.garbage value

1. 10hello world

2.11hello world

3. hello world12

4.hello world13

1.135

2.+inf

3.-121

4.-8

1.12

2.8

3.4

4.1

1.12 11 11

2.12 10 10

3. 11 11 12

4.10 10 12

## Question: ```What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int a=2; if(a==2){ a=~a+2<<1; printf("%d",a); } else{ break; } return 0;```

1. it will print nothing

2.-3

3.-2

4.compiler error

1.equal

2.less than

3.greater than

4.compiler error

## Question: ```What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i=320; char *ptr=(char *)&i; printf("%d",*ptr); return 0; }```

1.320

2.1

3.64

4.None of the above

## Question: ```What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i=4,x; x=++i + ++i + ++i; printf("%d",x); return 0; }```

1.21

2.18

3.12

4.Compile time error

1.4

2.5

3.6

4.compiler error

1.2

2.4

3.8

4.10

## Question: ```What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ float a=5.2; if(a==5.2) printf("Equal"); else if(a<5.2) printf("Less than"); else printf("Greater than"); return 0; }```

1.equal

2.less than

3.greater than

4. compiler error

1.mycompute

2.syntax error

3.runtime error

4.None of These

1.hello

2.hello world

3.world

4.none of these

## Question: `Which data structure allows deleting data elements from front and inserting at rear?`

1.stack

2.queue

3.dequeue

4.binary search tree

## Question: `Which of the following can not be a structure member?`

1.another structure

2. array

3.function

4.None of These

## Question: `Which of the following data structure is linear type ?`

1.strings

2.lists

3.queues

4. all of the above

## Question: `Which of the following is a collection of different data type elements?`

1.array

2.structure

3.string

4.all of the above

## Question: `Which of the following is a collection of different data type elements?`

1.array

2.structure

3.string

4.all of the above

## Question: `Which of the following is a collection of different data type elements?`

1.array

2.structure

3.string

4.All of the above

1. printf

2.scanf

3.put

4.gets

1. *

2. &

3.dot

4. +

## More MCQS

##### Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!