0% found this document useful (0 votes)
1K views

Tech

The document contains a coding question summary: 1. You are given a function to reverse an integer array in place without using another array. The example shows input and output arrays. 2. You are given a function to find the second largest number among three input integers. 3. You are given a function to find the sum of all elements of a 2D array excluding a given row and column. The algorithm iterates through each row except the excluded row, and adds each element except the excluded column element to a sum variable.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Tech

The document contains a coding question summary: 1. You are given a function to reverse an integer array in place without using another array. The example shows input and output arrays. 2. You are given a function to find the second largest number among three input integers. 3. You are given a function to find the sum of all elements of a 2D array excluding a given row and column. The algorithm iterates through each row except the excluded row, and adds each element except the excluded column element to a sum variable.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Cocubes Preassess computer fundamentals questions-1

COMPUTER FUNDAMENTALS

1. Consider following given code and predict its output.


main()
{
int num[ ] = {1,4,8,12,16};
int *a,*b;
int i;
a=num;
b=num+2;
i=*a+1;
printf("%d,%d,%d\n",i,*a,*b);
}
ops: A. 2,1,8 B. 4,1,8 C. 4,4,8 D. 2,4,8
Ans: 2,1,8

2. Suppose f(A,B)=A'+B. Simplified expression for function f(f(x+y,y),z) is :


ops : A. x'+z B. xyz C. xy'+z D. None of the mention options
Answer: xy'+z

4. Stack is useful for implementing:


A. recursion B. depth first search C. both (A) & (B) D. breadth first search
Ans: Both(A) & (B)

5. HUB is a _______ device and switch is a ________ device.


ops : A. multicast,unicast B. multicast,broadcast C. broadcast,unicast D. broadcast,multicast
Ans: C. broadcast,unicast

6.what is the binary equivalent of the number 368? a.111100000 b.111010000 c.101110000
d.110110000
Ans: c.101110000

7.what will be the output of the following loop?


#include<stdio.h>
main()
{
While(Printf(“%d”, printf(“az”)))
Printf(“by”);
}
a.none of these b.it gives syntax error c.it will print azbyazbyazbyazby… d.it will print
azbybyby…
Ans: c.it will print azbyazbyazbyazby…

8.which of the following combinations of the variables x,y,z makes the variable ‘a’ get the value 4
In the following expression?
A=(x>y)?((x>z)?x:z):( (y>z)?y:z)
a.x=3;y=4;z=2 b.x=6;y=5;z=3 c.x=5;y=4;y=5 d.x=6;y=3;z=5
Ans: a.x=3;y=4;z=2

9.press the enter key in all of the circumstances except…………


a.to insert a blank line into a document b.to begin a new paragraph
c.when the insertion point reaches the right margin d.in response to certain word commands
Ans: c.when the insertion point reaches the right margin

11.The following fragment of c program will print?


char c[ ] = “DATA1234”
char * P = C;
printf (“%S” P+P[3]-P[1]);
a.DATA1234 b.234 c.1234 d.A1234
Ans: DATA1234

12. What is Extended ASCII table


Ans: The Extended ASCII Character Set also consists of 128 decimal numbers and ranges from 128
through 255 (using the full 8-bits of the byte)

13. Mozilla Firefox is a/an


Ans: web browser.

14. ------------ helps in capturing the data and entering into computer system.
Ans: Input devices

15. Secret key encryption is also know as ----------


Ans: Private Key Encryption or Symmetric Key Encryption.

16. A class defined with in another class is named as


a)inheritance b)nested c)container class d)encapsulation
Ans: b)nested

18. what is simplest way of implementing a graph in c or c++


a)associative lists
b)both adjacency matrix and associative list
c)none of these
d)adjacency matrix
Ans: Not Available please comment below the answer for others help, will be updated then.

19. Which of the OSI model is responsible for compression and decompression
a)presentation layer b)transport layer c)application layer d)session layer
Ans: presentation layer
20. Upon mixing two independent one-many relationships__________dependency arises.
a)transitive b)multivalued c)functional d)partial
Ans: Multivalued

21. If L is left node, M is middle node, R is right node then an L-M-R traversal can be termed
as_____
A) post order b) in order c) preorder d) this is invalid order
Ans: In order
If M-L-R then Preorder
If L-R-M then post order

22. which of the OSI model layer is also known as end-to-end layer
a) session layer b) presentation layer c) Transport layer d) Network layer
Ans: Transport Layer

