46 well-known companies: sony

Source: Internet
Author: User

Sony exam 

1. Complete the following procedures
*
*.*.
*..*..*..
*...*...*...*...
*....*....*....*....*....
*.....*.....*.....*.....*.....*.....
*...... *...... *...... *...... *...... *...... *......
*....... *....... *....... *....... *....... *....... *....... *.......
# Include <stdio. h> # define N 8 int main (){
Int I;
Int J;
Int K;
---------------------------------------------------------
|
|
|
---------------------------------------------------------
Return 0;
}

A:

# Include <stdio. h>
# Define N 8
Void main ()
...{
Int I;
Int J;
Int K;
For (I = 1; I <= N; I ++)
...{
K = I;
For (; k> 0; k --)
...{
Printf ("*");
For (j = I; j> 1; j --)
...{
Printf (".");
}

}
Printf ("");
}
Getch ();
}

 

2. Complete the program to sort the array in descending order.
# Include <stdio. h> void sort ();
Int main (){
Int array [] = {45, 56, 76,234, 3}; // number // meaning given
Sort ();
Return 0;
}
Void sort ()
{
---------------------------------------------------------
|
|
|
---------------------------------------------------------
}

3. feberana's series: 1, 1, 2, 3, 5 ...... Write the program for the tenth item. You can use recursion or other
Method.
# Include <stdio. h>
Int Pheponatch (int );
Int main ()
{
Printf ("The 10th is % d", Pheponatch (10 ));
Return 0;
}
Int Pheponatch (int N)
{
--------------------------------
|
|
--------------------------------
}

4. The following program will crash when running. Please find out the error and correct it and explain the cause.
# Include <stdio. h>
# Include <malloc. h>
Typedef struct {
TNode * left;
TNode * right;
Int value;
} TNode;
TNode * root = NULL;
Void append (int N );
Int main ()
{
Append (63 );
Append (45 );
Append (32 );
Append (77 );
Append (96 );
Append (21 );
Append (17); // Again, given as any number
}
Void append (int N)
{
TNode * NewNode = (TNode *) malloc (sizeof (TNode ));
NewNode-> value = N;
If (root = NULL)
{
Root = NewNode;
Return;
}
Else
{
TNode * temp;
Temp = root;
While (N> = temp. value & temp. left! = NULL) | (N <temp. value & temp.
Right
! = NULL
))
{
While (N> = temp. value & temp. left! = NULL)
Temp = temp. left;
While (N <temp. value & temp. right! = NULL)
Temp = temp. right;
}
If (N> = temp. value)
Temp. left = NewNode;
Else
Temp. right = NewNode;
Return;
}
}

The answer is being updated ..........

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.