Rate this post

If You are searching for a list of all questions and answers for the LinkedIn Computer programming Skill Assessment, this is the right place for You.

Computer programming is the process within computer science whereby a graphic representation of the steps we take to solve a problem is turned into a set of instructions a machine can understand. In order to communicate these instructions to the machine, we use a programming language. The most common language used today is c-sharp, but there are many others.

Each programming language has its own set of rules, syntax, and functions that allow you to create different types of programs. For example, c-sharp can be used to create Windows applications, web applications, or services. It can also be used to create console applications, which are programs that run in a command prompt window.

Table of Contents

## C (Programming Language)

##### Q1. Which Code sample will eventually cause the computer to run out of memory?
• [x]

while(1)

{

char *smallString = (char *) malloc(10);

}

• [ ]

long long number = 1;

while(1)

number *= 2;

• [ ]

while(1)

{

char hugeString[1000000L];

memset(hugeString, 0, 1000000L);

}

• [ ]

while(1)

{

long *bigArray = (long *) malloc(sizeof(long) * 1000);

memset(bigArray, 1000000, 1000);

free(bigArray);

}

#### Q2. What will this code print on the screen?

int f1 (int a, int b)

{

if (a > b)

{

printf(“A is greater than B\n”);

return 1;

}

else

{

printf(“B is greater than A”);

return 0;

}

}

main()

{

if (f1(20,10) || f1(10,20))

printf(“C is fun!\n”);

}

• [x]

A is greater then B

C is fun!

• [ ]

A is greater then B

B is greater then A

C is fun!

• [ ]

A is greater then B

B is greater then A

•  Nothing is printed on Screen

#### Q3. What is the name for calling a function inside the same function?

•  recursion
•  subfunction
•  inner call
•  infinite loop

#### Q4. What does the declaration of variable c2 demonstrate?

main(){

char c1 =’a’;

char c2 = c1+10;

}

•  character arithmetic
•  undefined assignment
•  type conversion
•  invalid declaration

#### Q5. A pointer to void named vptr, has been set to point to a floating point variable named g. What is the valid way to dereference vptr to assign its pointed value to a float variable named f later in this program?

float g;

void *vptr=&g;

•  f = _(float _)vptr;
•  f = (float *)vptr;
•  f = *(float *)vptr;
•  f = *(float)vptr;

#### Q6. What is this declaration an example of?

struct s {

int i;

struct s *s1;

struct s *s2;

};

•  a node
•  a linked list
•  a stack
•  a binary tree

#### Q7. A C header file is a file with extension .h that contains function declarations and macro definitons to be shared between several source files. Header files are listed using the preprocessing directive #include, and can have one of the following formats: #include <fileA> or #include “fileB”. What is the difference between these two formats?

•  The preprocessor will try to locate the fileA in same directory as the source file, and the fileB in a predetermined directory path.
•  The preprocessor will try to locate the fileA in the fixed system directory. It will try to locate fileB in the directory path designated by the -l option added to the command line while compiling the source code.
•  The file using fileA syntax must be system files, of unlimited number. fileB must be a user file at a maximun of one per source file.
•  The preprocessor will try to locate the fileA in a predetermined directory path. It will try to locate fileB in the same directory as the source file along with a custom directory path.

#### Q8. Using a for loop, how could you write a C code to count down from 10 to 1 and display each number on its own line?

• [ ]

for (int i = 0; i>=0, i–){

printf(“%d\n”, i);

}//end of loop

• [ ]

int i;

for (i=1; i<=10; i++){

printf(“%d”, i);

}

• [ ]

int i = 10;

while (i>0){

printf(“%d\n”, i);

i–;

}

• [x]

int i;

for (i= 10; i>0; i–){

printf(“%d\n”, i);

}// end of loop

•  volatile
•  typeof
•  register
•  typedef

#### Q10. What does the program shown below return?

int main(){

int a=1, b=2, c=3, d=4;

int x = a;

if (a>b)

if (b<c) x=b;

else x=c;

return(x);

}

•  1
•  3
•  2
•  0

#### Q11. Using the Union declaration below, how many bytes of memory space will the data of this type occupy?

union Cars {

char make[20];

char model[30];

short year;

} car;

•  32
•  54
•  30
•  52

#### Q12. In this code sample, what is not a problem for C compiler?

main(){

constant int PI = 3.14;

printf(“%f\n”, pi);

LinkedIn Accounting Skill Assessment Answers

}

•  The value of PI needs to be set to 3.141593, not 3.14
•  The declaration of PI needs to say const, not constant.
•  The data type of PI needs to be float not int.
•  The printf statement needs to use PI, not pi.

#### Q13. Which is the smallest program to compile and run without errors?

•  main()
•  int main() {return 0;}
•  main() { }
•  main() { ; }

#### Q14. What is optional in a function declaration?

•  data type of parameters
•  return type of function
•  parameter names
•  number of parameters

•  stdout
•  stdio.h
•  default.h
•  string.h

#### Q16. In which segment does dynamic memory allocation takes place?

•  BSS Segment
•  stack
•  heap
•  data segment

