GoConqr has a new look! Let us know what you think.

Quiz

Тест 6

Code Purpose 10 questions

Take the quiz

Questions in this quiz (10)

  1. 1Што ќе испечати по извршување на следниот програмски код:

    enum counts { n1, n2=2, n3, n4=7, n5, n6 };
    int main(){
    counts c = n1;
    cout << c << “ “;
    c = n2; cout << c << “ “; c = n3; cout << c << “ “;
    c = n4; cout << c << “ “; c = n5; cout << c << “ “;
    c = n6; cout << c << “ “; return 0;
    }
    1. A0 1 2 3 4 5
    2. B1 2 3 7 8 9
    3. C0 2 3 7 8 9
    4. D0 2 0 7 0 0
  2. 2Што треба да се вклучи во С++ програма за да се овозможи употреба на стандардните влезо-излезни текови?
    1. A#include <stdio.h>
    2. B#include <fstream>
    3. C#include <iostream>
    4. D#include <stdio>
  3. 3Дадени се функциите:

    int f (int x) { return x/4; }
    float f(float x) { return x/4; }

    Што ќе се ипечати по извршување на наредбите:
    double x=8.4; cout << f(x);
    1. A2.1
    2. B2
    3. C0
    4. Dќе има грешка при преведување на програмата
  4. 4На колку различни начини може да се повика функцијата:

    int Volume(int x=0, int y = 0, int z =3) { return x*y*z;}
    1. A1
    2. B0
    3. C3
    4. D4
  5. 5Ако меморијата била ослободена со кодот delete[] niza, како била резервиранаа:
    1. Aint* niza = new int
    2. Bchar* niza = new char[10]
    3. Cint niza = new int[10]
    4. Dcharniza[10]
  6. 6Кој е валиден прототип за operator >> на класата Krug:
    class Krug { private: int a, b, c; public: … }
    1. Afriend operator &istream>>(istream &input, const Krug &k)
    2. Bfriend operator &istream>>(istream &input, Krug &k)
    3. Coperator &istream>>(istream &input, const Krug &k)
    4. Doperator &istream>>(istream &input, Krug &k)
  7. 7Дефинирана е класата:
    class A {
    double i;
    public: A(double ii = 0.0) {}
    const A operator - (const A & a1) {
    return A(i - a1.i);
    }
    friend
    const A operator + (const A & a1,
    const A & a2) {
    return A(a1.i + a2.i);
    }
    };
    int main() {
    A a(2.3), b(3.5), c;

    return 0;
    }
    Која од следните наредби не е валидна?
    1. Ac = a + 8.2;
    2. Bc = 3.4 – b;
    3. Cc = b – 4.6;
    4. Dc = 7.6 + a;
  8. 8Како се пристапува до името (name) на првиот елемент на полето emp во структурата comp:

    struct Employee { char name[100]; };
    struct Company ( Employee emp[50]; } comp;
    1. Acomp.emp[0].name;
    2. Bcomp->emp[0]->name;
    3. CCompany :: emp[0].name;
    4. Dcomp.emp.name[0];
  9. 9Даден е следниот програмски код:
    typedef struct oopStruktura
    { int i; } oopStr;
    typedef oopStr *pok; oopStr prom; pok prom_pok = &prom;
    Која од следните наредби е валидна?
    1. Aprom_pok.i = 10;
    2. Bprom_pok->i = 10;
    3. CoopStr->i = 10;
    4. Dprom->i = 10;
  10. 10Нека е дадена класа за репрезентација на правоаголник. Која од следните наредби за креирање објект е грешка:

    class p{
    int c, d;
    public:
    P(int c, int d =6) {
    this->c = c;
    this->d = d;
    }
    };

    1. AP c();
    2. BP *c = new P (3);
    3. CP c(3);
    4. DP c(1, 2);

Information

Description
OOP Quiz on Тест 6, created by Code Purpose on 02/05/2020.
Language
English
Views
383
Tags
oop
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?