#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
int n;
long long arr[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    long long sum = 0, x = 0;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
      x ^= arr[i];
    }
    vector<long long> ans;
    if (sum == x * 2) {
      cout << 0 << endl << endl;
    } else if (!x) {
      cout << 1 << endl;
      cout << sum << endl;
    } else {
      ans.push_back(x);
      sum += x;
      x = 0;
      ans.push_back(sum);
      cout << ans.size() << endl;
      for (auto i : ans) cout << i << " ";
      cout << endl;
    }
  }
  return 0;
}
