Tuesday, June 19

Pointers (Lecture Notes) : CUSAT s1s2 Questions




Hi friends,

Here I'm posting some important concepts asked in CUSAT B Tech S1 S2 C programming examination. All the concepts are descried here in very briefly so that you can grasp it quickly.
Here we go..!!! :)



Pointer

· Pointer is a variable that represents the location of a data item.

· Address operator (&) : It evaluates the address of its operand.

· Indirection Operator(*): Used to access data item referenced by a pointer.

Example:

Main()

{

Int a=3;

Int *ptr;

Ptr=&a;

Printf(“%d %u” , *ptr, ptr);

}

Pointer to an array

· A pointer can be used to reference an array.

· The name of an array will work as the pointer to its first element.

Main()

{

Int a[]= { 1, 2 , 3, 4};

Int *ptr =a;

For(int i=0; i<4;i++)

{

Printf(“%d”,* ptr+i);

}

Arrays of Pointers

· A group of pointers are stored in an array.

· Arrays of pointers can be used to store multidimensional arrays

Datatype *array[size];

Structures:

· A collection of heterogeneous elements.

· In structure memory will be allocated for each element.

Struct student {

Char name[20];

Int mark;

};

Union

· Similar to structures, A collection of heterogeneous elements.

· Memory will be allocated for largest member only. Other members have to share this memory.

union student {

Char name[20];

Int mark;

};





Tuesday, June 12

ECIL Graduate Engineer Trainee (GET) recruitment 2012 Computer (CSE) Questions and Answers





Hi Friends,


Here I'm posting the questions asked in ECIL (GET) exam, held on 2012 August 10 , for Computer science, and its detailed solution.
All the questions and answers are collected from memory with the help of  friends..!!!
Hope this will be useful for the preparation for various PSU exams.



Feel free to comment your feedback and doubts ..!!


Here we Go..!! :)


ECIL (GET)
Computer science Stream
Total No Questions: 50
Time Duration: 2 Hrs



(1 )"Bit Stuffing" is used for?
a. Code transparency
b. Synchronization between sender and receiver
c. Data Compression
d. Data Encryption 

Ans: (B) Bit stuffing means inserting a few binary digits to a transmission unit if synchronization pattern is found in data part.The receiver knows how to detect and neglect the stuffed bits.



(2) If inorder traversal of a binary tree is EACKFDBG, what will be its preorder travesal?


(3)Consider the program


main()
{
int x=3, y=7;
modify(x,y,y);
print x;
print y;
}


modify( int x, int y, int z)
{
y= y*2;
z=x+y+z;
}
What will be the output of the program if the arguments are passed to modify through call by reference?

Ans: Since pass by reference is used, After executing,y= y*2; actual values will be x=3, y=14
After this step z=x+y+z; x=3 and y=31
so 3 31 will be printed.




(4) Calculate the Hamming Distance between 010 and 001:
a. 0
b. 1
c. 2
d. 3
Ans:c The Hamming Distance denotes the difference between two binary strings. In the given question difference can be found in 2 positions only. Hence 2 is the hamming distance.



(5)Which of the following is the correct syntax of destructor?
a. x()~
b.x~()
c. x(~)
d.~x()
Ans: (d) ~x() the correct syntax of destructor



(6) How many times the "for" loop in given code fragment will be executed?


main()
{
int i=5;
for( ; scanf("%s", &i) ; printf( "%d", i ));
}


a. for loop never will be executed.
b. for loop will be executed only once.
c. for loop will be executed 5 times
d. for loop will be executed infinite times.

Ans:(d) for loop will be executed infinite times.





(7)Which among the following can input / delete data from both ends , not from the middle?
a. stack
b. linked list
c. queue
d. dequeue

Ans
(d). dequeue





(8)Which among the following involved full code?
a. Black box Test
b. White box Test
c. Integration Test
d. Performance Test

Ans B



(9)What is aliasing?
a. Giving same name to different type of variables.
b. Giving same name for same type of variables.
c. Giving different names for same type of variables
d. Giving different names for same memory location.

(d). Giving different names for same memory location.



(10)float x=4.204 , y=2.103
We can calculate x mod y as:


a. x%y
b. modf(x,y);
c. fmod (x,y);
d. we cannot calculate modulus of two float values in C

Ans C



(11)The type of class accessing primitive data types as objects is called?
a. storage
b. friend
c. virtual
d. wrapper

Ans: D

(12)Which pin is used in 8086 to achieve Mutual exclusion in critical section ?
a. HOLD
b. WAIT
c. RQ/GT
d. LOCK

Ans: d



(13)Which the following operator is used to turn off a particular bit in a byte?
a. ~
b. &&
c. &
d. !

Ans: c

(14) Which among the following correctly explains behavior of a stack?
a. Last element is removed first.
b. Access middle element first
c. Variables can be inserted in any order.
d. variables can be deleted in any order.

Ans: a



(15)Which of the following protocol is used for secure data transfer?
a. HTTP
b. SNMP
c. HTTPS
d. TCP