•  dalloc()
•  dealloc()
•  release()
•  free()

•  keywords
•  identifiers
•  tokens
•  functions

#### Q19. When is memory for a variable allocated?

•  during the assigment of the variable
•  during the initialization of the variable
•  during the declaration of the variable
•  during the definition of the variable

#### Q20. By default c uses the call by value method to pass arguments to functions. How can you invoke the call by reference method?

•  by using pointers
•  by declaring functions separately from defining them
•  by using recursive functions
•  by using global variables

#### Q21. A union allows you to store different ___ in the same ___.

•  Objects; Structure
•  Variables; Declaration
•  Data types; Memory location
•  Arrays; Header file

#### Q22. What is the output of this program?

main() {

char c1=’a’ , c2=’A’;

int i=c2-c1;

printf(“%d”, i);

}

•  32
•  Runtime error
•  -32
•  0

#### Q23. What is the difference between scanf() and sscanf() functions?

•  The scanf() function reads data formatted as a string; The sscanf() function reads string input from the screen.
•  The scanf() function reads formatted data from the keyboard; The sscanf() function reads formatted input from a string.
•  The scanf() function reads string data from the keyboard; The sscanf() function reads string data from a string.
•  The scanf() function reads formatted data from a file; The sscanf() function reads input from a selected string

#### Q24. What is not a valid command with this declaration?

char *string[20] = { “one”, “two”, “three”};

•  printf(“%c”, string[1][2]);
•  printf(“%s”, string[1][2]);
•  printf(“%s”, string[1]);
•  printf(string[1]);

#### Q25. What is the expression player->name equivalent to?

•  player.name
•  (\*player).name
•  \*player.name
•  player.\*name

#### Q26. Which program will compile and run without errors?

• [ ]

main() {

for(i=0; i<10; i++) ;

}

• [x]

main() {

int i=0;

for(; i<10; i++) ;

}

• [ ]

main() {

int i;

for(i=0; i<j; i++) ;

}

• [ ]

main() {

int i;

for (i= 10; i<10; i++)

}

#### Q27. What does this function call return?

1 main() { float x = f1(10, 5); }

2 float f1(int a, int b) { return (a/b); }

•  2
•  2.000000
•  a runtime error
•  a compiler error

#### Q28. What does this program create?

#include <stdio.h>

int main() {

int *p = NULL;

return 0;

}

•  a runtime error
•  a NULL pointer
•  a compile error
•  a void pointer

#### Q29. What is an alternative way to write the expression (*x).y?

•  There is no equivalent.
•  x->y
•  *x->y
•  y->x

#### Q30. Compile time errors are static errors that can be found where in the code?

•  in declarations and definitions
•  in functions and expressions
•  in syntax and semantics
•  in objects and statements

•  in Unix
•  in C++
•  in C#
•  in DOS

#### Q32. What does the strcmp(str1, str2); function return?

•  0 if str1 and str2 are the same, a negative number if str1 is less than str2, a positive number if str1 is greater than str2
•  true (1) if str1 and str2 are the same, false (0) if str1 and str2 are not the same
•  true (1) if str1 and str2 are the same, NULL if str1 and str2 are not the same
•  0 if str1 and str2 are the same, a negative number if str2 is less than str1, a positive number if str2 is greater than str1

#### Q33. What is the output of this program?

int a=10, b=20;

int f1(a) { return(a*b); }

main() {

printf(“%d”, f1(5));

}

•  100
•  200
•  5
•  50

#### Q34. Which is not a correct way to declare a string variable?

•  char *string = “Hello World”;
•  char string = “Hello World”;
•  char string[20] = {‘H’, ‘e’, ‘l’, ‘l’, ‘o’, ‘ ‘, ‘W’, ‘o’, ‘r’, ‘l’, ‘d’};
•  char string[] = “Hello World”;

#### Q35. Which choice is an include guard for the header file mylib.h?

• [ ]

#ifdef MYLIB_H

#undef MYLIB_H

// mylib.h content

#endif /* MYLIB_H */

• [x]

#ifndef MYLIB_H

#define MYLIB_H

// mylib.h content

LinkedIn C# Skill Assessment Answers

#endif /* MYLIB_H */

• [ ]

#define MYLIB_H

#include “mylib.h”

#undef MYLIB_H

• [ ]

#ifdef MYLIB_H

#define MYLIB_H

// mylib.h content

#endif /* MYLIB_H */

#### Q36. How many times does the code inside the while loop get executed in this program?

main(){

int x=1;

while(x++<100){

x*=x;

if(x<10) continue;

if(x>50) break

}

}

•  100
•  3
•  5
•  50

#### Q37. File input and output (I/O) in C is done through what?

•  syntax-driven components
•  native interfaces
•  system objects
•  function calls

#### Q38. Directives are translated by the?

•  Pre-processor
•  Compiler
•  Linker
•  Editor

#### Q39. The main loop structures in C programming are the for loop, the while loop, and which other loop?

•  do…while
•  for…in
•  repeat…until
•  do…until

