Тест 6

Descrição

OOP Quiz sobre Тест 6, criado por Code Purpose em 02-05-2020.
Code Purpose
Quiz por Code Purpose, atualizado more than 1 year ago
Code Purpose
Criado por Code Purpose aproximadamente 4 anos atrás
372
0

Resumo de Recurso

Questão 1

Questão
Што ќе испечати по извршување на следниот програмски код: 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; }
Responda
  • 0 1 2 3 4 5
  • 1 2 3 7 8 9
  • 0 2 3 7 8 9
  • 0 2 0 7 0 0

Questão 2

Questão
Што треба да се вклучи во С++ програма за да се овозможи употреба на стандардните влезо-излезни текови?
Responda
  • #include <stdio.h>
  • #include <fstream>
  • #include <iostream>
  • #include <stdio>

Questão 3

Questão
Дадени се функциите: int f (int x) { return x/4; } float f(float x) { return x/4; } Што ќе се ипечати по извршување на наредбите: double x=8.4; cout << f(x);
Responda
  • 2.1
  • 2
  • 0
  • ќе има грешка при преведување на програмата

Questão 4

Questão
На колку различни начини може да се повика функцијата: int Volume(int x=0, int y = 0, int z =3) { return x*y*z;}
Responda
  • 1
  • 0
  • 3
  • 4

Questão 5

Questão
Ако меморијата била ослободена со кодот delete[] niza, како била резервиранаа:
Responda
  • int* niza = new int
  • char* niza = new char[10]
  • int niza = new int[10]
  • charniza[10]

Questão 6

Questão
Кој е валиден прототип за operator >> на класата Krug: class Krug { private: int a, b, c; public: … }
Responda
  • friend operator &istream>>(istream &input, const Krug &k)
  • friend operator &istream>>(istream &input, Krug &k)
  • operator &istream>>(istream &input, const Krug &k)
  • operator &istream>>(istream &input, Krug &k)

Questão 7

Questão
Дефинирана е класата: 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; } Која од следните наредби не е валидна?
Responda
  • c = a + 8.2;
  • c = 3.4 – b;
  • c = b – 4.6;
  • c = 7.6 + a;

Questão 8

Questão
Како се пристапува до името (name) на првиот елемент на полето emp во структурата comp: struct Employee { char name[100]; }; struct Company ( Employee emp[50]; } comp;
Responda
  • comp.emp[0].name;
  • comp->emp[0]->name;
  • Company :: emp[0].name;
  • comp.emp.name[0];

Questão 9

Questão
Даден е следниот програмски код: typedef struct oopStruktura { int i; } oopStr; typedef oopStr *pok; oopStr prom; pok prom_pok = &prom; Која од следните наредби е валидна?
Responda
  • prom_pok.i = 10;
  • prom_pok->i = 10;
  • oopStr->i = 10;
  • prom->i = 10;

Questão 10

Questão
Нека е дадена класа за репрезентација на правоаголник. Која од следните наредби за креирање објект е грешка: class p{ int c, d; public: P(int c, int d =6) { this->c = c; this->d = d; } };
Responda
  • P c();
  • P *c = new P (3);
  • P c(3);
  • P c(1, 2);

Semelhante

Object Oriented Programming Concepts
Cmagapu
Concepts of Objects and Classes
BK Modding
Introduction to Java
BK Modding
Paradigma de Programación Orientado a Objetos
JULIAN CAMILO RIVEROS FONSECA
1.2.4 OOP
Louis N
constructor
balakvm.it
Classes
needajob517
OOP Definitions
Matt Dumbrill
Object Oriented Programming Concepts
agni bharathi
Object Oriented Programming Concepts
Rian McCollom