23. Which of the OSI model layer is responsible for both encryption and decryption
a) Presentation layer b)Network layer c) session layer d) transport layer
Ans: Presentation Layer

24. Identify the point that is not true with respect to stack
a) not possible to insert or remove elements anywhere except the top of stack
b) Stack supports LIFO(last in first out) for deleting elements
c) None of these
d) stack is dynamic set where elements are removed in reverse order of insertion
Ans: Not Available please comment below the answer for others help, will be updated then.

25. When word flag a possible spelling or grammar error, it also changes mark on the spelling and
grammar status icon to _____________
a) red x b) red check mark c) green check mark d) green x
Ans: Red X

26. Identify the point that is NOT true with respect to a qeue?
a.deletion from the queue happens only at the tail of the queue.
b.Queue supports FIFO(First In First Out)order of removal of elements.
c.none of these
d.Insertion in queue happens only at the head of the queue.
Ans: Not Available please comment below the answer for others help, will be updated then.

28. Periodic collection of all the free memory space sto form contiguous block of free space by an
operating system is called:
a.garbage collection b.Dynamic memory allocation c.collison d.concatenation
Ans: Not Available please comment below the answer for others help, will be updated then.

29. In C psroramming array index stars from:


a.0 or 1 b.0 c.1 d.none of these
Ans: 0

30. java source code is compiled into_________.


a.byte code b.word code c.bit code d.objective code
Ans: Byte Code

31. the output quality of a printer is measured by:


a.Dots printed per unit time b.Dot per centimetre c.Dot per sq.inch d.Dot per inch
Ans: Dot per sq.inch

32.The number of full and half adders required to add 16-bit numbers is:
a.16 half-adders,0 full-adders
b.8 half –adders,8 full-adders
c.4 half-adders,12 full-adders
d.1 half-adder,15 full-adders
Ans: d.1 half-adder,15 full-adders

33. To select a group of words,________.


a.right-click the first and last characters of the group to be selected
b.double-click anywhere within the group to be selected
c.click the group button on the formatting toolbar
d.drag the mouse pointer through the characters to be selected
Ans: d.drag the mouse pointer through the characters to be selected

34.what will be the output of following C code?


1. struct abc
2. {
3. int b=6;
4. char c;
5. }
6. structure;
7. int main()
8. {
9. int i=sizeof(structure);
10. printf(“%d”,i);
11. }
a.4 b.1 c.2 d.6
Ans: 6

35. There is a question, I did not remember but answer is 3NF

Reverse array : Cocubes coding question


You are given a function,int* ReverseArray(int* arr, int length);
The function takes an integer array and its length as input. Implement the function to return the
array such that the array is reversed i.e. the first element of the array occupies the last position,
second element occupies the second last position and so on.

Note:
The re-arrangement is to be done in-place i.e you cannot use another array.
Assumption:
You may assume that the array is of even length.

Example:

Input:
2 4 6 8 20 15 10 5

Output:
5 10 15 20 8 6 4 2

*********************************************************************************
Program
*********************************************************************************

int* ReverseArray(int* arr, int length)


{
int t,i;
for(i=0;i<length/2;i++)
{
t=arr[i];
arr[i]=arr[length-i-1];
arr[length-i-1]=t;
}
return arr;
}

Second largest Number: cocubes Coding Question

1. PROBLEM STATEMENT:
You are given a function,
int FindSecondLargestNumber(int a,int b,int c);
The function takes three integers 'a', 'b','c' as input .Implement the function to find and
return the second largest number.
CODING:
int FindSeconLargestNumber(int a,int b,int c);
{
/*write your code here .*/

********************
PROGRAM
*******************

Find sum leaving our row and col: cocubes coding question

PROBLEM STATEMENT:
You are given a function,
int FindSumLeavingOutRowCol(int** arr, int m, int n, int i,int j);
The function takes a two-dimensional array 'arr', its number of rows 'm', its number of
columns 'n' and integers 'i' and 'j' as input. Implement the function to find and return
the sum of elements of the array leaving out the elements of the i and j column. The
algorithm to find the sum is as follows:
1.Iterate over every row except for i row,and keep on adding each element except for
the elements of j column to a variable 'sum'.
NOTE:
1.Row and column indices start from 0.
2. Value of i and j from 1.

CODING:
int FindSumLeavingOutRowCol(int** arr, int m, int n,int j);
{
/* write your code here */

You might also like