•  global
•  static
•  library
•  system

#### Q41. You have written a function that you want to include as a member of structure a. How is such as structure member defiened?

• [x]

struct a {

void *f1;

};

• [ ]

struct a {

void (*f1)();

};

• [ ]

struct a {

*(void *f1)();

};

• [ ]

struct a {

void *f1();

};

•  FIFO
•  LIFO
•  LILO
•  LOLI

#### Q43. What does this program display?

main(){

char *p = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”;

int i;

for (i=0;i<5;i++) *p++; *p++;

printf(“%c”,*p++);

}

•  K
•  M
•  H
•  G

#### Q44. Describe the relationship between lvalue and rvalue.

•  An lvalue may appear only on the left-hand side of an assignment; an rvalue may appear only on the right-hand side.
•  An lvalue may appear only on the left-hand side of an assignment; an rvalue may appear on either the left-hand or right-hand side.
•  An lvaue and an rvalue may appear on either left-hand or right-hand side of an assignment.
•  An lvalue may appear on the left-hand or right-hand side of an assignment; an rvalue may appear only on the right-hand side.

•  %
•  **
•  *
•  &

#### Q46. Which add function properly returns the updated value of result?

• [x]

void add (int a, int b, int *result)

{

*result = a+b;

}

main()

{

int a = 10;

int b = 20;

int result = 0;

add(a,b,&result);

}

• [ ]

void add (int a, int b, int result)

{

result = a+b;

}

main()

{

int a = 10;

int b = 20;

int result = 0;

add(a,b,result);

}

• [ ]

void add (int a, int b, int *result)

{

result = a+b;

}

main()

{

int a = 10;

int b = 20;

int result = 0;

add(a,b,result);

}

• [ ]

void add (int *a, int *b, int *result)

{

result = a+b;

}

main()

{

int a = 10;

int b = 20;

int result = 0;

add(*a,*b,*result);

}

#### Q47. Consider the number of the Fibonacci series below 100: 0,1,1,2,3,5,8,13,21,34,55,89. Which piece of code outputs the sequence?

• [ ]

void fibonacci(int a, int b)

{

int c = a+b;

if(a>100)

return;

printf(“%d”, a);

fibonacci(a,b);

}

int main()

{

fibonacci(0,1);

}

• [ ]

void fibonacci(int a, int b)

{

int c = a+b;

if(a>100)

return;

printf(“%d”, b);

fibonacci(a,c);

}

int main()

{

fibonacci(0,1);

}

• [x]

void fibonacci(int a, int b)

{

int c = a+b;

if(a>100)

return;

printf(“%d”, a);

fibonacci(b,c);

}

int main()

{

fibonacci(0,1);

}

• [ ]

void fibonacci(int a, int b)

{

int c = a+b;

if(a>100)

return;

printf(“%d”, c);

fibonacci(b,c);

}

int main()

{

fibonacci(0,1);

}

•  intern
•  extern
•  register
•  static

#### Q49. Which line of code, after execution, results in i having the value of 1?

•  for(i=1; i<=1; i++);
•  for(i=1; i=10; i++);
•  for(i=1; i==10; i++);
•  for(i=10; i>=1; i–);

1 main() {

2   int a, b, c;

3   a=10; b=50;

4   c=a * b % a;

5 }

•  50
•  5
•
•  500

### Q51. What is not one of the basic data types in C

•  long double
•  unsigned char
•  array
•  float

### Q52. What is the member access operator for a structure?

•  ,
•  []
•  .
•  :

•  char
•  float
•  int
•  short

#### Q54. what does the ctype tolower() function do?

•  It returns TRUE for lowercase letters of the alphabet.
•  It ensures that text output uses only ASCII values (0 through 127).
•  It returns FALSE for lowercase letters of the alphabet.
•  It converts an uppercase letter of the alphabet to lowercase.

#### Q55. Void pointer vptr is assigned the address of float variable g. What is a valid way to dereference vptr to assign its pointed value to a float variable named f later in the program?

float g;

void *vptr=&g;

•  f=(float *)vptr;
•  f=_(float _)vptr;
•  f=*(float)vptr;
•  f=(float)*vptr;

#### Q56. Using a for loop, how would you write C code to count down from 10 to 1 and display each number on its own line?

• [ ]

for(int i=10;1>0;) {

printf(“%d\n”, i);

i–;

}

• [x]

for (int i=10; i>0; i–)

printf(“%d\n”, i);

• [ ]

for (int i=1; i<=10; i++)

printf(“%d”, i);

• [ ]

for (int i=10; i>=0; i–)

printf(“%d\n”, i);

## LinkedIn Adobe Acrobat Skill Assessment Answers

4.7/5 – (6 votes) If You are searching for a list of…

## LinkedIn Adobe InDesign Skill Assessment Answers

5/5 – (15 votes) If You are searching for a list of…

## LinkedIn Accounting Skill Assessment Answers

5/5 – (5 votes) If You are searching for a list of…

## LinkedIn adobe lightroom Skill Assessment Answers

5/5 – (7 votes) If You are searching for a list of…