Tìm kiếm:
TRANG NHÀ
Giới thiệu VNEDU.ORG
Điều khoản và bản quyền
Liên lạc VNEDU
TRẮC NGHIỆM TRỰC TUYẾN
---Công Cụ:---
Soạn Biểu thức
Bảng màu HTML
Ký hiệu đặc biệt 01
Ký hiệu đặc biệt 02
Ký hiệu đặc biệt 03
Ký hiệu đặc biệt 04
Ký hiệu đặc biệt 05
Ký hiệu đặc biệt 06
Ký hiệu đặc biệt 07
Ký hiệu đặc biệt [Toán]
Tin Học   ||  Căn Bản    Văn Phòng    Hệ Thống - Mạng    Phần Mềm Ứng Dụng    Kỹ thuật số    Lập trình    SQL  

Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 08
Ngày làm bài: Hôm nay lúc 14:34:10 (Server time)
Số câu hỏi: 10.   Tổng điểm: 10
Yêu cầu hoàn thành: 60 phút.
Thời gian còn lại: 
Cỡ chữ câu hỏi:  Cỡ chữ đáp án:


1-
What will be the output of the program?
#include<stdio.h>
int main()
{
    int x = 10, y = 20;
    if(!(!x) && x)
        printf("x = %d\n", x);
    else
        printf("y = %d\n", y);
    return 0;
}

  A - 
y =20
  B - 
x = 0
  C - 
x = 10
  D - 
x = 1
2-
What will be the output of the program?
#include<stdio.h>
int main()
{
    int i=4;
    switch(i)
    {
        default:
           printf("This is default\n");
        case 1:
           printf("This is case 1\n");
           break;
        case 2:
           printf("This is case 2\n");
           break;
        case 3:
           printf("This is case 3\n");
    }
    return 0;
}

  A - 
This is default
This is case 1
  B - 
This is case 3
This is default
  C - 
This is case 1
This is case 3
  D - 
This is default
3-
What will be the output of the program?
#include<stdio.h>
int main()
{
    int i = 1;
    switch(i)
    {
        printf("Hello\n");
        case 1:
            printf("Hi\n");
            break;
        case 2:
            printf("\nBye\n");
            break;
    }
    return 0;
}

  A - 
Hello
Hi
  B - 
Hello
Bye
  C - 
Hi
  D - 
Bye
4-
What will be the output of the program?
#include<stdio.h>
int main()
{
    char j=1;
    while(j < 5)
    {
        printf("%d, ", j);
        j = j+1;
    }
    printf("\n");
    return 0;
}

  A - 
1 2 3 ... 127
  B - 
1 2 3 ... 255
  C - 
1 2 3 ... 127 128 0 1 2 3 ... infinite times
  D - 
1, 2, 3, 4
5-
What will be the output of the program?
#include<stdio.h>
int main()
{
    int x, y, z;
    x=y=z=1;
    z = ++x || ++y && ++z;
    printf("x=%d, y=%d, z=%d\n", x, y, z);
    return 0;
}

  A - 
x=2, y=1, z=1
  B - 
x=2, y=2, z=1
  C - 
x=2, y=2, z=2
  D - 
x=1, y=2, z=1
6-
Point out the error, if any in the for loop.
#include<stdio.h>
int main()
{
    int i=1;
    for(;;)
    {
        printf("%d\n", i++);
        if(i>10)
           break;
    }
    return 0;
}

  A - 
There should be a condition in the for loop
  B - 
The two semicolons should be dropped
  C - 
The for loop should be replaced with while loop.
  D - 
No error
7-
Point out the error, if any in the program.
#include<stdio.h>
int main()
{
    int a = 10;
    switch(a)
    {
    }
    printf("This is c program.");
	return 0;
}

  A - 
Error: No case statement specified
  B - 
Error: No default specified
  C - 
No Error
  D - 
Error: infinite loop occurs
8-
Point out the error, if any in the program.
#include<stdio.h>
int main()
{
    int i = 1;
    switch(i)
    {
        printf("This is c program.");
        case 1:
            printf("Case1");
            break;
        case 2:
            printf("Case2");
            break;
    }
return 0;
}

  A - 
Error: No default specified
  B - 
Error: Invalid printf statement after switch statement
  C - 
No Error and prints "Case1"
  D - 
None of above
9-
Point out the error, if any in the while loop.
#include<stdio.h>
int main()
{
    int i=1;
    while()
    {
        printf("%d\n", i++);
        if(i>10)
           break;
    }
    return 0;
}

  A - 
There should be a condition in the while loop
  B - 
There should be at least a semicolon in the while
  C - 
The while loop should be replaced with for loop.
  D - 
No error
10-
Which of the following errors would be reported by the compiler on compiling the program given below?
#include<stdio.h>
int main()
{
    int a = 5;
    switch(a)
    {
	case 1:
	printf("First");

	case 2:
	printf("Second");

	case 3 + 2:
	printf("Third");

	case 5:
	printf("Final");
	break;

    }
    return 0;
}

  A - 
There is no break statement in each case.
  B - 
Expression as in case 3 + 2 is not allowed.
  C - 
Duplicate case case 5:
  D - 
No error will be reported.
 
[Người đăng: Thành Lãm - ST]
Ghé thăm Kênh của Vị Sư "hai lần chết đi sống lại"
Tu Si Chau Soc Thon

https://www.youtube.com/channel/UCoyC9WTTVR-M3qpTKKEXGnQ

Chau Soc Thon Official Channel


Phong Bảo Official
Phong Bao Official
Xem Nhiều nhất
Trắc Nghiệm Pascal - Bài 20
Trắc Nghiệm ASP.NET - Bài 12
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 16
Trắc Nghiệm ASP.NET - Bài 01
Trắc Nghiệm ASP.NET - Bài 03
Trắc nghiệm C++ - Bài 18
Trắc Nghiệm C# - Bài 53
Trắc Nghiệm ASP.NET - Bài 02
Trắc Nghiệm C# - Bài 42
Trắc Nghiệm Java - Bài 01
Trắc Nghiệm ASP.NET - Bài 04
Trắc Nghiệm Pascal - Bài 22
Trắc Nghiệm ASP.NET - Bài 13
Trắc Nghiệm ASP.NET - Bài 09
Trắc Nghiệm ASP.NET - Bài 08
Trắc nghiệm PHP - Bài 01
Trắc Nghiệm ASP.NET - Bài 06
Trắc Nghiệm ASP.NET - Bài 11
Trắc Nghiệm ASP.NET - Bài 05
Trắc Nghiệm ASP.NET - Bài 23
Đề Xuất
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 31
Trắc Nghiệm C# - Bài 44
Trắc Nghiệm Visual Basic - Bài 33
Trắc Nghiệm Visual Basic - Bài 09
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 09
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 16
Trắc Nghiệm ASP.NET (English) - Bài 02
Trắc Nghiệm C Sharp - Bài 08
Trắc Nghiệm Thiết Kế Web (English) - Bài 17
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 05
Trắc Nghiệm Thiết Kế Web (English) - Bài 48
Trắc Nghiệm ASP.NET (English) - Bài 01
Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 21
Trắc Nghiệm Java - Bài 49
Trắc Nghiệm ASP.NET (English) - Bài 09
Trắc Nghiệm Thiết Kế Web (English) - Bài 13
Trắc Nghiệm C Sharp - Bài 14
Trắc nghiệm XML - Bài 31
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 16
Trắc Nghiệm Java - Bài 18
Phát triển hệ thống: TRƯƠNG HỮU ĐỨC - Phiên bản 3.0 - © Copyright 2013 - 2024 - VNEDU.ORG

free counters