Web Interview from MathWork 2015 Fall

Web Interview from MathWork 2015 Fall

Interview

Web Interview from MathWork At 2015.9.20

from Technical Support to All Participants:  test message from Technical Support to All Participants:  Will the code compile and what is the problem with code? Or what is the output

#include <iostream>
using namespace std;
class Student {
    private:
        char *name;
};
int main()
{
   Student *s = new Student();
   Student s1 = *s;
   Student s2;
   s2 = s1;
   delete s;
   
   return 0;
}

from Technical Support to All Participants: 

#include <iostream>
using std::cout;
using std::endl;
class A {
   public:
     ~A() {
        cout << "A" << endl;
      }
};
class B : public A{
   public :
      ~B() {
        cout << "B" << endl;
      }
};
int main (int argc, char **argv) {
   A *ptr = new B();
   delete ptr;
   return 0;
}

from Technical Support to All Participants: 

#include <iostream>
using std::cout;
using std::endl;
int main (int argc, char **argv) {
  int *arr = new int[5];
  for (int idx = 0; idx < 5; ++idx) {
    arr[idx] = idx;
        cout << *(idx + arr) * 2 <<" ";
    }
  cout<<endl;
  delete arr;
  return 0;
}

What is the value of a?

from Technical Support to All Participants: 
enum COLOR            /* Defines an enumeration type    */
{
    red,
    blue = 0,     
    green,         
    yellow
};
enum COLOR a = yellow;

from Technical Support to All Participants: 

#include<stdio.h>
int main(void)
{
    char *ptr = "Linux";
    printf("\n [%c] \n",*ptr++);
    printf("\n [%c] \n",*ptr);
    return 0;
}

from Xiongy Cui to All Participants:   [L]

from Xiongy Cui to All Participants:   [i ]

from Technical Support to All Participants: 

void func() {
        static int x = 0; 
        printf("%d\n", x); 
        x = x + 1;
}
 
int main(int argc, char *argv[]) {
        func(); 
        func(); 
        func(); 
        return 0;
}

INTERVIEW
interview MathWork

Dialogue & Discussion