ans : C



(16) Which of the following is NOT related with inter process communication?
a. pipe
b. semaphore
c. stack
d. mailbox

Ans:C

(17)What is the size of "long double"?
Ans: 10 bytes



(18)What will be the value of FFFF it is a signed integer and is represented by sign magnitude format ?
a. 655536
b. -1
c. -32267
d. 32267

In sign magnitude format the first bit represents sign and it is 1; number is negative. Other bits represent magnitude and its value is 2^15-1. So the answer is -(2^15-1)= -32767



(19) What is the meaning of int (*ptr)[10]
a. pointer to an array of 10 integers.
b. pointer to 10 integer variables
c. array of 10 integer pointers.
d. Array of 10 integers.

Ans :C

(20) In Go - Back N Error control mechanism , after sending N frames, at most how many acknowledgements can be send by the receiver?
a. 0
b. 1
c. N
d. N-1

Ans: C



(21)In a balanced binary tree of N nodes , the difference between left subtree and right subtree will be at most:


a.0
b. 1
c. 2
d. N
Ans: B



(22) Predict the output


main()
{
enum example={ "first", " bin", "akt"};
enum example s1, s2 ,s3;
s1= example.first;
s2= example.akt;
s3= example.bin;
printf("%d %d %d", s1, s2 ,s3);
}


a. 012
b.210
c.021
d.120


Ans: C


(23)Which of the following is NOT true about RS 485?


(24)Which of the following represented by the term Base FX?
a. Thin wire Ethernet
b. Thick wire Ethernet
c. Twisted pair Ethernet
d. Optical Fiber
Ans: D

(25)Which of the following is NOT related with Transport Layer?
a. error control
b. flow control
c. routing


(26)If in a given cache system, 99.99% is the hit ratio ,and the processing time for hit and miss events are 1 microseconds amd 1 milliseconds respectively, the calculate the average processing time?




(27)If 192.97.28.91 and 192.97.28.131 are connected in same network, then which of the following cannot be used for subnet masking?


a. 255.255.255.0
b. 255.255.255.192
c. 255.255.255.126
d. 255.255.255. 224


(28) Which of the following is the property of bipartite graphs of N nodes?
a. There will be N edges
b. There will be only one odd cycle.
c. There will be No odd cycle
d. There will be N^2 Edges.


(29)Which among the following is the statement for dynamic allocation of characters?
Ans: char *p= (char *) malloc[20];


(30) Float to integer conversion is perfectly done in which statement?
float x;
Ans : int i=(int)(x+0.5)






(31)Which is true about "isotopes"?
a. Number of protons is equal
b. Number of neutrons is equal
c. Number of protons is different
d. Number of both protons and neutrons are equal.




(32)Which operator is used to declare member functions outside the class body?
Ans ::


(33)The member elements can be accessed by the pointer variable of a structure using the operator?
Ans: ->


(34)In UML notation which diagram is used to depict the interaction between software and hardware?
Ans: Deployment Diagram




(35)In 8085, ALE signal is used. but it is not is 6086. Why?
a. In 8085 multiplexing is used for communication but not in 6086
b. In 8085 only IO mapped IO is used whereas in 6086 only memory mapped IO is used.


Ans a


(36)If the given sampling frequency is 10 MHz , then for successful transmission bandwidth should be?
a. 5 MHz
b. 10 MHz
c. 20 MHz
d. 100 M Hz

Ans (a)The Nyquist–Shannon sampling theorem states that perfect reconstruction of a signal is possible when the sampling frequency is greater than twice the maximum frequency of the signal being sampled.

Bandwidth = sampling frequency /2= 10/2= 5 MHz



(37)What is the use of "segmentation" in a computer system?


(38) In CSMA/ CD, vulnerable time may be:
a. Round trip time.
b. Time to transmit one complete frame
c. Time to transmit two complete frames
d.Time to reach at the destination.




(39)Which among the following is Non - Linear?
a. Low pass filter
b. Rectifier.
c. High pass filter
d. All the above

Ans: d) A non linear circuit does not have a linear relationship between current and voltage



(40)What is the purpose of Rectifier?
a. To convert DC to AC
b. To convert AC to DC
c. To eliminate Noise.
d. To eliminate DC component.


Ans :B

(41)Associative memory mapping is free from
a. conflict collision
b. capacity collision

Ans :a

 

(42) Address length of IPV4 and IPV6?
Ans: 4 bytes, 16 bytes




(43) In selection sort, after 42 successful iteration of main loop , at least how many elements will be sorted?


a. 41
b. 42
c. 21
d. 43

Ans : b

(44)which one of the following is a hashing algorithm?
a)SHA
b)AES
c)
DES


Ans :A

(45). Aggregate function to count number of rows?

(46). Diagrams to represent Relational database?


(47) what is crc in error control mechanism? 


a) dividend 
b) remainder
c) divisor 
d) quotient 

Ans : b



All the questions were collected from memory.


If you know any other questions, feel free to comment it here..!!!! :)